Merged bug fix from Stable into Unstable
This commit is contained in:
commit
7a2a65155f
|
|
@ -112,26 +112,29 @@ public class VariantContextAdaptors {
|
|||
alleles.add(refAllele);
|
||||
|
||||
// add all of the alt alleles
|
||||
boolean sawNullAllele = false;
|
||||
for ( String alt : DbSNPHelper.getAlternateAlleleList(dbsnp) ) {
|
||||
if ( ! Allele.acceptableAlleleBases(alt) ) {
|
||||
//System.out.printf("Excluding dbsnp record %s%n", dbsnp);
|
||||
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>();
|
||||
attributes.put(VariantContext.ID_KEY, dbsnp.getRsID());
|
||||
|
||||
boolean vcIsDeletion = DbSNPHelper.isDeletion(dbsnp) || DbSNPHelper.isComplexIndel(dbsnp);
|
||||
if ( vcIsDeletion ) {
|
||||
if ( sawNullAllele ) {
|
||||
int index = dbsnp.getStart() - ref.getWindow().getStart() - 1;
|
||||
if ( index < 0 )
|
||||
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]));
|
||||
}
|
||||
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;
|
||||
} 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
|
||||
WalkerTestSpec spec = new WalkerTestSpec( root + " -L 1" + " -o %s",
|
||||
1, // just one output file
|
||||
Arrays.asList("2532234d2c934a5e14849655dd7b5f4f"));
|
||||
Arrays.asList("045a5b02c86aeb9301dc0b724da0c8f7"));
|
||||
executeTest("testLargeScaleConversion", spec);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue