Aesthetic cleanup.
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@735 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
a0464633fd
commit
28bf7ec8ad
|
|
@ -36,7 +36,6 @@ public class AnnotateSecondaryBase extends CommandLineProgram {
|
||||||
@Argument(fullName="cycle_end", shortName="CE", doc="On what cycle does the read end? (0-based inclusive)") public int CYCLE_END;
|
@Argument(fullName="cycle_end", shortName="CE", doc="On what cycle does the read end? (0-based inclusive)") public int CYCLE_END;
|
||||||
@Argument(fullName="tlim", shortName="T", doc="Number of reads to use for parameter initialization", required=false) public int TRAINING_LIMIT = 250000;
|
@Argument(fullName="tlim", shortName="T", doc="Number of reads to use for parameter initialization", required=false) public int TRAINING_LIMIT = 250000;
|
||||||
@Argument(fullName="clim", shortName="C", doc="Number of reads to basecall", required=false) public int CALLING_LIMIT = Integer.MAX_VALUE;
|
@Argument(fullName="clim", shortName="C", doc="Number of reads to basecall", required=false) public int CALLING_LIMIT = Integer.MAX_VALUE;
|
||||||
@Argument(fullName="context", shortName="X", doc="Attempt to correct for context?", required=false) public Boolean CONTEXT = false;
|
|
||||||
@Argument(fullName="runbarcode", shortName="B", doc="Run barcode (embedded as part of the read name") public String RUN_BARCODE;
|
@Argument(fullName="runbarcode", shortName="B", doc="Run barcode (embedded as part of the read name") public String RUN_BARCODE;
|
||||||
|
|
||||||
public static void main(String[] argv) {
|
public static void main(String[] argv) {
|
||||||
|
|
@ -48,12 +47,12 @@ public class AnnotateSecondaryBase extends CommandLineProgram {
|
||||||
BasecallingTrainingSet trainingSet = new BasecallingTrainingSet(BUSTARD_DIR, LANE, CYCLE_BEGIN, CYCLE_END, TRAINING_LIMIT);
|
BasecallingTrainingSet trainingSet = new BasecallingTrainingSet(BUSTARD_DIR, LANE, CYCLE_BEGIN, CYCLE_END, TRAINING_LIMIT);
|
||||||
|
|
||||||
// Iterate through raw Firecrest data and store the first N reads up to TRAINING_LIMIT
|
// Iterate through raw Firecrest data and store the first N reads up to TRAINING_LIMIT
|
||||||
System.out.println("Loading training set from the first " + TRAINING_LIMIT + " reads in the raw data...");
|
System.out.println("Loading training set from the first " + TRAINING_LIMIT + " unambiguous reads in the raw data...");
|
||||||
trainingSet.loadFirstNUnambiguousReadsTrainingSet();
|
trainingSet.loadFirstNUnambiguousReadsTrainingSet();
|
||||||
|
|
||||||
// Iterate through the stored training data and add the info to the BasecallingReadModel
|
// Iterate through the stored training data and add the info to the BasecallingReadModel
|
||||||
System.out.println("Applying training set...");
|
System.out.println("Applying training set...");
|
||||||
BasecallingReadModel model = new BasecallingReadModel(CYCLE_END - CYCLE_BEGIN + 1, CONTEXT);
|
BasecallingReadModel model = new BasecallingReadModel(CYCLE_END - CYCLE_BEGIN + 1, true);
|
||||||
model.train(trainingSet);
|
model.train(trainingSet);
|
||||||
|
|
||||||
// Call bases and write results
|
// Call bases and write results
|
||||||
|
|
@ -69,13 +68,15 @@ public class AnnotateSecondaryBase extends CommandLineProgram {
|
||||||
FourProbRead fpr = model.call(rr);
|
FourProbRead fpr = model.call(rr);
|
||||||
|
|
||||||
sfw.addAlignment(constructSAMRecord(rr, fpr, sfh, RUN_BARCODE));
|
sfw.addAlignment(constructSAMRecord(rr, fpr, sfh, RUN_BARCODE));
|
||||||
bstats.update(rr, fpr, 10000);
|
bstats.update(rr, fpr);
|
||||||
|
|
||||||
|
bstats.notifyOnInterval(10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
iparser.close();
|
iparser.close();
|
||||||
sfw.close();
|
sfw.close();
|
||||||
|
|
||||||
System.out.printf("%% bases consistent: %d/%d (%4.4f)\n", bstats.getBasesConsistent(), bstats.getBasesTotal(), bstats.getPercentConsistent());
|
bstats.notifyNow();
|
||||||
System.out.println("Done.");
|
System.out.println("Done.");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ public class BasecallingStats {
|
||||||
* @return the percent of bases called consistently
|
* @return the percent of bases called consistently
|
||||||
*/
|
*/
|
||||||
public double getPercentConsistent() {
|
public double getPercentConsistent() {
|
||||||
return ((double) getBasesConsistent())/((double) getBasesTotal());
|
return 100.0*((double) getBasesConsistent())/((double) getBasesTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -60,7 +60,7 @@ public class BasecallingStats {
|
||||||
* @param rr the raw Illumina read
|
* @param rr the raw Illumina read
|
||||||
* @param fpr the FourProb read
|
* @param fpr the FourProb read
|
||||||
*/
|
*/
|
||||||
public void update(RawRead rr, FourProbRead fpr, int updateInterval) {
|
public void update(RawRead rr, FourProbRead fpr) {
|
||||||
for (int cycle = 0; cycle < fpr.size(); cycle++) {
|
for (int cycle = 0; cycle < fpr.size(); cycle++) {
|
||||||
int rawBaseIndex = BaseUtils.simpleBaseToBaseIndex((char) rr.getSequence()[cycle]);
|
int rawBaseIndex = BaseUtils.simpleBaseToBaseIndex((char) rr.getSequence()[cycle]);
|
||||||
int fpBaseIndex = fpr.get(cycle).indexAtRank(0);
|
int fpBaseIndex = fpr.get(cycle).indexAtRank(0);
|
||||||
|
|
@ -74,10 +74,33 @@ public class BasecallingStats {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (basesTotal % updateInterval == 0 && basesTotal > 0) {
|
|
||||||
System.out.printf("%% bases consistent: %d/%d (%4.4f)\r", basesConsistent, basesTotal, ((double) basesConsistent)/((double) basesTotal));
|
|
||||||
}
|
|
||||||
|
|
||||||
readsTotal++;
|
readsTotal++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns basecalling stats info in a nicely formatted string
|
||||||
|
*
|
||||||
|
* @return nicely formatted string containing basecalling stats
|
||||||
|
*/
|
||||||
|
public String toString() {
|
||||||
|
return String.format("%% bases consistent: %d/%d (%2.2f%%)", getBasesConsistent(), getBasesTotal(), getPercentConsistent());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Periodically print a line containing basecalling stats
|
||||||
|
*
|
||||||
|
* @param interval the periodicity of the messages given in number of bases observed
|
||||||
|
*/
|
||||||
|
public void notifyOnInterval(int interval) {
|
||||||
|
if (getBasesTotal() > 0 && getBasesTotal() % interval == 0) {
|
||||||
|
System.out.printf("%s\r", toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Immediately print a line containing basecalling stats
|
||||||
|
*/
|
||||||
|
public void notifyNow() {
|
||||||
|
System.out.printf("%s\n", toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue