Expanding simulation to attempt CDR3/CDR1 matching - doubles size of cells
This commit is contained in:
@@ -10,7 +10,7 @@ import java.util.List;
|
||||
|
||||
public class CellFileWriter {
|
||||
|
||||
private String[] headers = {"Alpha", "Beta"};
|
||||
private String[] headers = {"Alpha CDR3", "Beta CDR3", "Alpha CDR1", "Beta CDR1"};
|
||||
List<Integer[]> cells;
|
||||
String filename;
|
||||
|
||||
|
||||
@@ -46,7 +46,32 @@ public class Simulator {
|
||||
return new CellSample(distinctCells);
|
||||
}
|
||||
|
||||
public static void matchCells(String filename, List<Integer[]> distinctCells, Plate samplePlate, Integer lowThreshold, Integer highThreshold){
|
||||
public static CellSample generateExpandedCellSample(Integer numDistinctCells) {
|
||||
//In real T cells, CDR1s have about one third the diversity of CDR3s
|
||||
//previous sim was only CDR3s
|
||||
List<Integer> numbersCDR3 = new ArrayList<>();
|
||||
List<Integer> numbersCDR1 = new ArrayList<>();
|
||||
Integer numDistCDR3s = 2 * numDistinctCells + 1;
|
||||
IntStream.range(1, numDistCDR3s + 1).forEach(i -> numbersCDR3.add(i));
|
||||
IntStream.range(numDistCDR3s + 1, numDistCDR3s + 1 + (numDistCDR3s / 3) + 1).forEach(i -> numbersCDR1.add(i));
|
||||
Collections.shuffle(numbersCDR3);
|
||||
Collections.shuffle(numbersCDR1);
|
||||
|
||||
//Each cell represented by 4 values
|
||||
//two CDR3s, and two CDR1s. First two values are CDR3s, second two are CDR1s
|
||||
List<Integer[]> distinctCells = new ArrayList<>();
|
||||
for(int i = 0; i < numbersCDR3.size() - 1; i = i + 2){
|
||||
Integer tmpCDR3a = numbersCDR3.get(i);
|
||||
Integer tmpCDR3b = numbersCDR3.get(i+1);
|
||||
Integer tmpCDR1a = numbersCDR1.get(i % numbersCDR1.size());
|
||||
Integer tmpCDR1b = numbersCDR1.get((i+1) % numbersCDR1.size());
|
||||
Integer[] tmp = {tmpCDR3a, tmpCDR3b, tmpCDR1a, tmpCDR1b};
|
||||
distinctCells.add(tmp);
|
||||
}
|
||||
return new CellSample(distinctCells);
|
||||
}
|
||||
|
||||
public static void matchCDR3s(String filename, List<Integer[]> distinctCells, Plate samplePlate, Integer lowThreshold, Integer highThreshold){
|
||||
System.out.println("Cells: " + distinctCells.size());
|
||||
int numWells = samplePlate.getSize();
|
||||
System.out.println("Making cell maps");
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import java.util.List;
|
||||
import java.util.Scanner;
|
||||
import java.util.ArrayList;
|
||||
import java.util.InputMismatchException;
|
||||
|
||||
//
|
||||
@@ -15,9 +14,10 @@ public class UserInterface {
|
||||
System.out.println("\nALPHA/BETA T-CELL RECEPTOR MATCHING SIMULATOR");
|
||||
System.out.println("Please select an option:");
|
||||
System.out.println("1) Generate a population of distinct cells");
|
||||
System.out.println("2) Generate a sample plate of T-cells");
|
||||
System.out.println("3) Simulate T-Cell matching");
|
||||
System.out.println("4) Acknowledgements");
|
||||
System.out.println("2) Generate a sample plate of T cells");
|
||||
System.out.println("3) Simulate CDR3 alpha/beta T cell matching");
|
||||
System.out.println("4) Simulate CDR3/CDR1 T cell matching");
|
||||
System.out.println("5) Acknowledgements");
|
||||
System.out.println("0) Exit");
|
||||
try {
|
||||
input = sc.nextInt();
|
||||
@@ -25,7 +25,8 @@ public class UserInterface {
|
||||
case 1 -> makeCells();
|
||||
case 2 -> makePlate();
|
||||
case 3 -> matchCells();
|
||||
case 4 -> acknowledge();
|
||||
//case 4 -> //method call here
|
||||
case 5 -> acknowledge();
|
||||
case 0 -> quit = true;
|
||||
default -> throw new InputMismatchException("Invalid input.");
|
||||
}
|
||||
@@ -186,7 +187,7 @@ public class UserInterface {
|
||||
highThreshold = plate.getSize() - 1;
|
||||
}
|
||||
List<Integer[]> cells = cellReader.getCells();
|
||||
Simulator.matchCells(filename, cells, plate, lowThreshold, highThreshold);
|
||||
Simulator.matchCDR3s(filename, cells, plate, lowThreshold, highThreshold);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user