Don't have the Indel Realigner change IUPAC reference bases.
This change doesn't affect the performance of the Indel Realigner at all (as per tests). This is just a request from the Picard side (where further testing is happening).
This commit is contained in:
parent
a8851e6763
commit
5f76ae6a37
|
|
@ -394,7 +394,7 @@ public class IndelRealigner extends ReadWalker<Integer, Integer> {
|
||||||
throw new RuntimeException("Entropy threshold must be a fraction between 0 and 1");
|
throw new RuntimeException("Entropy threshold must be a fraction between 0 and 1");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
referenceReader = new CachingIndexedFastaSequenceFile(getToolkit().getArguments().referenceFile);
|
referenceReader = new CachingIndexedFastaSequenceFile(getToolkit().getArguments().referenceFile, false, true);
|
||||||
}
|
}
|
||||||
catch(FileNotFoundException ex) {
|
catch(FileNotFoundException ex) {
|
||||||
throw new UserException.CouldNotReadInputFile(getToolkit().getArguments().referenceFile,ex);
|
throw new UserException.CouldNotReadInputFile(getToolkit().getArguments().referenceFile,ex);
|
||||||
|
|
|
||||||
|
|
@ -125,8 +125,9 @@ public class CachingIndexedFastaSequenceFile extends IndexedFastaSequenceFile {
|
||||||
* @param fasta The file to open.
|
* @param fasta The file to open.
|
||||||
* @param cacheSize the size of the cache to use in this CachingIndexedFastaReader, must be >= 0
|
* @param cacheSize the size of the cache to use in this CachingIndexedFastaReader, must be >= 0
|
||||||
* @param preserveCase If true, we will keep the case of the underlying bases in the FASTA, otherwise everything is converted to upper case
|
* @param preserveCase If true, we will keep the case of the underlying bases in the FASTA, otherwise everything is converted to upper case
|
||||||
|
* @param preserveIUPAC If true, we will keep the IUPAC bases in the FASTA, otherwise they are converted to Ns
|
||||||
*/
|
*/
|
||||||
public CachingIndexedFastaSequenceFile(final File fasta, final long cacheSize, final boolean preserveCase, final boolean preserveIUPAC) throws FileNotFoundException {
|
public CachingIndexedFastaSequenceFile(final File fasta, final long cacheSize, final boolean preserveCase, final boolean preserveIUPAC) throws FileNotFoundException {
|
||||||
super(fasta);
|
super(fasta);
|
||||||
if ( cacheSize < 0 ) throw new IllegalArgumentException("cacheSize must be > 0");
|
if ( cacheSize < 0 ) throw new IllegalArgumentException("cacheSize must be > 0");
|
||||||
this.cacheSize = cacheSize;
|
this.cacheSize = cacheSize;
|
||||||
|
|
@ -172,6 +173,19 @@ public class CachingIndexedFastaSequenceFile extends IndexedFastaSequenceFile {
|
||||||
this(fasta, DEFAULT_CACHE_SIZE, preserveCase, false);
|
this(fasta, DEFAULT_CACHE_SIZE, preserveCase, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open the given indexed fasta sequence file. Throw an exception if the file cannot be opened.
|
||||||
|
*
|
||||||
|
* Looks for a index file for fasta on disk
|
||||||
|
*
|
||||||
|
* @param fasta The file to open.
|
||||||
|
* @param preserveCase If true, we will keep the case of the underlying bases in the FASTA, otherwise everything is converted to upper case
|
||||||
|
* @param preserveIUPAC If true, we will keep the IUPAC bases in the FASTA, otherwise they are converted to Ns
|
||||||
|
*/
|
||||||
|
public CachingIndexedFastaSequenceFile(final File fasta, final boolean preserveCase, final boolean preserveIUPAC) throws FileNotFoundException {
|
||||||
|
this(fasta, DEFAULT_CACHE_SIZE, preserveCase, preserveIUPAC);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create reference data source from fasta file, after performing several preliminary checks on the file.
|
* Create reference data source from fasta file, after performing several preliminary checks on the file.
|
||||||
* This static utility was refactored from the constructor of ReferenceDataSource.
|
* This static utility was refactored from the constructor of ReferenceDataSource.
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ public class CachingIndexedFastaSequenceFileUnitTest extends BaseTest {
|
||||||
@Test(enabled = true)
|
@Test(enabled = true)
|
||||||
public void testIupacChanges() throws FileNotFoundException, InterruptedException {
|
public void testIupacChanges() throws FileNotFoundException, InterruptedException {
|
||||||
final String testFasta = privateTestDir + "iupacFASTA.fasta";
|
final String testFasta = privateTestDir + "iupacFASTA.fasta";
|
||||||
final CachingIndexedFastaSequenceFile iupacPreserving = new CachingIndexedFastaSequenceFile(new File(testFasta), CachingIndexedFastaSequenceFile.DEFAULT_CACHE_SIZE, false, true);
|
final CachingIndexedFastaSequenceFile iupacPreserving = new CachingIndexedFastaSequenceFile(new File(testFasta), false, true);
|
||||||
final CachingIndexedFastaSequenceFile makeNs = new CachingIndexedFastaSequenceFile(new File(testFasta));
|
final CachingIndexedFastaSequenceFile makeNs = new CachingIndexedFastaSequenceFile(new File(testFasta));
|
||||||
|
|
||||||
int preservingNs = 0;
|
int preservingNs = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue