There are some really 'interesting' (but apparently valid) records in the Mus musculus dbSNP file. Generalized the handling of complex cases in the dbSNP adaptor to handle it all. I just grabbed the actual Mus musculus dbSNP file as a test, ran it whole genome, and confirmed that we finally produce a valid VCF on it. Should be the last commit needed on this adaptor.

This commit is contained in:
Eric Banks 2011-07-28 13:55:58 -04:00
parent 6230315ff2
commit 1afc49a297
2 changed files with 8 additions and 5 deletions

View File

@ -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

View File

@ -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);
}
}