Change "peptide" references in code to "sequence", adding comments

This commit is contained in:
2022-02-21 00:29:34 -06:00
parent 370de79546
commit cb1f7adece
4 changed files with 39 additions and 33 deletions

View File

@@ -68,7 +68,7 @@ public class Plate {
}
Integer[] cellToAdd = cells.get(n).clone();
for(int k = 0; k < cellToAdd.length; k++){
if(Math.abs(rand.nextDouble()) < error){//error applied to each peptide
if(Math.abs(rand.nextDouble()) < error){//error applied to each seqeunce
cellToAdd[k] = -1;
}
}
@@ -98,7 +98,7 @@ public class Plate {
n = (int) Math.floor(m);
Integer[] cellToAdd = cells.get(n).clone();
for(int k = 0; k < cellToAdd.length; k++){
if(Math.abs(rand.nextDouble()) < error){//error applied to each peptide
if(Math.abs(rand.nextDouble()) < error){//error applied to each sequence
cellToAdd[k] = -1;
}
}
@@ -134,30 +134,30 @@ public class Plate {
return wells;
}
//returns a map of the counts of the peptide at cell index pIndex, in all wells
public Map<Integer, Integer> assayWellsPeptideP(int... pIndices){
return this.assayWellsPeptideP(0, size, pIndices);
//returns a map of the counts of the sequence at cell index sIndex, in all wells
public Map<Integer, Integer> assayWellsSequenceS(int... sIndices){
return this.assayWellsSequenceS(0, size, sIndices);
}
//returns a map of the counts of the peptide at cell index pIndex, in a specific well
public Map<Integer, Integer> assayWellsPeptideP(int n, int... pIndices) { return this.assayWellsPeptideP(n, n+1, pIndices);}
//returns a map of the counts of the sequence at cell index sIndex, in a specific well
public Map<Integer, Integer> assayWellsSequenceS(int n, int... sIndices) { return this.assayWellsSequenceS(n, n+1, sIndices);}
//returns a map of the counts of the peptide at cell index pIndex, in a range of wells
public Map<Integer, Integer> assayWellsPeptideP(int start, int end, int... pIndices) {
//returns a map of the counts of the sequence at cell index sIndex, in a range of wells
public Map<Integer, Integer> assayWellsSequenceS(int start, int end, int... sIndices) {
Map<Integer,Integer> assay = new HashMap<>();
for(int pIndex: pIndices){
for(int pIndex: sIndices){
for(int i = start; i < end; i++){
countPeptides(assay, wells.get(i), pIndex);
countSequences(assay, wells.get(i), pIndex);
}
}
return assay;
}
//For the peptides at cell indices pIndices, counts number of unique peptides in the given well into the given map
private void countPeptides(Map<Integer, Integer> wellMap, List<Integer[]> well, int... pIndices) {
//For the sequences at cell indices sIndices, counts number of unique sequences in the given well into the given map
private void countSequences(Map<Integer, Integer> wellMap, List<Integer[]> well, int... sIndices) {
for(Integer[] cell : well) {
for(int pIndex: pIndices){
if(cell[pIndex] != -1){
wellMap.merge(cell[pIndex], 1, (oldValue, newValue) -> oldValue + newValue);
for(int sIndex: sIndices){
if(cell[sIndex] != -1){
wellMap.merge(cell[sIndex], 1, (oldValue, newValue) -> oldValue + newValue);
}
}
}