-minimalVCF for CombineVariants. Work around for broken locking code.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3960 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
669d9096e3
commit
f275041b1c
|
|
@ -143,39 +143,39 @@ public class ReferenceDataSource implements ReferenceDataSourceProgressListener
|
|||
* but is incomplete). To avoid this, obtain shared locks on both files before creating IndexedFastaSequenceFile.
|
||||
*/
|
||||
|
||||
FSLockWithShared dictLock = new FSLockWithShared(dictFile,true);
|
||||
FSLockWithShared indexLock = new FSLockWithShared(indexFile,true);
|
||||
try {
|
||||
try {
|
||||
if (!dictLock.sharedLock()) {
|
||||
throw new StingException("Could not open dictionary file because a lock could not be obtained.");
|
||||
}
|
||||
}
|
||||
catch(FileSystemInabilityToLockException ex) {
|
||||
logger.info(String.format("Unable to create a lock on dictionary file: %s",ex.getMessage()));
|
||||
logger.info("Treating existing dictionary file as complete.");
|
||||
}
|
||||
// FSLockWithShared dictLock = new FSLockWithShared(dictFile,true);
|
||||
// FSLockWithShared indexLock = new FSLockWithShared(indexFile,true);
|
||||
// try {
|
||||
// try {
|
||||
// if (!dictLock.sharedLock()) {
|
||||
// throw new StingException("Could not open dictionary file because a lock could not be obtained.");
|
||||
// }
|
||||
// }
|
||||
// catch(FileSystemInabilityToLockException ex) {
|
||||
// logger.info(String.format("Unable to create a lock on dictionary file: %s",ex.getMessage()));
|
||||
// logger.info("Treating existing dictionary file as complete.");
|
||||
// }
|
||||
//
|
||||
// try {
|
||||
// if (!indexLock.sharedLock()) {
|
||||
// throw new StingException("Could not open index file because a lock could not be obtained.");
|
||||
// }
|
||||
// }
|
||||
// catch(FileSystemInabilityToLockException ex) {
|
||||
// logger.info(String.format("Unable to create a lock on index file: %s",ex.getMessage()));
|
||||
// logger.info("Treating existing index file as complete.");
|
||||
// }
|
||||
|
||||
try {
|
||||
if (!indexLock.sharedLock()) {
|
||||
throw new StingException("Could not open index file because a lock could not be obtained.");
|
||||
}
|
||||
}
|
||||
catch(FileSystemInabilityToLockException ex) {
|
||||
logger.info(String.format("Unable to create a lock on index file: %s",ex.getMessage()));
|
||||
logger.info("Treating existing index file as complete.");
|
||||
}
|
||||
|
||||
index = new IndexedFastaSequenceFile(fastaFile);
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new StingException(String.format("Error reading fasta file %s.", fastaFile.getAbsolutePath()), e);
|
||||
}
|
||||
finally {
|
||||
dictLock.unlock();
|
||||
indexLock.unlock();
|
||||
}
|
||||
index = new IndexedFastaSequenceFile(fastaFile);
|
||||
//
|
||||
// }
|
||||
// catch (Exception e) {
|
||||
// throw new StingException(String.format("Error reading fasta file %s.", fastaFile.getAbsolutePath()), e);
|
||||
// }
|
||||
// finally {
|
||||
// dictLock.unlock();
|
||||
// indexLock.unlock();
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -68,6 +68,9 @@ public class CombineVariants extends RodWalker<Integer, Integer> {
|
|||
@Argument(fullName="filteredAreUncalled", shortName="filteredAreUncalled", doc="If true, then filtered VCFs are treated as uncalled, so that filtered set annotation don't appear in the combined VCF", required=false)
|
||||
public boolean filteredAreUncalled = false;
|
||||
|
||||
@Argument(fullName="minimalVCF", shortName="minimalVCF", doc="If true, then the output VCF will contain no INFO or genotype INFO field", required=false)
|
||||
public boolean minimalVCF = false;
|
||||
|
||||
@Argument(fullName="setKey", shortName="setKey", doc="Key, by default set, in the INFO key=value tag emitted describing which set the combined VCF record came from. Set to null if you don't want the set field emitted.", required=false)
|
||||
public String SET_KEY = "set";
|
||||
|
||||
|
|
@ -130,6 +133,8 @@ public class CombineVariants extends RodWalker<Integer, Integer> {
|
|||
|
||||
if ( mergedVC != null ) { // only operate at the start of events
|
||||
VariantContext annotatedMergedVC = engine.annotateContext(tracker, ref, mergedVC);
|
||||
if ( minimalVCF )
|
||||
annotatedMergedVC = VariantContextUtils.pruneVariantContext(annotatedMergedVC, new HashSet(Arrays.asList(SET_KEY)));
|
||||
vcfWriter.add(annotatedMergedVC, ref.getBase());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ public class CombineVariantsIntegrationTest extends WalkerTest {
|
|||
executeTest("testInOut1--" + file, spec);
|
||||
}
|
||||
|
||||
public void combine2(String file1, String file2, String md5) {
|
||||
public void combine2(String file1, String file2, String args, String md5) {
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
baseTestString(" -priority v1,v2 -B v1,VCF," + validationDataLocation + file1 + " -B v2,VCF," + validationDataLocation + file2),
|
||||
baseTestString(" -priority v1,v2 -B v1,VCF," + validationDataLocation + file1 + " -B v2,VCF," + validationDataLocation + file2 + args),
|
||||
1,
|
||||
Arrays.asList(md5));
|
||||
executeTest("combine2 1:" + new File(file1).getName() + " 2:" + new File(file2).getName(), spec);
|
||||
|
|
@ -68,12 +68,13 @@ public class CombineVariantsIntegrationTest extends WalkerTest {
|
|||
@Test public void test1Indel1() { test1InOut("CEU.dindel.vcf4.trio.2010_06.indel.genotypes.vcf", "4c667935099544a1863e70ae88ddd685"); }
|
||||
@Test public void test1Indel2() { test1InOut("CEU.dindel.vcf4.low_coverage.2010_06.indel.genotypes.vcf", "17c8468b1b963c9abc49dff17fd811ba"); }
|
||||
|
||||
@Test public void combineTrioCalls() { combine2("CEU.trio.2010_03.genotypes.vcf.gz", "YRI.trio.2010_03.genotypes.vcf.gz", "f3fce9ae729548e7e7c378a8282df235"); } // official project VCF files in tabix format
|
||||
@Test public void combine2Indels() { combine2("CEU.dindel.vcf4.trio.2010_06.indel.genotypes.vcf", "CEU.dindel.vcf4.low_coverage.2010_06.indel.genotypes.vcf", "7fce3e9539ce4eb0a839d9236c928dfc"); }
|
||||
@Test public void combineTrioCalls() { combine2("CEU.trio.2010_03.genotypes.vcf.gz", "YRI.trio.2010_03.genotypes.vcf.gz", "", "f3fce9ae729548e7e7c378a8282df235"); } // official project VCF files in tabix format
|
||||
@Test public void combineTrioCallsMin() { combine2("CEU.trio.2010_03.genotypes.vcf.gz", "YRI.trio.2010_03.genotypes.vcf.gz", " -minimalVCF", "7ad58764b855ec7ad61075dda63567b3"); } // official project VCF files in tabix format
|
||||
@Test public void combine2Indels() { combine2("CEU.dindel.vcf4.trio.2010_06.indel.genotypes.vcf", "CEU.dindel.vcf4.low_coverage.2010_06.indel.genotypes.vcf", "", "7fce3e9539ce4eb0a839d9236c928dfc"); }
|
||||
|
||||
@Test public void combineSNPsAndIndels() { combine2("CEU.trio.2010_03.genotypes.vcf.gz", "CEU.dindel.vcf4.low_coverage.2010_06.indel.genotypes.vcf", "528cff763b95b82717008d2c05e8c393"); }
|
||||
@Test public void combineSNPsAndIndels() { combine2("CEU.trio.2010_03.genotypes.vcf.gz", "CEU.dindel.vcf4.low_coverage.2010_06.indel.genotypes.vcf", "", "528cff763b95b82717008d2c05e8c393"); }
|
||||
|
||||
@Test public void uniqueSNPs() { combine2("pilot2.snps.vcf4.genotypes.vcf", "yri.trio.gatk_glftrio.intersection.annotated.filtered.chr1.vcf", "a9126d1cbe1fdf741236763fb3e3461f"); }
|
||||
@Test public void uniqueSNPs() { combine2("pilot2.snps.vcf4.genotypes.vcf", "yri.trio.gatk_glftrio.intersection.annotated.filtered.chr1.vcf", "", "a9126d1cbe1fdf741236763fb3e3461f"); }
|
||||
|
||||
@Test public void threeWayWithRefs() {
|
||||
WalkerTestSpec spec = new WalkerTestSpec(
|
||||
|
|
|
|||
Loading…
Reference in New Issue