clean up metadata

This commit is contained in:
eugenefischer
2022-09-27 12:15:12 -05:00
parent 2bf2a9f5f7
commit d71a99555c
2 changed files with 42 additions and 29 deletions

View File

@@ -10,26 +10,33 @@ public class MatchingResult {
private final List<String> headers;
private final List<List<String>> allResults;
private final Map<String, String> matchMap;
private final Duration time;
public MatchingResult(Map<String, String> metadata, List<String> headers,
List<List<String>> allResults, Map<String, String>matchMap, Duration time){
List<List<String>> allResults, Map<String, String>matchMap){
/*
* POSSIBLE KEYS FOR METADATA MAP ARE:
* sample plate filename *
* graph filename *
* matching weight *
* well populations *
* total alphas found *
* total betas found *
* high overlap threshold *
* low overlap threshold *
* maximum occupancy difference *
* minimum overlap percent *
* sequence read depth *
* sequence read error rate *
* read error collision rate *
* total alphas read from plate *
* total betas read from plate *
* alphas in graph (after pre-filtering) *
* betas in graph (after pre-filtering) *
* high overlap threshold for pairing *
* low overlap threshold for pairing *
* maximum occupancy difference for pairing *
* minimum overlap percent for pairing *
* pairing attempt rate *
* correct pairing count *
* incorrect pairing count *
* pairing error rate *
* simulation time (seconds)
* time to generate graph (seconds) *
* time to pair sequences (seconds) *
* total simulation time (seconds) *
*/
this.metadata = metadata;
this.comments = new ArrayList<>();
@@ -39,8 +46,6 @@ public class MatchingResult {
this.headers = headers;
this.allResults = allResults;
this.matchMap = matchMap;
this.time = time;
}
public Map<String, String> getMetadata() {return metadata;}
@@ -61,9 +66,9 @@ public class MatchingResult {
return matchMap;
}
public Duration getTime() {
return time;
}
// public Duration getTime() {
// return time;
// }
public String getPlateFilename() {
return metadata.get("sample plate filename");
@@ -84,20 +89,20 @@ public class MatchingResult {
}
public Integer getAlphaCount() {
return Integer.parseInt(metadata.get("total alpha count"));
return Integer.parseInt(metadata.get("total alphas read from plate"));
}
public Integer getBetaCount() {
return Integer.parseInt(metadata.get("total beta count"));
return Integer.parseInt(metadata.get("total betas read from plate"));
}
public Integer getHighOverlapThreshold() { return Integer.parseInt(metadata.get("high overlap threshold"));}
public Integer getHighOverlapThreshold() { return Integer.parseInt(metadata.get("high overlap threshold for pairing"));}
public Integer getLowOverlapThreshold() { return Integer.parseInt(metadata.get("low overlap threshold"));}
public Integer getLowOverlapThreshold() { return Integer.parseInt(metadata.get("low overlap threshold for pairing"));}
public Integer getMaxOccupancyDifference() { return Integer.parseInt(metadata.get("maximum occupancy difference"));}
public Integer getMaxOccupancyDifference() { return Integer.parseInt(metadata.get("maximum occupancy difference for pairing"));}
public Integer getMinOverlapPercent() { return Integer.parseInt(metadata.get("minimum overlap percent"));}
public Integer getMinOverlapPercent() { return Integer.parseInt(metadata.get("minimum overlap percent for pairing"));}
public Double getPairingAttemptRate() { return Double.parseDouble(metadata.get("pairing attempt rate"));}
@@ -107,6 +112,6 @@ public class MatchingResult {
public Double getPairingErrorRate() { return Double.parseDouble(metadata.get("pairing error rate"));}
public String getSimulationTime() { return metadata.get("simulation time (seconds)"); }
public String getSimulationTime() { return metadata.get("total simulation time (seconds)"); }
}

View File

@@ -331,22 +331,28 @@ public class Simulator implements GraphModificationFunctions {
populationsStringBuilder.append(wellPopulations[i].toString());
}
String wellPopulationsString = populationsStringBuilder.toString();
//graph generation time
Duration graphTime = data.getTime();
//MWM run time
Duration pairingTime = Duration.between(start, stop);
//total simulation time
Duration time = Duration.between(start, stop);
time = time.plus(data.getTime());
Duration totalTime = graphTime.plus(pairingTime);
Map<String, String> metadata = new LinkedHashMap<>();
metadata.put("sample plate filename", data.getSourceFilename());
metadata.put("graph filename", dataFilename);
metadata.put("algorithm type", algoType);
metadata.put("MWM algorithm type", algoType);
metadata.put("matching weight", totalMatchingWeight.toString());
metadata.put("well populations", wellPopulationsString);
metadata.put("read depth", data.getReadDepth().toString());
metadata.put("Sequence read error rate", data.getReadErrorRate().toString());
metadata.put("Read error collision rate", data.getErrorCollisionRate().toString());
metadata.put("sequence read depth", data.getReadDepth().toString());
metadata.put("sequence read error rate", data.getReadErrorRate().toString());
metadata.put("read error collision rate", data.getErrorCollisionRate().toString());
metadata.put("total alphas read from plate", data.getAlphaCount().toString());
metadata.put("total betas read from plate", data.getBetaCount().toString());
//HARD CODED, PARAMETERIZE LATER
metadata.put("pre-filter sequences present in all wells", "true");
//HARD CODED, PARAMETERIZE LATER
metadata.put("pre-filter sequences based on occupancy/read count discrepancy", "true");
metadata.put("alphas in graph (after pre-filtering)", graphAlphaCount.toString());
metadata.put("betas in graph (after pre-filtering)", graphBetaCount.toString());
@@ -358,9 +364,11 @@ public class Simulator implements GraphModificationFunctions {
metadata.put("correct pairing count", Integer.toString(trueCount));
metadata.put("incorrect pairing count", Integer.toString(falseCount));
metadata.put("pairing error rate", pairingErrorRateTrunc.toString());
metadata.put("simulation time (seconds)", nf.format(time.toSeconds()));
metadata.put("time to generate graph (seconds)", nf.format(graphTime.toSeconds()));
metadata.put("time to pair sequences (seconds)",nf.format(pairingTime.toSeconds()));
metadata.put("total simulation time (seconds)", nf.format(totalTime.toSeconds()));
//create MatchingResult object
MatchingResult output = new MatchingResult(metadata, header, allResults, matchMap, time);
MatchingResult output = new MatchingResult(metadata, header, allResults, matchMap);
if(verbose){
for(String s: output.getComments()){
System.out.println(s);