Merged bug fix from Stable into Unstable
This commit is contained in:
commit
7a2a65155f
|
|
@ -112,26 +112,29 @@ public class VariantContextAdaptors {
|
||||||
alleles.add(refAllele);
|
alleles.add(refAllele);
|
||||||
|
|
||||||
// add all of the alt alleles
|
// add all of the alt alleles
|
||||||
|
boolean sawNullAllele = false;
|
||||||
for ( String alt : DbSNPHelper.getAlternateAlleleList(dbsnp) ) {
|
for ( String alt : DbSNPHelper.getAlternateAlleleList(dbsnp) ) {
|
||||||
if ( ! Allele.acceptableAlleleBases(alt) ) {
|
if ( ! Allele.acceptableAlleleBases(alt) ) {
|
||||||
//System.out.printf("Excluding dbsnp record %s%n", dbsnp);
|
//System.out.printf("Excluding dbsnp record %s%n", dbsnp);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
alleles.add(Allele.create(alt, false));
|
Allele altAllele = Allele.create(alt, false);
|
||||||
|
alleles.add(altAllele);
|
||||||
|
if ( altAllele.isNull() )
|
||||||
|
sawNullAllele = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> attributes = new HashMap<String, Object>();
|
Map<String, Object> attributes = new HashMap<String, Object>();
|
||||||
attributes.put(VariantContext.ID_KEY, dbsnp.getRsID());
|
attributes.put(VariantContext.ID_KEY, dbsnp.getRsID());
|
||||||
|
|
||||||
boolean vcIsDeletion = DbSNPHelper.isDeletion(dbsnp) || DbSNPHelper.isComplexIndel(dbsnp);
|
if ( sawNullAllele ) {
|
||||||
if ( vcIsDeletion ) {
|
|
||||||
int index = dbsnp.getStart() - ref.getWindow().getStart() - 1;
|
int index = dbsnp.getStart() - ref.getWindow().getStart() - 1;
|
||||||
if ( index < 0 )
|
if ( index < 0 )
|
||||||
return null; // we weren't given enough reference context to create the VariantContext
|
return null; // we weren't given enough reference context to create the VariantContext
|
||||||
attributes.put(VariantContext.REFERENCE_BASE_FOR_INDEL_KEY, new Byte(ref.getBases()[index]));
|
attributes.put(VariantContext.REFERENCE_BASE_FOR_INDEL_KEY, new Byte(ref.getBases()[index]));
|
||||||
}
|
}
|
||||||
Collection<Genotype> genotypes = null;
|
Collection<Genotype> genotypes = null;
|
||||||
VariantContext vc = new VariantContext(name, dbsnp.getChr(), dbsnp.getStart() - (vcIsDeletion ? 1 : 0),dbsnp.getEnd(), alleles, genotypes, VariantContext.NO_NEG_LOG_10PERROR, null, attributes);
|
VariantContext vc = new VariantContext(name, dbsnp.getChr(), dbsnp.getStart() - (sawNullAllele ? 1 : 0),dbsnp.getEnd(), alleles, genotypes, VariantContext.NO_NEG_LOG_10PERROR, null, attributes);
|
||||||
return vc;
|
return vc;
|
||||||
} else
|
} else
|
||||||
return null; // can't handle anything else
|
return null; // can't handle anything else
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ public class VariantContextIntegrationTest extends WalkerTest {
|
||||||
// this really just tests that we are seeing the same number of objects over all of chr1
|
// this really just tests that we are seeing the same number of objects over all of chr1
|
||||||
WalkerTestSpec spec = new WalkerTestSpec( root + " -L 1" + " -o %s",
|
WalkerTestSpec spec = new WalkerTestSpec( root + " -L 1" + " -o %s",
|
||||||
1, // just one output file
|
1, // just one output file
|
||||||
Arrays.asList("2532234d2c934a5e14849655dd7b5f4f"));
|
Arrays.asList("045a5b02c86aeb9301dc0b724da0c8f7"));
|
||||||
executeTest("testLargeScaleConversion", spec);
|
executeTest("testLargeScaleConversion", spec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue