Update Picard / sam-jdk at Tim's request.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@4925 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2011-01-03 02:17:25 +00:00
parent d31c658c2e
commit 8d2c14b29c
22 changed files with 114 additions and 28 deletions

View File

@ -39,6 +39,7 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker;
import org.broadinstitute.sting.gatk.refdata.utils.helpers.DbSNPHelper;
import org.broadinstitute.sting.gatk.walkers.annotator.VariantAnnotatorEngine;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.utils.sam.AlignmentUtils;
import org.broadinstitute.sting.utils.*;
import org.broadinstitute.sting.utils.fasta.CachingIndexedFastaSequenceFile;
@ -47,6 +48,7 @@ import org.broadinstitute.sting.utils.sam.GATKSAMRecordFilter;
import org.broadinstitute.sting.utils.sam.GATKSAMRecord;
import org.broad.tribble.vcf.VCFConstants;
import java.io.FileNotFoundException;
import java.io.PrintStream;
import java.util.*;
@ -133,7 +135,12 @@ public class UnifiedGenotyperEngine {
filter.add(LOW_QUAL_FILTER_NAME);
referenceReader = new CachingIndexedFastaSequenceFile(toolkit.getArguments().referenceFile);
try {
referenceReader = new CachingIndexedFastaSequenceFile(toolkit.getArguments().referenceFile);
}
catch(FileNotFoundException ex) {
throw new UserException.CouldNotReadInputFile(toolkit.getArguments().referenceFile,ex);
}
}
/**

View File

@ -58,6 +58,7 @@ import org.broadinstitute.sting.utils.sam.ReadUtils;
import org.broadinstitute.sting.utils.collections.Pair;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.util.*;
@ -217,8 +218,13 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
if ( MISMATCH_THRESHOLD <= 0.0 || MISMATCH_THRESHOLD > 1.0 )
throw new RuntimeException("Entropy threshold must be a fraction between 0 and 1");
referenceReader = new CachingIndexedFastaSequenceFile(getToolkit().getArguments().referenceFile);
try {
referenceReader = new CachingIndexedFastaSequenceFile(getToolkit().getArguments().referenceFile);
}
catch(FileNotFoundException ex) {
throw new UserException.CouldNotReadInputFile(getToolkit().getArguments().referenceFile,ex);
}
if ( !TARGET_NOT_SORTED ) {
NwayIntervalMergingIterator merger = new NwayIntervalMergingIterator(IntervalMergingRule.OVERLAPPING_ONLY);

View File

@ -35,10 +35,12 @@ import org.broad.tribble.vcf.VCFWriter;
import org.broadinstitute.sting.gatk.contexts.variantcontext.VariantContextUtils;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.MathUtils;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.utils.fasta.CachingIndexedFastaSequenceFile;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.*;
// Streams in VariantContext objects and streams out VariantContexts produced by merging phased segregating polymorphisms into MNP VariantContexts
@ -73,7 +75,12 @@ public class MergeSegregatingAlternateAllelesVCFWriter implements VCFWriter {
public MergeSegregatingAlternateAllelesVCFWriter(VCFWriter innerWriter, GenomeLocParser genomeLocParser, File referenceFile, VariantContextMergeRule vcMergeRule, VariantContextUtils.AlleleMergeRule alleleMergeRule, String singleSample, boolean emitOnlyMergedRecords, Logger logger, boolean takeOwnershipOfInner, boolean trackAltAlleleStats) {
this.innerWriter = innerWriter;
this.genomeLocParser = genomeLocParser;
this.referenceFileForMNPmerging = new CachingIndexedFastaSequenceFile(referenceFile);
try {
this.referenceFileForMNPmerging = new CachingIndexedFastaSequenceFile(referenceFile);
}
catch(FileNotFoundException ex) {
throw new UserException.CouldNotReadInputFile(referenceFile,ex);
}
this.vcMergeRule = vcMergeRule;
this.alleleMergeRule = alleleMergeRule;
this.useSingleSample = singleSample;

View File

@ -116,7 +116,7 @@ public class RemapAlignments extends CommandLineProgram {
SAMFileHeader h = new SAMFileHeader();
for ( Entry<String, Object> attr : oldHeader.getAttributes() ) h.setAttribute(attr.getKey(), attr.getValue());
for ( Entry<String, String> attr : oldHeader.getAttributes() ) h.setAttribute(attr.getKey(), attr.getValue());
h.setGroupOrder(oldHeader.getGroupOrder());
h.setProgramRecords(oldHeader.getProgramRecords());
h.setReadGroups(oldHeader.getReadGroups());

View File

@ -29,6 +29,7 @@ import net.sf.picard.reference.*;
import net.sf.samtools.SAMSequenceRecord;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Arrays;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
@ -111,11 +112,11 @@ public class CachingIndexedFastaSequenceFile extends IndexedFastaSequenceFile {
* Open the given indexed fasta sequence file. Throw an exception if the file cannot be opened.
* @param file The file to open.
*/
public CachingIndexedFastaSequenceFile(final File file) {
public CachingIndexedFastaSequenceFile(final File file) throws FileNotFoundException {
this(file, DEFAULT_CACHE_SIZE);
}
public CachingIndexedFastaSequenceFile(final File file, long cacheSize ) {
public CachingIndexedFastaSequenceFile(final File file, long cacheSize ) throws FileNotFoundException {
super(file);
setCacheSize(cacheSize);
}

View File

@ -50,7 +50,7 @@ public class ReadUtils {
copy.setReadGroups(toCopy.getReadGroups());
copy.setSequenceDictionary(toCopy.getSequenceDictionary());
for (Map.Entry<String, Object> e : toCopy.getAttributes())
for (Map.Entry<String, String> e : toCopy.getAttributes())
copy.setAttribute(e.getKey(), e.getValue());
return copy;

View File

@ -30,6 +30,7 @@ import org.broad.tribble.Tribble;
import org.broad.tribble.index.Index;
import org.broad.tribble.vcf.VCFCodec;
import org.broadinstitute.sting.gatk.arguments.ValidationExclusion;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.GenomeLocParser;
@ -59,7 +60,13 @@ public class RMDTrackBuilderUnitTest extends BaseTest {
@BeforeMethod
public void setup() {
seq = new CachingIndexedFastaSequenceFile(new File(b36KGReference));
File referenceFile = new File(b36KGReference);
try {
seq = new CachingIndexedFastaSequenceFile(referenceFile);
}
catch(FileNotFoundException ex) {
throw new UserException.CouldNotReadInputFile(referenceFile,ex);
}
genomeLocParser = new GenomeLocParser(seq);
builder = new RMDTrackBuilder(seq.getSequenceDictionary(),genomeLocParser,null);
}

View File

@ -15,6 +15,7 @@ import org.broadinstitute.sting.gatk.datasources.simpleDataSources.SAMReaderID;
import org.broadinstitute.sting.gatk.walkers.qc.CountReadsWalker;
import org.broadinstitute.sting.gatk.walkers.Walker;
import org.broadinstitute.sting.utils.GenomeLocParser;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.broadinstitute.sting.utils.fasta.CachingIndexedFastaSequenceFile;
import static org.testng.Assert.fail;
@ -74,7 +75,12 @@ public class TraverseReadsUnitTest extends BaseTest {
@BeforeClass
public void doOnce() {
ref = new CachingIndexedFastaSequenceFile(refFile);
try {
ref = new CachingIndexedFastaSequenceFile(refFile);
}
catch(FileNotFoundException ex) {
throw new UserException.CouldNotReadInputFile(refFile,ex);
}
genomeLocParser = new GenomeLocParser(ref);
engine = new GenomeAnalysisEngine();

View File

@ -5,6 +5,7 @@ package org.broadinstitute.sting.utils.baq;
// the imports for unit testing.
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.testng.annotations.DataProvider;
@ -17,6 +18,7 @@ import org.broadinstitute.sting.utils.sam.ArtificialSAMUtils;
import org.broadinstitute.sting.utils.Utils;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
@ -38,7 +40,13 @@ public class BAQUnitTest extends BaseTest {
@BeforeMethod
public void before() {
header = ArtificialSAMUtils.createArtificialSamHeader(numChr, startChr, chrSize);
fasta = new IndexedFastaSequenceFile(new File(hg18Reference));
File referenceFile = new File(hg18Reference);
try {
fasta = new IndexedFastaSequenceFile(referenceFile);
}
catch(FileNotFoundException ex) {
throw new UserException.CouldNotReadInputFile(referenceFile,ex);
}
}
private class BAQTest {

View File

@ -1,5 +1,6 @@
package org.broadinstitute.sting.utils.bed;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.GenomeLocParser;
@ -10,6 +11,7 @@ import org.testng.annotations.Test;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.List;
import net.sf.picard.reference.IndexedFastaSequenceFile;
@ -23,7 +25,14 @@ public class BedParserUnitTest extends BaseTest {
@BeforeClass
public void beforeTests() {
seq = new CachingIndexedFastaSequenceFile(new File(b36KGReference));
File referenceFile = new File(b36KGReference);
try {
seq = new CachingIndexedFastaSequenceFile(referenceFile);
}
catch(FileNotFoundException ex) {
throw new UserException.CouldNotReadInputFile(referenceFile,ex);
}
genomeLocParser = new GenomeLocParser(seq);
}

View File

@ -5,6 +5,7 @@ package org.broadinstitute.sting.utils.fasta;
// the imports for unit testing.
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.testng.annotations.DataProvider;
@ -13,6 +14,7 @@ import org.testng.annotations.BeforeMethod;
import org.broadinstitute.sting.BaseTest;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
@ -53,8 +55,14 @@ public class CachingIndexedFastaSequenceFileUnitTest extends BaseTest {
@Test(dataProvider = "fastas", enabled = true)
public void testCachingIndexedFastaReaderSequential1(File fasta, int cacheSize, int querySize) {
IndexedFastaSequenceFile caching = cacheSize == -1 ? new CachingIndexedFastaSequenceFile(fasta) : new CachingIndexedFastaSequenceFile(fasta, cacheSize);
IndexedFastaSequenceFile uncached = new IndexedFastaSequenceFile(fasta);
IndexedFastaSequenceFile caching, uncached;
try {
caching = cacheSize == -1 ? new CachingIndexedFastaSequenceFile(fasta) : new CachingIndexedFastaSequenceFile(fasta, cacheSize);
uncached = new IndexedFastaSequenceFile(fasta);
}
catch(FileNotFoundException ex) {
throw new UserException.CouldNotReadInputFile(fasta,ex);
}
SAMSequenceRecord contig = uncached.getSequenceDictionary().getSequence(0);
logger.warn(String.format("Checking contig %s length %d with cache size %d and query size %d",
@ -76,8 +84,14 @@ public class CachingIndexedFastaSequenceFileUnitTest extends BaseTest {
// Tests grabbing sequences around a middle cached value.
@Test(dataProvider = "fastas", enabled = true)
public void testCachingIndexedFastaReaderTwoStage(File fasta, int cacheSize, int querySize) {
IndexedFastaSequenceFile uncached = new IndexedFastaSequenceFile(fasta);
IndexedFastaSequenceFile caching = new CachingIndexedFastaSequenceFile(fasta, cacheSize);
IndexedFastaSequenceFile caching, uncached;
try {
uncached = new IndexedFastaSequenceFile(fasta);
caching = new CachingIndexedFastaSequenceFile(fasta, cacheSize);
}
catch(FileNotFoundException ex) {
throw new UserException.CouldNotReadInputFile(fasta,ex);
}
SAMSequenceRecord contig = uncached.getSequenceDictionary().getSequence(0);

View File

@ -1,5 +1,6 @@
package org.broadinstitute.sting.utils.genotype.glf;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.GenomeLoc;
@ -13,6 +14,7 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.File;
import java.io.FileNotFoundException;
import net.sf.samtools.SAMSequenceRecord;
import net.sf.picard.reference.IndexedFastaSequenceFile;
@ -69,7 +71,13 @@ public class GLFWriterUnitTest extends BaseTest {
@BeforeClass
public void beforeTests() {
seq = new CachingIndexedFastaSequenceFile(new File(b36KGReference));
File referenceFile = new File(b36KGReference);
try {
seq = new CachingIndexedFastaSequenceFile(referenceFile);
}
catch(FileNotFoundException ex) {
throw new UserException.CouldNotReadInputFile(referenceFile,ex);
}
genomeLocParser = new GenomeLocParser(seq);
}

View File

@ -6,6 +6,7 @@ import org.broad.tribble.util.variantcontext.Allele;
import org.broad.tribble.util.variantcontext.Genotype;
import org.broad.tribble.util.variantcontext.VariantContext;
import org.broad.tribble.vcf.*;
import org.broadinstitute.sting.utils.exceptions.UserException;
import org.testng.Assert;
import org.broadinstitute.sting.BaseTest;
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
@ -40,8 +41,14 @@ public class VCFWriterUnitTest extends BaseTest {
@BeforeClass
public void beforeTests() {
IndexedFastaSequenceFile seq = new CachingIndexedFastaSequenceFile(new File(hg18Reference));
genomeLocParser = new GenomeLocParser(seq);
File referenceFile = new File(hg18Reference);
try {
IndexedFastaSequenceFile seq = new CachingIndexedFastaSequenceFile(referenceFile);
genomeLocParser = new GenomeLocParser(seq);
}
catch(FileNotFoundException ex) {
throw new UserException.CouldNotReadInputFile(referenceFile,ex);
}
}
/** test, using the writer and reader, that we can output and input a VCF file without problems */

View File

@ -13,6 +13,7 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
@ -28,8 +29,13 @@ public class IntervalUtilsUnitTest extends BaseTest {
@BeforeClass
public void init() {
ReferenceSequenceFile seq = new CachingIndexedFastaSequenceFile(reference);
genomeLocParser = new GenomeLocParser(seq);
try {
ReferenceSequenceFile seq = new CachingIndexedFastaSequenceFile(reference);
genomeLocParser = new GenomeLocParser(seq);
}
catch(FileNotFoundException ex) {
throw new UserException.CouldNotReadInputFile(reference,ex);
}
}
@Test(expectedExceptions=UserException.class)

View File

@ -1,3 +1,3 @@
<ivy-module version="1.0">
<info organisation="edu.mit.broad" module="picard-private-parts" revision="1562" status="integration" publication="20100902110200" />
<info organisation="edu.mit.broad" module="picard-private-parts" revision="1702" status="integration" publication="20110102175300" />
</ivy-module>

View File

@ -1,3 +0,0 @@
<ivy-module version="1.0">
<info organisation="net.sf" module="picard" revision="1.29.571" status="release" />
</ivy-module>

View File

@ -0,0 +1,3 @@
<ivy-module version="1.0">
<info organisation="net.sf" module="picard" revision="1.37.686" status="release" />
</ivy-module>

View File

@ -1,3 +0,0 @@
<ivy-module version="1.0">
<info organisation="net.sf" module="sam" revision="1.29.571" status="release" />
</ivy-module>

View File

@ -0,0 +1,3 @@
<ivy-module version="1.0">
<info organisation="net.sf" module="sam" revision="1.37.686" status="release" />
</ivy-module>