Skip to content

Commit

Permalink
Update VariantConcordanceScore to exclude the input VCF from driving …
Browse files Browse the repository at this point in the history
…variants (#361)

* Update VariantConcordanceScore to exclude the input VCF from driving variants
* Remove warning
  • Loading branch information
bbimber authored Feb 16, 2025
1 parent e428c1d commit f9562f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ private Object getReorderedAttributes(final Object attribute, final int[] oldToN
if (attribute.getClass().isArray()) {
tokens = (Object[]) attribute;
} else if (List.class.isAssignableFrom(attribute.getClass())) {
tokens = ((List) attribute).toArray();
tokens = ((List<?>) attribute).toArray();
} else {
tokens = attribute.toString().split(VCFConstants.INFO_FIELD_ARRAY_SEPARATOR);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@
import org.broadinstitute.barclay.help.DocumentedFeature;
import org.broadinstitute.hellbender.cmdline.StandardArgumentDefinitions;
import org.broadinstitute.hellbender.cmdline.argumentcollections.MultiVariantInputArgumentCollection;
import org.broadinstitute.hellbender.engine.FeatureInput;
import org.broadinstitute.hellbender.engine.GATKPath;
import org.broadinstitute.hellbender.engine.ReadsContext;
import org.broadinstitute.hellbender.engine.ReferenceContext;
import org.broadinstitute.hellbender.engine.*;
import org.broadinstitute.hellbender.exceptions.GATKException;
import org.broadinstitute.hellbender.utils.SimpleInterval;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -130,8 +128,10 @@ else if (!grouped.get(feat).isEmpty()) {
return;
}

List<VariantContext> sampleVariants = grouped.get(getVariantConcordanceScoreArgumentCollection().inputVariants);
sampleVariants = sampleVariants.stream().filter(vc -> !vc.isFiltered()).collect(Collectors.toList());
// NOTE: the input VCF is excluded from drivingVariants since the reference VCFs tend to have far fewer sites
List<VariantContext> sampleVariants = features.getFeatures(getVariantConcordanceScoreArgumentCollection().inputVariants, new SimpleInterval(referenceContext.getContig(), referenceContext.getStart(), referenceContext.getStart())).stream().
filter(vc -> !vc.isFiltered() & vc.getStart() == referenceContext.getStart()).toList();

if (sampleVariants.isEmpty()) {
return;
}
Expand Down Expand Up @@ -265,11 +265,8 @@ private static final class VariantConcordanceScoreArgumentCollection extends Mul

@Override
public List<GATKPath> getDrivingVariantPaths() {
List<GATKPath> ret = new ArrayList<>();
ret.add(inputVariants);
ret.addAll(referenceFiles);

return ret;
// NOTE: the input VCF is excluded from drivingVariants since the reference VCFs tend to have far fewer sites
return new ArrayList<>(referenceFiles);
}
}
}

0 comments on commit f9562f5

Please sign in to comment.