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:
ebanks 2009-11-24 05:21:07 +00:00
parent c90bea39a1
commit cb6d6f2686
3 changed files with 9 additions and 8 deletions

View File

@ -43,9 +43,9 @@ public class DiploidGenotypeCalculationModel extends JointEstimateGenotypeCalcul
double[] posteriors = GL.getPosteriors();
// for each alternate allele, fill the matrix
DiploidGenotype refGenotype = DiploidGenotype.createHomGenotype(ref);
for ( char alt : BaseUtils.BASES ) {
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 homGenotype = DiploidGenotype.createHomGenotype(alt);
AFMatrixMap.get(alt).setLikelihoods(posteriors[refGenotype.ordinal()], posteriors[hetGenotype.ordinal()], posteriors[homGenotype.ordinal()], index);

View File

@ -185,13 +185,14 @@ public class UnifiedGenotyper extends LocusWalker<Pair<List<Genotype>, GenotypeL
private AlignmentContext filterAlignmentContext(AlignmentContext context) {
List<SAMRecord> reads = context.getReads();
List<Integer> offsets = context.getOffsets();
int numReads = reads.size();
List<SAMRecord> newReads = new ArrayList<SAMRecord>();
List<Integer> newOffsets = new ArrayList<Integer>();
List<SAMRecord> newReads = new ArrayList<SAMRecord>(numReads);
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);
if ( read.getMappingQuality() != 0 ) {
if ( read.getMappingQuality() > 0 ) {
newReads.add(read);
newOffsets.add(offsets.get(i));
}

View File

@ -28,11 +28,11 @@ public enum DiploidGenotype {
}
public boolean isHomRef(char r) {
return isHom() && r == this.toString().charAt(0);
return isHom() && r == base1;
}
public boolean isHomVar(char r) {
return isHom() && r != this.toString().charAt(0);
return isHom() && r != base1;
}
public boolean isHetRef(char r) {
@ -59,7 +59,7 @@ public enum DiploidGenotype {
* @return the diploid genotype
*/
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());
}
/**