Added support for breakpoint alleles

-- See https://getsatisfaction.com/gsa/topics/support_vcf_4_1_structural_variation_breakend_alleles?utm_content=topic_link&utm_medium=email&utm_source=new_topic
-- Added integrationtest to ensure that we can parse and write out breakpoint example
This commit is contained in:
Mark DePristo 2012-02-23 12:14:48 -05:00
parent 522ace6d57
commit e0c189909f
4 changed files with 33 additions and 4 deletions

View File

@ -544,12 +544,15 @@ public abstract class AbstractVCFCodec implements FeatureCodec, NameAwareCodec {
}
/**
* return true if this is a symbolic allele (e.g. <SOMETAG>) otherwise false
* return true if this is a symbolic allele (e.g. <SOMETAG>) or
* structural variation breakend (with [ or ]), otherwise false
* @param allele the allele to check
* @return true if the allele is a symbolic allele, otherwise false
*/
private static boolean isSymbolicAllele(String allele) {
return (allele != null && allele.startsWith("<") && allele.endsWith(">") && allele.length() > 2);
return (allele != null && allele.length() > 2 &&
((allele.startsWith("<") && allele.endsWith(">")) ||
(allele.contains("[") || allele.contains("]"))));
}
/**

View File

@ -212,7 +212,13 @@ public class Allele implements Comparable<Allele> {
* @return true if the bases represent a symbolic allele
*/
public static boolean wouldBeSymbolicAllele(byte[] bases) {
return bases.length > 2 && bases[0] == '<' && bases[bases.length-1] == '>';
if ( bases.length <= 2 )
return false;
else {
final String strBases = new String(bases);
return (bases[0] == '<' && bases[bases.length-1] == '>') ||
(strBases.contains("[") || strBases.contains("]"));
}
}
/**

View File

@ -9,7 +9,7 @@ import java.util.List;
public class VCFIntegrationTest extends WalkerTest {
@Test
@Test(enabled = false)
public void testReadingAndWritingWitHNoChanges() {
String md5ofInputVCF = "a990ba187a69ca44cb9bc2bb44d00447";
@ -25,4 +25,18 @@ public class VCFIntegrationTest extends WalkerTest {
WalkerTestSpec spec2 = new WalkerTestSpec(test2, 1, Arrays.asList(md5ofInputVCF));
executeTest("Test Variants To VCF from new output", spec2);
}
@Test
// See https://getsatisfaction.com/gsa/topics/support_vcf_4_1_structural_variation_breakend_alleles?utm_content=topic_link&utm_medium=email&utm_source=new_topic
public void testReadingAndWritingBreakpointAlleles() {
String testVCF = testDir + "breakpoint-example.vcf";
//String testVCF = validationDataLocation + "multiallelic.vcf";
String baseCommand = "-R " + b37KGReference + " -NO_HEADER -o %s ";
String test1 = baseCommand + "-T SelectVariants -V " + testVCF;
WalkerTestSpec spec1 = new WalkerTestSpec(test1, 1, Arrays.asList(""));
executeTest("Test reading and writing breakpoint VCF", spec1);
}
}

View File

@ -0,0 +1,6 @@
##fileformat=VCFv4.1
#CHROM POS ID REF ALT QUAL FILTER INFO
22 50 bnd_W G G]22:6000] 6 PASS SVTYPE=BND;MATEID=bnd_Y
22 51 bnd_V T ]22:55]T 6 PASS SVTYPE=BND;MATEID=bnd_U
22 55 bnd_U C C[22:51[ 6 PASS SVTYPE=BND;MATEID=bnd_V
22 6000 bnd_Y A A]22:50] 6 PASS SVTYPE=BND;MATEID=bnd_W