Implemented parameter for CDR1 frequency

This commit is contained in:
2021-11-18 11:55:54 -06:00
parent 4157cfb556
commit 2064d7e9fc
4 changed files with 19 additions and 22 deletions

View File

@@ -29,31 +29,14 @@ public class Simulator {
private static boolean useJGraphTGraphMatrixGenerator = true; //fastest option
*/
public static CellSample generateCellSample(Integer numDistinctCells) {
List<Integer> numbers = new ArrayList<>();
IntStream.range(1, (2 * numDistinctCells) + 1).forEach(i -> numbers.add(i));
Collections.shuffle(numbers);
//Each cell represented by two numbers from the random permutation
//These represent unique alpha and beta peptides
List<Integer[]> distinctCells = new ArrayList<>();
for(int i = 0; i < numbers.size() - 1; i = i + 2) {
Integer tmp1 = numbers.get(i);
Integer tmp2 = numbers.get(i+1);
Integer[] tmp = {tmp1, tmp2};
distinctCells.add(tmp);
}
return new CellSample(distinctCells);
}
public static CellSample generateExpandedCellSample(Integer numDistinctCells) {
public static CellSample generateCellSample(Integer numDistinctCells, Integer cdr1Freq) {
//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));
IntStream.range(numDistCDR3s + 1, numDistCDR3s + 1 + (numDistCDR3s / cdr1Freq) + 1).forEach(i -> numbersCDR1.add(i));
Collections.shuffle(numbersCDR3);
Collections.shuffle(numbersCDR1);
@@ -68,7 +51,7 @@ public class Simulator {
Integer[] tmp = {tmpCDR3a, tmpCDR3b, tmpCDR1a, tmpCDR1b};
distinctCells.add(tmp);
}
return new CellSample(distinctCells);
return new CellSample(distinctCells, cdr1Freq);
}
public static MatchingResult matchCDR3s(List<Integer[]> distinctCells,