Merge pull request #1176 from broadinstitute/ts_annotateFilterStatus
This commit is contained in:
commit
7b067c13bd
|
|
@ -259,6 +259,15 @@ public class VariantAnnotatorIntegrationTest extends WalkerTest {
|
||||||
executeTest("using expression with multi-alleles", spec);
|
executeTest("using expression with multi-alleles", spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFilterInExpression(){
|
||||||
|
/* The order of filters in the output seems platform-dependent. May need to change htsjdk to make the order consistent across platforms. [Sato] */
|
||||||
|
WalkerTestSpec spec = new WalkerTestSpec(
|
||||||
|
baseTestString() + " --resource:foo " + privateTestDir + "annotationResourceWithFilter.vcf" + STANDARD_ANNOTATIONS + "--variant " + privateTestDir + "vcfexample3empty-multiAllele.vcf -E foo.FILTER -L " + privateTestDir + "vcfexample3empty-multiAllele.vcf", 1,
|
||||||
|
Arrays.asList("77bc144fd432b8886ab19ed20bfb9396"));
|
||||||
|
executeTest("annotate a vcf with the FILTER field of another vcf", spec);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUsingExpressionWithID() {
|
public void testUsingExpressionWithID() {
|
||||||
WalkerTestSpec spec = new WalkerTestSpec(
|
WalkerTestSpec spec = new WalkerTestSpec(
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,19 @@ import java.util.*;
|
||||||
* -E foo.AF
|
* -E foo.AF
|
||||||
* --resourceAlleleConcordance
|
* --resourceAlleleConcordance
|
||||||
* </pre>
|
* </pre>
|
||||||
|
*
|
||||||
|
* <h4>Annotate with AF and FILTER fields from an external resource </h4>
|
||||||
|
* <pre>
|
||||||
|
* java -jar GenomeAnalysisTK.jar \
|
||||||
|
* -R reference.fasta \
|
||||||
|
* -T VariantAnnotator \
|
||||||
|
* -o output.vcf \
|
||||||
|
* --resource:foo resource.vcf \
|
||||||
|
* --expression foo.AF \
|
||||||
|
* --expression foo.FILTER \
|
||||||
|
* -V input.vcf \
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@DocumentedGATKFeature( groupName = HelpConstants.DOCS_CAT_VARMANIP, extraDocs = {CommandLineGATK.class} )
|
@DocumentedGATKFeature( groupName = HelpConstants.DOCS_CAT_VARMANIP, extraDocs = {CommandLineGATK.class} )
|
||||||
@Requires(value={})
|
@Requires(value={})
|
||||||
|
|
@ -181,6 +194,7 @@ public class VariantAnnotator extends RodWalker<Integer, Integer> implements Ann
|
||||||
* 'resource_file.vcf', you tag it with '-resource:my_resource resource_file.vcf' (see the -resource argument, also
|
* 'resource_file.vcf', you tag it with '-resource:my_resource resource_file.vcf' (see the -resource argument, also
|
||||||
* documented on this page) and you specify '-E my_resource.AC'. In the resulting output VCF, any records for
|
* documented on this page) and you specify '-E my_resource.AC'. In the resulting output VCF, any records for
|
||||||
* which there is a record at the same position in the resource file will be annotated with 'my_resource.AC=N'.
|
* which there is a record at the same position in the resource file will be annotated with 'my_resource.AC=N'.
|
||||||
|
* INFO field data, ID, ALT, and FILTER fields may be used as expression values.
|
||||||
* Note that if there are multiple records in the resource file that overlap the given position, one is chosen
|
* Note that if there are multiple records in the resource file that overlap the given position, one is chosen
|
||||||
* randomly.
|
* randomly.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -304,6 +304,12 @@ public class VariantAnnotatorEngine {
|
||||||
infoAnnotations.put(expression.fullName, expressionVC.getID());
|
infoAnnotations.put(expression.fullName, expressionVC.getID());
|
||||||
} else if (expression.fieldName.equals("ALT")) {
|
} else if (expression.fieldName.equals("ALT")) {
|
||||||
infoAnnotations.put(expression.fullName, expressionVC.getAlternateAllele(0).getDisplayString());
|
infoAnnotations.put(expression.fullName, expressionVC.getAlternateAllele(0).getDisplayString());
|
||||||
|
} else if (expression.fieldName.equals("FILTER")) {
|
||||||
|
if ( expressionVC.isFiltered() ) {
|
||||||
|
infoAnnotations.put(expression.fullName, expressionVC.getFilters().toString().replace("[", "").replace("]", "").replace(" ", ""));
|
||||||
|
} else {
|
||||||
|
infoAnnotations.put(expression.fullName, "PASS");
|
||||||
|
}
|
||||||
} else if ( expressionVC.hasAttribute(expression.fieldName) ) {
|
} else if ( expressionVC.hasAttribute(expression.fieldName) ) {
|
||||||
// find the info field
|
// find the info field
|
||||||
final VCFInfoHeaderLine hInfo = hInfoMap.get(expression.fullName);
|
final VCFInfoHeaderLine hInfo = hInfoMap.get(expression.fullName);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue