Add sample cell filename, cell sample size, and sample plate size to metadata

This commit is contained in:
eugenefischer
2022-09-30 02:58:15 -05:00
parent b8aeeb988f
commit 593dd6c60f
5 changed files with 35 additions and 10 deletions

View File

@@ -58,7 +58,9 @@ public class CellFileReader {
} }
public CellSample getCellSample() { public CellSample getCellSample() {
return new CellSample(distinctCells, cdr1Freq); CellSample sample = new CellSample(distinctCells, cdr1Freq);
sample.setFilename(filename);
return sample;
} }
public String getFilename() { return filename;} public String getFilename() { return filename;}

View File

@@ -7,6 +7,7 @@ public class CellSample {
private List<String[]> cells; private List<String[]> cells;
private Integer cdr1Freq; private Integer cdr1Freq;
private String filename;
public CellSample(Integer numDistinctCells, Integer cdr1Freq){ public CellSample(Integer numDistinctCells, Integer cdr1Freq){
this.cdr1Freq = cdr1Freq; this.cdr1Freq = cdr1Freq;
@@ -38,6 +39,7 @@ public class CellSample {
distinctCells.add(tmp); distinctCells.add(tmp);
} }
this.cells = distinctCells; this.cells = distinctCells;
this.filename = filename;
} }
public CellSample(List<String[]> cells, Integer cdr1Freq){ public CellSample(List<String[]> cells, Integer cdr1Freq){
@@ -57,4 +59,8 @@ public class CellSample {
return cells.size(); return cells.size();
} }
public String getFilename() { return filename; }
public void setFilename(String filename) { this.filename = filename; }
} }

View File

@@ -43,7 +43,7 @@ public class GraphMLFileWriter {
private Map<String, Attribute> createGraphAttributes(){ private Map<String, Attribute> createGraphAttributes(){
Map<String, Attribute> attributes = new HashMap<>(); Map<String, Attribute> attributes = new HashMap<>();
//Sample plate filename //Sample plate filename
attributes.put("sample plate filename", DefaultAttribute.createAttribute(data.getSourceFilename())); attributes.put("sample plate filename", DefaultAttribute.createAttribute(data.getPlateFilename()));
// Number of wells // Number of wells
attributes.put("well count", DefaultAttribute.createAttribute(data.getNumWells().toString())); attributes.put("well count", DefaultAttribute.createAttribute(data.getNumWells().toString()));
//Well populations //Well populations

View File

@@ -9,7 +9,9 @@ import java.util.Map;
//Custom vertex class means a lot of the map data can now be encoded in the graph itself //Custom vertex class means a lot of the map data can now be encoded in the graph itself
public class GraphWithMapData implements java.io.Serializable { public class GraphWithMapData implements java.io.Serializable {
private String sourceFilename; private String cellFilename;
private int cellSampleSize;
private String plateFilename;
private final SimpleWeightedGraph graph; private final SimpleWeightedGraph graph;
private final int numWells; private final int numWells;
private final Integer[] wellPopulations; private final Integer[] wellPopulations;
@@ -112,12 +114,20 @@ public class GraphWithMapData implements java.io.Serializable {
return time; return time;
} }
public void setSourceFilename(String filename) { public void setCellFilename(String filename) { this.cellFilename = filename; }
this.sourceFilename = filename;
public String getCellFilename() { return this.cellFilename; }
public Integer getCellSampleSize() { return this.cellSampleSize; }
public void setCellSampleSize(int size) { this.cellSampleSize = size;}
public void setPlateFilename(String filename) {
this.plateFilename = filename;
} }
public String getSourceFilename() { public String getPlateFilename() {
return sourceFilename; return plateFilename;
} }
public Double getReadErrorRate() { public Double getReadErrorRate() {

View File

@@ -137,8 +137,12 @@ public class Simulator implements GraphModificationFunctions {
//create GraphWithMapData object //create GraphWithMapData object
GraphWithMapData output = new GraphWithMapData(graph, numWells, samplePlate.getPopulations(), distCellsMapAlphaKey, GraphWithMapData output = new GraphWithMapData(graph, numWells, samplePlate.getPopulations(), distCellsMapAlphaKey,
alphaCount, betaCount, samplePlate.getError(), readDepth, readErrorRate, errorCollisionRate, realSequenceCollisionRate, time); alphaCount, betaCount, samplePlate.getError(), readDepth, readErrorRate, errorCollisionRate, realSequenceCollisionRate, time);
//Set source file name in graph to name of sample plate //Set cell sample file name in graph to name of cell sample
output.setSourceFilename(samplePlate.getFilename()); output.setCellFilename(cellSample.getFilename());
//Set cell sample size in graph
output.setCellSampleSize(cellSample.getCellCount());
//Set sample plate file name in graph to name of sample plate
output.setPlateFilename(samplePlate.getFilename());
//return GraphWithMapData object //return GraphWithMapData object
return output; return output;
} }
@@ -304,7 +308,10 @@ public class Simulator implements GraphModificationFunctions {
Map<String, String> metadata = new LinkedHashMap<>(); Map<String, String> metadata = new LinkedHashMap<>();
metadata.put("sample plate filename", data.getSourceFilename()); metadata.put("cell sample filename", data.getCellFilename());
metadata.put("cell sample size", data.getCellSampleSize().toString());
metadata.put("sample plate filename", data.getPlateFilename());
metadata.put("sample plate well count", data.getNumWells().toString());
metadata.put("sequence dropout rate", data.getDropoutRate().toString()); metadata.put("sequence dropout rate", data.getDropoutRate().toString());
metadata.put("graph filename", dataFilename); metadata.put("graph filename", dataFilename);
metadata.put("MWM algorithm type", algoType); metadata.put("MWM algorithm type", algoType);