Terrible bugfix

-- The way I was handling the contig offset ordering wasn't correct.  Now the contigs are always indexed in the order in which their corresponding populate() functions are called, so that the order of the contigs is given by the order in which they are in the file, or in our refDict.  It has nothing to do with the contig index itself.
-- SelectVariants no longers prints all samples to the screen if you aren't selecting any explicitly
This commit is contained in:
Mark DePristo 2012-06-01 20:18:16 -04:00
parent d37a8a0bc8
commit 8b0a629a31
3 changed files with 13 additions and 5 deletions

View File

@ -396,7 +396,8 @@ public class SelectVariants extends RodWalker<Integer, Integer> implements TreeR
if ( samples.size() == 0 && !NO_SAMPLES_SPECIFIED )
throw new UserException("All samples requested to be included were also requested to be excluded.");
for ( String sample : samples )
if ( ! NO_SAMPLES_SPECIFIED )
for ( String sample : samples )
logger.info("Including sample '" + sample + "'");
// if user specified types to include, add these, otherwise, add all possible variant context types to list of vc types to include

View File

@ -116,8 +116,14 @@ public class BCF2Codec implements FeatureCodec<VariantContext>, ReferenceDepende
}
// create the config offsets
for ( final VCFContigHeaderLine contig : header.getContigLines())
contigNames.add(contig.getID());
if ( ! header.getContigLines().isEmpty() ) {
logger.info("Found contig lines in BCF2 file, using those");
contigNames.clear();
for ( final VCFContigHeaderLine contig : header.getContigLines())
contigNames.add(contig.getID());
} else {
logger.info("Didn't find any contig lines in BCF2 file, falling back (dangerously) to GATK reference dictionary");
}
// create the string dictionary
dictionary = parseDictionary(header);

View File

@ -64,8 +64,9 @@ class BCF2Writer extends IndexingVariantContextWriter {
// --------------------------------------------------------------------------------
private final void createContigDictionary(final Collection<VCFContigHeaderLine> contigLines) {
for ( final VCFContigHeaderLine contig : contigLines )
contigDictionary.put(contig.getID(), contig.getContigIndex());
int offset = 0;
for ( VCFContigHeaderLine contig : contigLines )
contigDictionary.put(contig.getID(), offset++);
}
@Override