Very minor performance improvements
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2137 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
c90bea39a1
commit
cb6d6f2686
|
|
@ -43,9 +43,9 @@ public class DiploidGenotypeCalculationModel extends JointEstimateGenotypeCalcul
|
||||||
double[] posteriors = GL.getPosteriors();
|
double[] posteriors = GL.getPosteriors();
|
||||||
|
|
||||||
// for each alternate allele, fill the matrix
|
// for each alternate allele, fill the matrix
|
||||||
|
DiploidGenotype refGenotype = DiploidGenotype.createHomGenotype(ref);
|
||||||
for ( char alt : BaseUtils.BASES ) {
|
for ( char alt : BaseUtils.BASES ) {
|
||||||
if ( alt != ref ) {
|
if ( alt != ref ) {
|
||||||
DiploidGenotype refGenotype = DiploidGenotype.createHomGenotype(ref);
|
|
||||||
DiploidGenotype hetGenotype = ref < alt ? DiploidGenotype.valueOf(String.valueOf(ref) + String.valueOf(alt)) : DiploidGenotype.valueOf(String.valueOf(alt) + String.valueOf(ref));
|
DiploidGenotype hetGenotype = ref < alt ? DiploidGenotype.valueOf(String.valueOf(ref) + String.valueOf(alt)) : DiploidGenotype.valueOf(String.valueOf(alt) + String.valueOf(ref));
|
||||||
DiploidGenotype homGenotype = DiploidGenotype.createHomGenotype(alt);
|
DiploidGenotype homGenotype = DiploidGenotype.createHomGenotype(alt);
|
||||||
AFMatrixMap.get(alt).setLikelihoods(posteriors[refGenotype.ordinal()], posteriors[hetGenotype.ordinal()], posteriors[homGenotype.ordinal()], index);
|
AFMatrixMap.get(alt).setLikelihoods(posteriors[refGenotype.ordinal()], posteriors[hetGenotype.ordinal()], posteriors[homGenotype.ordinal()], index);
|
||||||
|
|
|
||||||
|
|
@ -185,13 +185,14 @@ public class UnifiedGenotyper extends LocusWalker<Pair<List<Genotype>, GenotypeL
|
||||||
private AlignmentContext filterAlignmentContext(AlignmentContext context) {
|
private AlignmentContext filterAlignmentContext(AlignmentContext context) {
|
||||||
List<SAMRecord> reads = context.getReads();
|
List<SAMRecord> reads = context.getReads();
|
||||||
List<Integer> offsets = context.getOffsets();
|
List<Integer> offsets = context.getOffsets();
|
||||||
|
int numReads = reads.size();
|
||||||
|
|
||||||
List<SAMRecord> newReads = new ArrayList<SAMRecord>();
|
List<SAMRecord> newReads = new ArrayList<SAMRecord>(numReads);
|
||||||
List<Integer> newOffsets = new ArrayList<Integer>();
|
List<Integer> newOffsets = new ArrayList<Integer>(numReads);
|
||||||
|
|
||||||
for (int i = 0; i < reads.size(); i++) {
|
for (int i = 0; i < numReads; i++) {
|
||||||
SAMRecord read = reads.get(i);
|
SAMRecord read = reads.get(i);
|
||||||
if ( read.getMappingQuality() != 0 ) {
|
if ( read.getMappingQuality() > 0 ) {
|
||||||
newReads.add(read);
|
newReads.add(read);
|
||||||
newOffsets.add(offsets.get(i));
|
newOffsets.add(offsets.get(i));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,11 @@ public enum DiploidGenotype {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHomRef(char r) {
|
public boolean isHomRef(char r) {
|
||||||
return isHom() && r == this.toString().charAt(0);
|
return isHom() && r == base1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHomVar(char r) {
|
public boolean isHomVar(char r) {
|
||||||
return isHom() && r != this.toString().charAt(0);
|
return isHom() && r != base1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isHetRef(char r) {
|
public boolean isHetRef(char r) {
|
||||||
|
|
@ -59,7 +59,7 @@ public enum DiploidGenotype {
|
||||||
* @return the diploid genotype
|
* @return the diploid genotype
|
||||||
*/
|
*/
|
||||||
public static DiploidGenotype createHomGenotype(char hom) {
|
public static DiploidGenotype createHomGenotype(char hom) {
|
||||||
return DiploidGenotype.valueOf((String.valueOf(hom) + String.valueOf(hom)).toUpperCase());
|
return DiploidGenotype.valueOf((String.valueOf(hom) + String.valueOf(hom)).toUpperCase());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue