Compare commits
7 Commits
68ee9e4bb6
...
v1.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e9a250890 | |||
| e2a996c997 | |||
| a5db89cb0b | |||
| 1630f9ccba | |||
| d785aa0da2 | |||
| a7afeb6119 | |||
| f8167b0774 |
14
readme.md
14
readme.md
@@ -159,8 +159,10 @@ Structure:
|
|||||||
Graph and Data files are serialized binaries of a Java object containing the weigthed bipartite graph representation of a
|
Graph and Data files are serialized binaries of a Java object containing the weigthed bipartite graph representation of a
|
||||||
Sample Plate, along with the necessary metadata for matching and results output. Making them requires a Cell Sample file
|
Sample Plate, along with the necessary metadata for matching and results output. Making them requires a Cell Sample file
|
||||||
(to construct a list of correct sequence pairs for checking the accuracy of BiGpairSEQ simulations) and a
|
(to construct a list of correct sequence pairs for checking the accuracy of BiGpairSEQ simulations) and a
|
||||||
Sample Plate file (to construct the associated occupancy graph). These files can be several gigabytes in size.
|
Sample Plate file (to construct the associated occupancy graph).
|
||||||
Writing them to a file lets us generate a graph and its metadata once, then use it for multiple different BiGpairSEQ simulations.
|
|
||||||
|
These files can be several gigabytes in size. Writing them to a file lets us generate a graph and its metadata once,
|
||||||
|
then use it for multiple different BiGpairSEQ simulations.
|
||||||
|
|
||||||
Options for creating a Graph and Data file:
|
Options for creating a Graph and Data file:
|
||||||
* The Cell Sample file to use
|
* The Cell Sample file to use
|
||||||
@@ -172,7 +174,11 @@ portable data format may be implemented in the future. The tricky part is encodi
|
|||||||
---
|
---
|
||||||
|
|
||||||
#### Matching Results Files
|
#### Matching Results Files
|
||||||
Matching results files consist of the results of a BiGpairSEQ matching simulation.
|
Matching results files consist of the results of a BiGpairSEQ matching simulation. Making them requires a Graph and
|
||||||
|
Data file. To save file I/O time, the data from the most recent Graph and Data file read or generated is cached
|
||||||
|
by the simulator. Subsequent BiGpairSEQ simulations run with the same input filename will use the cached version
|
||||||
|
rather than reading in again from disk.
|
||||||
|
|
||||||
Files are in CSV format. Rows are sequence pairings with extra relevant data. Columns are pairing-specific details.
|
Files are in CSV format. Rows are sequence pairings with extra relevant data. Columns are pairing-specific details.
|
||||||
Metadata about the matching simulation is included as comments. Comments are preceded by `#`.
|
Metadata about the matching simulation is included as comments. Comments are preceded by `#`.
|
||||||
|
|
||||||
@@ -239,7 +245,7 @@ slightly less time than the simulation itself. Real elapsed time from start to f
|
|||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
* ~~Try invoking GC at end of workloads to reduce paging to disk~~ DONE
|
* ~~Try invoking GC at end of workloads to reduce paging to disk~~ DONE
|
||||||
* Hold graph data in memory until another graph is read-in? ~~ABANDONED~~ UNABANDONED
|
* Hold graph data in memory until another graph is read-in? ~~ABANDONED~~ ~~UNABANDONED~~ DONE
|
||||||
* ~~*No, this won't work, because BiGpairSEQ simulations alter the underlying graph based on filtering constraints. Changes would cascade with multiple experiments.*~~
|
* ~~*No, this won't work, because BiGpairSEQ simulations alter the underlying graph based on filtering constraints. Changes would cascade with multiple experiments.*~~
|
||||||
* Might have figured out a way to do it, by taking edges out and then putting them back into the graph. This may actually be possible. If so, awesome.
|
* Might have figured out a way to do it, by taking edges out and then putting them back into the graph. This may actually be possible. If so, awesome.
|
||||||
* See if there's a reasonable way to reformat Sample Plate files so that wells are columns instead of rows.
|
* See if there's a reasonable way to reformat Sample Plate files so that wells are columns instead of rows.
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ public class GraphDataObjectReader {
|
|||||||
BufferedInputStream fileIn = new BufferedInputStream(new FileInputStream(filename));
|
BufferedInputStream fileIn = new BufferedInputStream(new FileInputStream(filename));
|
||||||
ObjectInputStream in = new ObjectInputStream(fileIn))
|
ObjectInputStream in = new ObjectInputStream(fileIn))
|
||||||
{
|
{
|
||||||
|
System.out.println("Reading graph data from file. This may take some time");
|
||||||
|
System.out.println("File I/O time is not included in results");
|
||||||
data = (GraphWithMapData) in.readObject();
|
data = (GraphWithMapData) in.readObject();
|
||||||
} catch (FileNotFoundException | ClassNotFoundException ex) {
|
} catch (FileNotFoundException | ClassNotFoundException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|||||||
@@ -18,8 +18,11 @@ public class GraphDataObjectWriter {
|
|||||||
|
|
||||||
public void writeDataToFile() {
|
public void writeDataToFile() {
|
||||||
try (BufferedOutputStream bufferedOut = new BufferedOutputStream(new FileOutputStream(filename));
|
try (BufferedOutputStream bufferedOut = new BufferedOutputStream(new FileOutputStream(filename));
|
||||||
|
|
||||||
ObjectOutputStream out = new ObjectOutputStream(bufferedOut);
|
ObjectOutputStream out = new ObjectOutputStream(bufferedOut);
|
||||||
){
|
){
|
||||||
|
System.out.println("Writing graph and occupancy data to file. This may take some time.");
|
||||||
|
System.out.println("File I/O time is not included in results.");
|
||||||
out.writeObject(data);
|
out.writeObject(data);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import org.jgrapht.graph.SimpleWeightedGraph;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public abstract class GraphModificationFunctions {
|
public abstract class GraphModificationFunctions {
|
||||||
|
|
||||||
@@ -18,9 +19,11 @@ public abstract class GraphModificationFunctions {
|
|||||||
Integer weight = (int) graph.getEdgeWeight(e);
|
Integer weight = (int) graph.getEdgeWeight(e);
|
||||||
Integer[] edge = {source, target, weight};
|
Integer[] edge = {source, target, weight};
|
||||||
removedEdges.add(edge);
|
removedEdges.add(edge);
|
||||||
graph.removeEdge(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (Integer[] edge : removedEdges) {
|
||||||
|
graph.removeEdge(edge[0], edge[1]);
|
||||||
|
}
|
||||||
return removedEdges;
|
return removedEdges;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,9 +44,11 @@ public abstract class GraphModificationFunctions {
|
|||||||
Integer weight = (int) graph.getEdgeWeight(e);
|
Integer weight = (int) graph.getEdgeWeight(e);
|
||||||
Integer[] edge = {source, target, weight};
|
Integer[] edge = {source, target, weight};
|
||||||
removedEdges.add(edge);
|
removedEdges.add(edge);
|
||||||
graph.removeEdge(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (Integer[] edge : removedEdges) {
|
||||||
|
graph.removeEdge(edge[0], edge[1]);
|
||||||
|
}
|
||||||
return removedEdges;
|
return removedEdges;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,9 +71,11 @@ public abstract class GraphModificationFunctions {
|
|||||||
Integer intWeight = (int) graph.getEdgeWeight(e);
|
Integer intWeight = (int) graph.getEdgeWeight(e);
|
||||||
Integer[] edge = {source, target, intWeight};
|
Integer[] edge = {source, target, intWeight};
|
||||||
removedEdges.add(edge);
|
removedEdges.add(edge);
|
||||||
graph.removeEdge(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (Integer[] edge : removedEdges) {
|
||||||
|
graph.removeEdge(edge[0], edge[1]);
|
||||||
|
}
|
||||||
return removedEdges;
|
return removedEdges;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ public class InteractiveInterface {
|
|||||||
assert filename != null;
|
assert filename != null;
|
||||||
CellFileWriter writer = new CellFileWriter(filename, sample);
|
CellFileWriter writer = new CellFileWriter(filename, sample);
|
||||||
writer.writeCellsToFile();
|
writer.writeCellsToFile();
|
||||||
System.gc();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Output a CSV of sample plate
|
//Output a CSV of sample plate
|
||||||
@@ -187,7 +186,6 @@ public class InteractiveInterface {
|
|||||||
System.out.println("Writing Sample Plate to file");
|
System.out.println("Writing Sample Plate to file");
|
||||||
writer.writePlateFile();
|
writer.writePlateFile();
|
||||||
System.out.println("Sample Plate written to file: " + filename);
|
System.out.println("Sample Plate written to file: " + filename);
|
||||||
System.gc();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,11 +230,11 @@ public class InteractiveInterface {
|
|||||||
GraphWithMapData data = Simulator.makeGraph(cells, plate, true);
|
GraphWithMapData data = Simulator.makeGraph(cells, plate, true);
|
||||||
assert filename != null;
|
assert filename != null;
|
||||||
GraphDataObjectWriter dataWriter = new GraphDataObjectWriter(filename, data);
|
GraphDataObjectWriter dataWriter = new GraphDataObjectWriter(filename, data);
|
||||||
System.out.println("Writing graph and occupancy data to file. This may take some time.");
|
|
||||||
System.out.println("File I/O time is not included in results.");
|
|
||||||
dataWriter.writeDataToFile();
|
dataWriter.writeDataToFile();
|
||||||
System.out.println("Graph and Data file written to: " + filename);
|
System.out.println("Graph and Data file written to: " + filename);
|
||||||
System.gc();
|
BiGpairSEQ.setGraph(data);
|
||||||
|
BiGpairSEQ.setGraphFilename(filename);
|
||||||
|
System.out.println("Graph and Data file " + filename + " cached.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,11 +275,9 @@ public class InteractiveInterface {
|
|||||||
assert graphFilename != null;
|
assert graphFilename != null;
|
||||||
//check if this is the same graph we already have in memory.
|
//check if this is the same graph we already have in memory.
|
||||||
GraphWithMapData data;
|
GraphWithMapData data;
|
||||||
if(!(graphFilename.equals(BiGpairSEQ.getGraphFilename()) || BiGpairSEQ.getGraph() == null)) {
|
if(!(graphFilename.equals(BiGpairSEQ.getGraphFilename())) || BiGpairSEQ.getGraph() == null) {
|
||||||
BiGpairSEQ.clearGraph();
|
BiGpairSEQ.clearGraph();
|
||||||
//read object data from file
|
//read object data from file
|
||||||
System.out.println("Reading graph data from file. This may take some time");
|
|
||||||
System.out.println("File I/O time is not included in results");
|
|
||||||
GraphDataObjectReader dataReader = new GraphDataObjectReader(graphFilename);
|
GraphDataObjectReader dataReader = new GraphDataObjectReader(graphFilename);
|
||||||
data = dataReader.getData();
|
data = dataReader.getData();
|
||||||
//set new graph in memory and new filename
|
//set new graph in memory and new filename
|
||||||
@@ -300,7 +296,6 @@ public class InteractiveInterface {
|
|||||||
System.out.println("Writing results to file");
|
System.out.println("Writing results to file");
|
||||||
writer.writeResultsToFile();
|
writer.writeResultsToFile();
|
||||||
System.out.println("Results written to file: " + filename);
|
System.out.println("Results written to file: " + filename);
|
||||||
System.gc();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///////
|
///////
|
||||||
|
|||||||
3
src/main/java/META-INF/MANIFEST.MF
Normal file
3
src/main/java/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
Manifest-Version: 1.0
|
||||||
|
Main-Class: BiGpairSEQ
|
||||||
|
|
||||||
@@ -249,13 +249,13 @@ public class Simulator {
|
|||||||
double pairingErrorRate = (double) falseCount / (trueCount + falseCount);
|
double pairingErrorRate = (double) falseCount / (trueCount + falseCount);
|
||||||
BigDecimal pairingErrorRateTrunc = new BigDecimal(pairingErrorRate, mc);
|
BigDecimal pairingErrorRateTrunc = new BigDecimal(pairingErrorRate, mc);
|
||||||
//get list of well concentrations
|
//get list of well concentrations
|
||||||
List<Integer> wellPopulations = Arrays.asList(data.getWellConcentrations());
|
Integer[] wellPopulations = data.getWellConcentrations();
|
||||||
//make string out of concentrations list
|
//make string out of concentrations list
|
||||||
StringBuilder populationsStringBuilder = new StringBuilder();
|
StringBuilder populationsStringBuilder = new StringBuilder();
|
||||||
populationsStringBuilder.append(wellPopulations.remove(0).toString());
|
populationsStringBuilder.append(wellPopulations[0].toString());
|
||||||
for(Integer i: wellPopulations){
|
for(int i = 1; i < wellPopulations.length; i++){
|
||||||
populationsStringBuilder.append(", ");
|
populationsStringBuilder.append(", ");
|
||||||
populationsStringBuilder.append(i.toString());
|
populationsStringBuilder.append(wellPopulations[i].toString());
|
||||||
}
|
}
|
||||||
String wellPopulationsString = populationsStringBuilder.toString();
|
String wellPopulationsString = populationsStringBuilder.toString();
|
||||||
//total simulation time
|
//total simulation time
|
||||||
|
|||||||
Reference in New Issue
Block a user