Fixed this tool for chartl so that it now properly handles deletions. Added deletion case to integration tests.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3737 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
47a42b1507
commit
9a81f1d7ef
|
|
@ -27,7 +27,6 @@ package org.broadinstitute.sting.gatk.walkers.sequenom;
|
||||||
|
|
||||||
import net.sf.samtools.util.CloseableIterator;
|
import net.sf.samtools.util.CloseableIterator;
|
||||||
import org.broad.tribble.dbsnp.DbSNPCodec;
|
import org.broad.tribble.dbsnp.DbSNPCodec;
|
||||||
import org.broad.tribble.dbsnp.DbSNPFeature;
|
|
||||||
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
import org.broadinstitute.sting.gatk.contexts.AlignmentContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
import org.broadinstitute.sting.gatk.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContext;
|
import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContext;
|
||||||
|
|
@ -69,6 +68,8 @@ public class PickSequenomProbes extends RodWalker<String, String> {
|
||||||
|
|
||||||
private LocationAwareSeekableRODIterator snpMaskIterator=null;
|
private LocationAwareSeekableRODIterator snpMaskIterator=null;
|
||||||
|
|
||||||
|
private GenomeLoc positionOfLastVariant = null;
|
||||||
|
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
if ( SNP_MASK != null ) {
|
if ( SNP_MASK != null ) {
|
||||||
logger.info("Loading SNP mask... ");
|
logger.info("Loading SNP mask... ");
|
||||||
|
|
@ -104,26 +105,35 @@ public class PickSequenomProbes extends RodWalker<String, String> {
|
||||||
if ( !vc.isBiallelic() )
|
if ( !vc.isBiallelic() )
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
// we don't want to see the same multi-base deletion multiple times
|
||||||
|
if ( positionOfLastVariant != null &&
|
||||||
|
positionOfLastVariant.size() > 1 &&
|
||||||
|
positionOfLastVariant.equals(vc.getLocation()) )
|
||||||
|
return "";
|
||||||
|
positionOfLastVariant = vc.getLocation();
|
||||||
|
|
||||||
String contig = context.getLocation().getContig();
|
String contig = context.getLocation().getContig();
|
||||||
long offset = context.getLocation().getStart();
|
long offset = context.getLocation().getStart();
|
||||||
long true_offset = offset - 200;
|
long true_offset = offset - 200;
|
||||||
|
|
||||||
// we have variant; let's load all the snps falling into the current window and prepare the mask array:
|
// we have variant; let's load all the snps falling into the current window and prepare the mask array:
|
||||||
if ( snpMaskIterator != null ) {
|
if ( snpMaskIterator != null ) {
|
||||||
|
// clear the mask
|
||||||
|
for ( int i = 0 ; i < 401; i++ )
|
||||||
|
maskFlags[i] = 0;
|
||||||
|
|
||||||
RODRecordList snpList = snpMaskIterator.seekForward(GenomeLocParser.createGenomeLoc(contig,offset-200,offset+200));
|
RODRecordList snpList = snpMaskIterator.seekForward(GenomeLocParser.createGenomeLoc(contig,offset-200,offset+200));
|
||||||
if ( snpList != null && snpList.size() != 0 ) {
|
if ( snpList != null && snpList.size() != 0 ) {
|
||||||
Iterator<GATKFeature> snpsInWindow = snpList.iterator();
|
Iterator<GATKFeature> snpsInWindow = snpList.iterator();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while ( snpsInWindow.hasNext() ) {
|
while ( snpsInWindow.hasNext() ) {
|
||||||
GenomeLoc snp = snpsInWindow.next().getLocation();
|
GenomeLoc snp = snpsInWindow.next().getLocation();
|
||||||
|
// we don't really want to mask out multi-base indels
|
||||||
|
if ( snp.size() > 1 )
|
||||||
|
continue;
|
||||||
int offsetInWindow = (int)(snp.getStart() - true_offset);
|
int offsetInWindow = (int)(snp.getStart() - true_offset);
|
||||||
for ( ; i < offsetInWindow; i++ ) maskFlags[i] = 0;
|
maskFlags[offsetInWindow] = 1;
|
||||||
maskFlags[i++] = 1;
|
|
||||||
}
|
}
|
||||||
for ( ; i < 401; i++ ) maskFlags[i] = 0;
|
|
||||||
} else {
|
|
||||||
// we got no snps, don't forget to clear the mask
|
|
||||||
for ( int i = 0 ; i < 401; i++ ) maskFlags[i] = 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -141,9 +151,9 @@ public class PickSequenomProbes extends RodWalker<String, String> {
|
||||||
if ( vc.isSNP() )
|
if ( vc.isSNP() )
|
||||||
assay_sequence = leading_bases + "[" + ref.getBaseAsChar() + "/" + vc.getAlternateAllele(0).toString() + "]" + trailing_bases;
|
assay_sequence = leading_bases + "[" + ref.getBaseAsChar() + "/" + vc.getAlternateAllele(0).toString() + "]" + trailing_bases;
|
||||||
else if ( vc.isInsertion() )
|
else if ( vc.isInsertion() )
|
||||||
assay_sequence = leading_bases + ref.getBaseAsChar() + "[-/" + vc.getAlternateAllele(0).toString() + "]" + trailing_bases;
|
assay_sequence = leading_bases + "[-/" + vc.getAlternateAllele(0).toString() + "]" + trailing_bases;
|
||||||
else if ( vc.isDeletion() )
|
else if ( vc.isDeletion() )
|
||||||
assay_sequence = leading_bases + ref.getBaseAsChar() + "[" + new String(vc.getReference().getBases()) + "/-]" + trailing_bases.substring(vc.getReference().length());
|
assay_sequence = leading_bases + "[" + new String(vc.getReference().getBases()) + "/-]" + trailing_bases.substring(vc.getReference().length()-1);
|
||||||
else
|
else
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ public class PickSequenomProbesIntegrationTest extends WalkerTest {
|
||||||
String testVCF = validationDataLocation + "complexExample.vcf";
|
String testVCF = validationDataLocation + "complexExample.vcf";
|
||||||
String testArgs = "-R "+oneKGLocation+"reference/human_b36_both.fasta -T PickSequenomProbes -L 1:10,000,000-11,000,000 -B input,VCF,"+testVCF+" -o %s";
|
String testArgs = "-R "+oneKGLocation+"reference/human_b36_both.fasta -T PickSequenomProbes -L 1:10,000,000-11,000,000 -B input,VCF,"+testVCF+" -o %s";
|
||||||
WalkerTestSpec spec = new WalkerTestSpec(testArgs, 1,
|
WalkerTestSpec spec = new WalkerTestSpec(testArgs, 1,
|
||||||
Arrays.asList("6b5409cc78960f1be855536ed89ea9dd"));
|
Arrays.asList("368f6f61e7a99b33f74aab2cf055554e"));
|
||||||
executeTest("Test probes", spec);
|
executeTest("Test probes", spec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -21,9 +21,9 @@ public class PickSequenomProbesIntegrationTest extends WalkerTest {
|
||||||
String testArgs = "-snp_mask " + GATKDataLocation + "/dbsnp_130_b36.rod -R "
|
String testArgs = "-snp_mask " + GATKDataLocation + "/dbsnp_130_b36.rod -R "
|
||||||
+ oneKGLocation + "reference/human_b36_both.fasta -omitWindow -nameConvention "
|
+ oneKGLocation + "reference/human_b36_both.fasta -omitWindow -nameConvention "
|
||||||
+ "-project_id 1kgp3_s4_lf -T PickSequenomProbes -L " + validationDataLocation +
|
+ "-project_id 1kgp3_s4_lf -T PickSequenomProbes -L " + validationDataLocation +
|
||||||
"/pickSeqIntegrationTest.interval_list -B input,VCF,"+testVCF+" -o %s";
|
"pickSeqIntegrationTest.interval_list -B input,VCF4,"+testVCF+" -o %s";
|
||||||
WalkerTestSpec spec = new WalkerTestSpec(testArgs, 1,
|
WalkerTestSpec spec = new WalkerTestSpec(testArgs, 1,
|
||||||
Arrays.asList("49bd6f53b93802576ed3dac8af4bcf8a"));
|
Arrays.asList("cb1f57e8bcaec4b599be075b6d5288a1"));
|
||||||
executeTest("Test probes", spec);
|
executeTest("Test probes", spec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue