Removed annoying FastaSequenceIndexBuilderProgressListener infrastructure that was just a boolean switch on whether to print progress or not.
This commit is contained in:
parent
06374c91d7
commit
f3ad4ec94b
|
|
@ -25,7 +25,6 @@
|
|||
|
||||
package net.sf.picard.reference;
|
||||
|
||||
import org.broadinstitute.sting.gatk.datasources.reference.ReferenceDataSourceProgressListener;
|
||||
import org.broadinstitute.sting.utils.exceptions.ReviewedStingException;
|
||||
|
||||
import static net.sf.picard.reference.FastaSequenceIndexBuilder.Status.*;
|
||||
|
|
@ -39,8 +38,8 @@ import org.broadinstitute.sting.utils.exceptions.UserException;
|
|||
* Produces fai file with same output as samtools faidx
|
||||
*/
|
||||
public class FastaSequenceIndexBuilder {
|
||||
public File fastaFile;
|
||||
ReferenceDataSourceProgressListener progress; // interface that provides a method for updating user on progress of reading file
|
||||
final public File fastaFile;
|
||||
final boolean printProgress;
|
||||
|
||||
// keep track of location in file
|
||||
long bytesRead, endOfLastLine, lastTimestamp, fileLength; // initialized to -1 to keep 0-indexed position in file;
|
||||
|
|
@ -55,10 +54,10 @@ public class FastaSequenceIndexBuilder {
|
|||
public enum Status { NONE, CONTIG, FIRST_SEQ_LINE, SEQ_LINE, COMMENT }
|
||||
Status status = Status.NONE; // keeps state of what is currently being read. better to use int instead of enum?
|
||||
|
||||
public FastaSequenceIndexBuilder(File fastaFile, ReferenceDataSourceProgressListener progress) {
|
||||
this.progress = progress;
|
||||
public FastaSequenceIndexBuilder(File fastaFile, boolean printProgress) {
|
||||
this.fastaFile = fastaFile;
|
||||
fileLength = fastaFile.length();
|
||||
this.printProgress = printProgress;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -252,8 +251,8 @@ public class FastaSequenceIndexBuilder {
|
|||
|
||||
if (System.currentTimeMillis() - lastTimestamp > 10000) {
|
||||
int percentProgress = (int) (100*bytesRead/fileLength);
|
||||
if (progress != null)
|
||||
progress.percentProgress(percentProgress);
|
||||
if (printProgress)
|
||||
System.out.println(String.format("PROGRESS UPDATE: file is %d percent complete", percentProgress));
|
||||
lastTimestamp = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -926,9 +926,6 @@ public class GenomeAnalysisEngine {
|
|||
GenomeLocParser genomeLocParser,
|
||||
ValidationExclusion.TYPE validationExclusionType) {
|
||||
RMDTrackBuilder builder = new RMDTrackBuilder(sequenceDictionary,genomeLocParser,validationExclusionType);
|
||||
// try and make the tracks given their requests
|
||||
// create of live instances of the tracks
|
||||
List<RMDTrack> tracks = new ArrayList<RMDTrack>();
|
||||
|
||||
List<ReferenceOrderedDataSource> dataSources = new ArrayList<ReferenceOrderedDataSource>();
|
||||
for (RMDTriplet fileDescriptor : referenceMetaDataFiles)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import java.io.File;
|
|||
* Loads reference data from fasta file
|
||||
* Looks for fai and dict files, and tries to create them if they don't exist
|
||||
*/
|
||||
public class ReferenceDataSource implements ReferenceDataSourceProgressListener {
|
||||
public class ReferenceDataSource {
|
||||
private IndexedFastaSequenceFile index;
|
||||
|
||||
/** our log, which we want to capture anything from this class */
|
||||
|
|
@ -75,7 +75,7 @@ public class ReferenceDataSource implements ReferenceDataSourceProgressListener
|
|||
// get exclusive lock
|
||||
if (!indexLock.exclusiveLock())
|
||||
throw new UserException.CouldNotCreateReferenceIndexFileBecauseOfLock(dictFile);
|
||||
FastaSequenceIndexBuilder faiBuilder = new FastaSequenceIndexBuilder(fastaFile, this);
|
||||
FastaSequenceIndexBuilder faiBuilder = new FastaSequenceIndexBuilder(fastaFile, true);
|
||||
FastaSequenceIndex sequenceIndex = faiBuilder.createIndex();
|
||||
FastaSequenceIndexBuilder.saveAsFaiFile(sequenceIndex, indexFile);
|
||||
}
|
||||
|
|
@ -194,13 +194,4 @@ public class ReferenceDataSource implements ReferenceDataSourceProgressListener
|
|||
public IndexedFastaSequenceFile getReference() {
|
||||
return this.index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify user of progress in creating fai file
|
||||
* @param percent Percent of fasta file read as a percent
|
||||
*/
|
||||
public void percentProgress(int percent) {
|
||||
System.out.println(String.format("PROGRESS UPDATE: file is %d percent complete", percent));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ package net.sf.picard.reference;
|
|||
|
||||
import org.testng.Assert;
|
||||
import org.broadinstitute.sting.BaseTest;
|
||||
import org.broadinstitute.sting.gatk.datasources.reference.ReferenceDataSourceProgressListener;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
|
@ -40,7 +39,6 @@ import java.io.FileNotFoundException;
|
|||
public class FastaSequenceIndexBuilderUnitTest extends BaseTest {
|
||||
|
||||
private FastaSequenceIndexBuilder builder;
|
||||
private ReferenceDataSourceProgressListener progress;
|
||||
private File fastaFile;
|
||||
private FastaSequenceIndex controlIndex;
|
||||
|
||||
|
|
@ -58,7 +56,7 @@ public class FastaSequenceIndexBuilderUnitTest extends BaseTest {
|
|||
logger.warn("Executing unixFileTest");
|
||||
|
||||
fastaFile = new File(validationDataLocation + "exampleFASTA.fasta");
|
||||
builder = new FastaSequenceIndexBuilder(fastaFile, progress);
|
||||
builder = new FastaSequenceIndexBuilder(fastaFile, false);
|
||||
FastaSequenceIndex index = builder.createIndex();
|
||||
controlIndex.add(new FastaSequenceIndexEntry("chr1", 6, 100000, 60, 61,0));
|
||||
|
||||
|
|
@ -75,7 +73,7 @@ public class FastaSequenceIndexBuilderUnitTest extends BaseTest {
|
|||
logger.warn("Executing windowsFileTest");
|
||||
|
||||
fastaFile = new File(validationDataLocation + "exampleFASTA-windows.fasta");
|
||||
builder = new FastaSequenceIndexBuilder(fastaFile, progress);
|
||||
builder = new FastaSequenceIndexBuilder(fastaFile, false);
|
||||
FastaSequenceIndex index = builder.createIndex();
|
||||
controlIndex.add(new FastaSequenceIndexEntry("chr2", 7, 29, 7, 9,0));
|
||||
|
||||
|
|
@ -91,7 +89,7 @@ public class FastaSequenceIndexBuilderUnitTest extends BaseTest {
|
|||
logger.warn("Executing combinedWindowsUnix");
|
||||
|
||||
fastaFile = new File(validationDataLocation + "exampleFASTA-combined.fasta");
|
||||
builder = new FastaSequenceIndexBuilder(fastaFile, progress);
|
||||
builder = new FastaSequenceIndexBuilder(fastaFile, false);
|
||||
FastaSequenceIndex index = builder.createIndex();
|
||||
controlIndex.add(new FastaSequenceIndexEntry("chr1", 6, 100000, 60, 61,0));
|
||||
controlIndex.add(new FastaSequenceIndexEntry("chr2", 101680, 29, 7, 9,1));
|
||||
|
|
@ -108,7 +106,7 @@ public class FastaSequenceIndexBuilderUnitTest extends BaseTest {
|
|||
logger.warn("Executing threeVariableLengthContigs");
|
||||
|
||||
fastaFile = new File(validationDataLocation + "exampleFASTA-3contigs.fasta");
|
||||
builder = new FastaSequenceIndexBuilder(fastaFile, progress);
|
||||
builder = new FastaSequenceIndexBuilder(fastaFile, false);
|
||||
FastaSequenceIndex index = builder.createIndex();
|
||||
controlIndex.add(new FastaSequenceIndexEntry("chr1", 6, 17, 5, 6,0));
|
||||
controlIndex.add(new FastaSequenceIndexEntry("chr2", 35, 21, 7, 8,1));
|
||||
|
|
|
|||
Loading…
Reference in New Issue