Merged bug fix from Stable into Unstable
This commit is contained in:
commit
b43d21056b
|
|
@ -51,11 +51,10 @@ import org.broadinstitute.sting.utils.recalibration.BaseRecalibration;
|
||||||
import org.broadinstitute.sting.utils.sam.GATKSamRecordFactory;
|
import org.broadinstitute.sting.utils.sam.GATKSamRecordFactory;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.*;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User: aaron
|
* User: aaron
|
||||||
|
|
@ -466,7 +465,6 @@ public class SAMDataSource {
|
||||||
/**
|
/**
|
||||||
* Fill the given buffering shard with reads.
|
* Fill the given buffering shard with reads.
|
||||||
* @param shard Shard to fill.
|
* @param shard Shard to fill.
|
||||||
* @return true if at the end of the stream. False otherwise.
|
|
||||||
*/
|
*/
|
||||||
public void fillShard(Shard shard) {
|
public void fillShard(Shard shard) {
|
||||||
if(!shard.buffersReads())
|
if(!shard.buffersReads())
|
||||||
|
|
@ -561,15 +559,19 @@ public class SAMDataSource {
|
||||||
if(shard.getFileSpans().get(id) == null)
|
if(shard.getFileSpans().get(id) == null)
|
||||||
throw new ReviewedStingException("SAMDataSource: received null location for reader " + id + ", but null locations are no longer supported.");
|
throw new ReviewedStingException("SAMDataSource: received null location for reader " + id + ", but null locations are no longer supported.");
|
||||||
|
|
||||||
if(threadAllocation.getNumIOThreads() > 0) {
|
try {
|
||||||
BlockInputStream inputStream = readers.getInputStream(id);
|
if(threadAllocation.getNumIOThreads() > 0) {
|
||||||
inputStream.submitAccessPlan(new BAMAccessPlan(id, inputStream, (GATKBAMFileSpan) shard.getFileSpans().get(id)));
|
BlockInputStream inputStream = readers.getInputStream(id);
|
||||||
BAMRecordCodec codec = new BAMRecordCodec(getHeader(id),factory);
|
inputStream.submitAccessPlan(new BAMAccessPlan(id, inputStream, (GATKBAMFileSpan) shard.getFileSpans().get(id)));
|
||||||
codec.setInputStream(inputStream);
|
BAMRecordCodec codec = new BAMRecordCodec(getHeader(id),factory);
|
||||||
iterator = new BAMCodecIterator(inputStream,readers.getReader(id),codec);
|
codec.setInputStream(inputStream);
|
||||||
}
|
iterator = new BAMCodecIterator(inputStream,readers.getReader(id),codec);
|
||||||
else {
|
}
|
||||||
iterator = readers.getReader(id).iterator(shard.getFileSpans().get(id));
|
else {
|
||||||
|
iterator = readers.getReader(id).iterator(shard.getFileSpans().get(id));
|
||||||
|
}
|
||||||
|
} catch ( RuntimeException e ) { // we need to catch RuntimeExceptions here because the Picard code is throwing them (among SAMFormatExceptions) sometimes
|
||||||
|
throw new UserException.MalformedBAM(id.samFile, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator = new MalformedBAMErrorReformatingIterator(id.samFile, iterator);
|
iterator = new MalformedBAMErrorReformatingIterator(id.samFile, iterator);
|
||||||
|
|
@ -924,10 +926,7 @@ public class SAMDataSource {
|
||||||
blockInputStream = new BlockInputStream(dispatcher,readerID,false);
|
blockInputStream = new BlockInputStream(dispatcher,readerID,false);
|
||||||
reader = new SAMFileReader(readerID.samFile,indexFile,false);
|
reader = new SAMFileReader(readerID.samFile,indexFile,false);
|
||||||
} catch ( RuntimeIOException e ) {
|
} catch ( RuntimeIOException e ) {
|
||||||
if ( e.getCause() != null && e.getCause() instanceof FileNotFoundException )
|
throw new UserException.CouldNotReadInputFile(readerID.samFile, e);
|
||||||
throw new UserException.CouldNotReadInputFile(readerID.samFile, e);
|
|
||||||
else
|
|
||||||
throw e;
|
|
||||||
} catch ( SAMFormatException e ) {
|
} catch ( SAMFormatException e ) {
|
||||||
throw new UserException.MalformedBAM(readerID.samFile, e.getMessage());
|
throw new UserException.MalformedBAM(readerID.samFile, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
package org.broadinstitute.sting.gatk.walkers.variantutils;
|
package org.broadinstitute.sting.gatk.walkers.variantutils;
|
||||||
|
|
||||||
import net.sf.picard.PicardException;
|
|
||||||
import net.sf.picard.liftover.LiftOver;
|
import net.sf.picard.liftover.LiftOver;
|
||||||
import net.sf.picard.util.Interval;
|
import net.sf.picard.util.Interval;
|
||||||
import net.sf.samtools.SAMFileHeader;
|
import net.sf.samtools.SAMFileHeader;
|
||||||
|
|
@ -73,7 +72,7 @@ public class LiftoverVariants extends RodWalker<Integer, Integer> {
|
||||||
public void initialize() {
|
public void initialize() {
|
||||||
try {
|
try {
|
||||||
liftOver = new LiftOver(CHAIN);
|
liftOver = new LiftOver(CHAIN);
|
||||||
} catch (PicardException e) {
|
} catch (RuntimeException e) {
|
||||||
throw new UserException.BadInput("there is a problem with the chain file you are using: " + e.getMessage());
|
throw new UserException.BadInput("there is a problem with the chain file you are using: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,7 +81,7 @@ public class LiftoverVariants extends RodWalker<Integer, Integer> {
|
||||||
try {
|
try {
|
||||||
final SAMFileHeader toHeader = new SAMFileReader(NEW_SEQ_DICT).getFileHeader();
|
final SAMFileHeader toHeader = new SAMFileReader(NEW_SEQ_DICT).getFileHeader();
|
||||||
liftOver.validateToSequences(toHeader.getSequenceDictionary());
|
liftOver.validateToSequences(toHeader.getSequenceDictionary());
|
||||||
} catch (PicardException e) {
|
} catch (RuntimeException e) {
|
||||||
throw new UserException.BadInput("the chain file you are using is not compatible with the reference you are trying to lift over to; please use the appropriate chain file for the given reference");
|
throw new UserException.BadInput("the chain file you are using is not compatible with the reference you are trying to lift over to; please use the appropriate chain file for the given reference");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue