Merge pull request #485 from broadinstitute/eb_more_combine_rc_variants_iterations

Eb more combine rc variants iterations
This commit is contained in:
Eric Banks 2014-02-05 11:32:30 -05:00
commit 8aa8acf81d
5 changed files with 19 additions and 10 deletions

View File

@ -153,9 +153,12 @@ public class CombineReferenceCalculationVariants extends RodWalker<VariantContex
public void initialize() {
// take care of the VCF headers
final Map<String, VCFHeader> vcfRods = GATKVCFUtils.getVCFHeadersFromRods(getToolkit());
final Set<String> samples = SampleUtils.getSampleList(vcfRods, GATKVariantContextUtils.GenotypeMergeType.REQUIRE_UNIQUE);
final Set<VCFHeaderLine> headerLines = VCFUtils.smartMergeHeaders(vcfRods.values(), true);
headerLines.addAll(Arrays.asList(ChromosomeCountConstants.descriptions));
if ( dbsnp != null && dbsnp.dbsnp.isBound() )
VCFStandardHeaderLines.addStandardInfoLines(headerLines, true, VCFConstants.DBSNP_KEY);
final Set<String> samples = SampleUtils.getSampleList(vcfRods, GATKVariantContextUtils.GenotypeMergeType.REQUIRE_UNIQUE);
final VCFHeader vcfHeader = new VCFHeader(headerLines, samples);
vcfWriter.writeHeader(vcfHeader);
@ -204,7 +207,7 @@ public class CombineReferenceCalculationVariants extends RodWalker<VariantContex
result = genotypingEngine.calculateGenotypes(result);
// if it turned monomorphic and we don't want such sites, quit
if ( !INCLUDE_NON_VARIANTS && result.isMonomorphicInSamples() )
if ( result == null || (!INCLUDE_NON_VARIANTS && result.isMonomorphicInSamples()) )
return null;
// re-annotate it

View File

@ -374,7 +374,7 @@ public abstract class ArgumentTypeDescriptor {
FeatureManager.FeatureDescriptor featureDescriptor = manager.getByFiletype(file);
if ( featureDescriptor != null ) {
tribbleType = featureDescriptor.getName();
logger.info("Dynamically determined type of " + file + " to be " + tribbleType);
logger.debug("Dynamically determined type of " + file + " to be " + tribbleType);
}
}

View File

@ -96,7 +96,7 @@ public class IndexDictionaryUtils {
final ValidationExclusion.TYPE validationExclusionType ) {
// if the sequence dictionary is empty (as well as null which means it doesn't have a dictionary), skip validation
if (trackDict == null || trackDict.size() == 0)
logger.info("Track " + trackName + " doesn't have a sequence dictionary built in, skipping dictionary validation");
logger.warn("Track " + trackName + " doesn't have a sequence dictionary built in, skipping dictionary validation");
else {
Set<String> trackSequences = new TreeSet<String>();
for (SAMSequenceRecord dictionaryEntry : trackDict.getSequences())

View File

@ -34,6 +34,7 @@ import org.broad.tribble.TribbleException;
import org.broad.tribble.index.Index;
import org.broad.tribble.index.IndexFactory;
import org.broad.tribble.util.LittleEndianOutputStream;
import org.broad.tribble.util.TabixUtils;
import org.broadinstitute.sting.commandline.Tags;
import org.broadinstitute.sting.gatk.GenomeAnalysisEngine;
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
@ -169,9 +170,11 @@ public class RMDTrackBuilder { // extends PluginManager<FeatureCodec> {
*/
private Pair<AbstractFeatureReader, SAMSequenceDictionary> createTabixIndexedFeatureSource(FeatureManager.FeatureDescriptor descriptor, String name, File inputFile) {
// we might not know the index type, try loading with the default reader constructor
logger.info("Attempting to blindly load " + inputFile + " as a tabix indexed file");
logger.debug("Attempting to load " + inputFile + " as a tabix indexed file without validating it");
try {
return new Pair<AbstractFeatureReader, SAMSequenceDictionary>(AbstractFeatureReader.getFeatureReader(inputFile.getAbsolutePath(), createCodec(descriptor, name)),null);
final File indexFile = new File(inputFile.getAbsoluteFile() + TabixUtils.STANDARD_INDEX_EXTENSION);
final SAMSequenceDictionary dict = TabixUtils.getSequenceDictionary(indexFile);
return new Pair<>(AbstractFeatureReader.getFeatureReader(inputFile.getAbsolutePath(), createCodec(descriptor, name)), dict);
} catch (TribbleException e) {
throw new UserException(e.getMessage(), e);
}
@ -318,7 +321,7 @@ public class RMDTrackBuilder { // extends PluginManager<FeatureCodec> {
* @return an Index, or null if we're unable to load
*/
protected Index loadFromDisk( final File inputFile, final File indexFile ) {
logger.info("Loading Tribble index from disk for file " + inputFile);
logger.debug("Loading Tribble index from disk for file " + inputFile);
Index index = IndexFactory.loadIndex(indexFile.getAbsolutePath());
// check if the file is up-to date (filestamp and version check)
@ -384,7 +387,7 @@ public class RMDTrackBuilder { // extends PluginManager<FeatureCodec> {
*/
protected Index createIndexInMemory(File inputFile, FeatureCodec codec) {
// this can take a while, let them know what we're doing
logger.info("Creating Tribble index in memory for file " + inputFile);
logger.debug("Creating Tribble index in memory for file " + inputFile);
Index idx = IndexFactory.createDynamicIndex(inputFile, codec, IndexFactory.IndexBalanceApproach.FOR_SEEK_TIME);
validateAndUpdateIndexSequenceDictionary(inputFile, idx, dict);
return idx;

View File

@ -1045,8 +1045,9 @@ public class GATKVariantContextUtils {
* @return new VariantContext representing the merge of all VCs or null if it not relevant
*/
public static VariantContext referenceConfidenceMerge(final List<VariantContext> VCs, final GenomeLoc loc, final Byte refBase) {
if ( VCs == null || VCs.size() == 0 ) throw new IllegalArgumentException("VCs cannot be null or empty");
// this can happen if e.g. you are using a dbSNP file that spans a region with no gVCFs
if ( VCs == null || VCs.size() == 0 )
return null;
// establish the baseline info (sometimes from the first VC)
final VariantContext first = VCs.get(0);
@ -1536,6 +1537,8 @@ public class GATKVariantContextUtils {
final List<Allele> remappedAlleles,
final List<Allele> targetAlleles) {
for ( final Genotype g : VC.getGenotypes() ) {
if ( !g.hasPL() )
throw new UserException("cannot merge genotypes from samples without PLs; sample " + g.getSampleName() + " does not have likelihoods at position " + VC.getChr() + ":" + VC.getStart());
// only add if the name is new
final String name = g.getSampleName();