3 Commits

Author SHA1 Message Date
eugenefischer
3707923398 Merge remote-tracking branch 'origin/master' 2022-09-21 13:16:52 -05:00
eugenefischer
cf771ce574 parameterized sequence indices 2022-09-21 13:15:49 -05:00
1df86f01df parameterized sequence indices 2022-03-05 12:03:31 -06:00
2 changed files with 12 additions and 5 deletions

View File

@@ -357,6 +357,8 @@ roughly as though it had a constant well population equal to the plate's average
* Add controllable algorithm-type parameter?
* This would be fun and valuable, but probably take more time than I have for a hobby project.
* Implement Vose's alias method for arbitrary statistical distributions of cells
* Should probably refactor to use apache commons rng for this
* Use commons JCS for caching
## CITATIONS

View File

@@ -23,6 +23,7 @@ public class Simulator implements GraphModificationFunctions {
private static final int cdr1AlphaIndex = 2;
private static final int cdr1BetaIndex = 3;
//Make the graph needed for matching CDR3s
public static GraphWithMapData makeGraph(CellSample cellSample, Plate samplePlate, boolean verbose) {
Instant start = Instant.now();
@@ -34,7 +35,7 @@ public class Simulator implements GraphModificationFunctions {
if(verbose){System.out.println("Making cell maps");}
//HashMap keyed to Alphas, values Betas
Map<Integer, Integer> distCellsMapAlphaKey = makeSequenceToSequenceMap(distinctCells, 0, 1);
Map<Integer, Integer> distCellsMapAlphaKey = makeSequenceToSequenceMap(distinctCells, cdr3AlphaIndex, cdr3BetaIndex);
if(verbose){System.out.println("Cell maps made");}
if(verbose){System.out.println("Making well maps");}
@@ -46,10 +47,11 @@ public class Simulator implements GraphModificationFunctions {
if(verbose){System.out.println("All betas count: " + betaCount);}
if(verbose){System.out.println("Well maps made");}
if(verbose){System.out.println("Removing singleton sequences and sequences present in all wells.");}
filterByOccupancyThresholds(allAlphas, 2, numWells - 1);
filterByOccupancyThresholds(allBetas, 2, numWells - 1);
if(verbose){System.out.println("Sequences removed");}
// if(verbose){System.out.println("Removing singleton sequences and sequences present in all wells.");}
// filterByOccupancyThresholds(allAlphas, 2, numWells - 1);
// filterByOccupancyThresholds(allBetas, 2, numWells - 1);
// if(verbose){System.out.println("Sequences removed");}
int pairableAlphaCount = allAlphas.size();
if(verbose){System.out.println("Remaining alphas count: " + pairableAlphaCount);}
int pairableBetaCount = allBetas.size();
@@ -238,6 +240,8 @@ public class Simulator implements GraphModificationFunctions {
//Metadata comments for CSV file
String algoType = "LEDA book with heap: " + heapType;
int min = Math.min(alphaCount, betaCount);
//matching weight
BigDecimal totalMatchingWeight = maxWeightMatching.getMatchingWeight();
//rate of attempted matching
double attemptRate = (double) (trueCount + falseCount) / min;
BigDecimal attemptRateTrunc = new BigDecimal(attemptRate, mc);
@@ -268,6 +272,7 @@ public class Simulator implements GraphModificationFunctions {
metadata.put("sample plate filename", data.getSourceFilename());
metadata.put("graph filename", dataFilename);
metadata.put("algorithm type", algoType);
metadata.put("matching weight", totalMatchingWeight.toString());
metadata.put("well populations", wellPopulationsString);
metadata.put("total alphas found", alphaCount.toString());
metadata.put("total betas found", betaCount.toString());