Skip to content

Commit

Permalink
Added threshold option
Browse files Browse the repository at this point in the history
  • Loading branch information
evantarbell committed Sep 21, 2019
1 parent 7b46d98 commit bd6c88d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/HMMR_ATAC/ArgParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public class ArgParser {
private boolean printExclude=false;
private boolean printTrain=true;
private long randomTrainSeed = 10151;
private double threshold = 30;

/**
* Main constructor
Expand All @@ -68,6 +69,11 @@ public ArgParser(String[] a,String ver){
version = ver;
set();
}
/**
* Access the threshold for reporting peaks
* @return a double to represent the threshold
*/
public double getThreshold(){return threshold;}
/**
* Access the seed used for random sampling of training regions
* @return a long to represent the seed for random sampling of training regions
Expand Down Expand Up @@ -465,6 +471,10 @@ private void set(){
randomTrainSeed=Long.parseLong(args[i+1]);
i++;
break;
case"threshold":
threshold = Double.parseDouble(args[i+1]);
i++;
break;
case"help":
printUsage();
//System.exit(0);
Expand Down Expand Up @@ -511,6 +521,7 @@ public void printUsage(){
System.out.println("\t--printExclude <true || false> Whether to output excluded regions into Output_exclude.bed. Default = false");
System.out.println("\t--printTrain <true || false> Whether to output training regions into Output_training.bed. Default = true");
System.out.println("\t--randomSeed <long> Seed to set for random sampling of training regions. Default is 10151");
System.out.println("\t--threshold <double> threshold for reporting peaks. Only peaks who's score is >= this value will be reported.");
System.out.println("\t-h , --help Print this help message and exit.");
System.exit(0);
}
Expand Down
1 change: 0 additions & 1 deletion src/HMMR_ATAC/BaumWelch.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import java.util.List;

import JAHMMTest.BaumWelchScaledLearner;
Expand Down
5 changes: 4 additions & 1 deletion src/HMMR_ATAC/Main_HMMR_Driver.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public class Main_HMMR_Driver {
private static boolean printExclude = false;
private static boolean printTrain = true;
private static long randomTrainSeed=10151;
private static double threshold=0;

private static String trainingRegions;

Expand Down Expand Up @@ -129,6 +130,7 @@ public static void main(String[] args) throws IOException {
printExclude = p.getPrintExclude();
printTrain = p.getPrintTrain();
randomTrainSeed = p.getRandomTrainSeed();
threshold=p.getThreshold();
// printHMMRTracks = p.getPrintHMMRTracks();
//For run time calculation
Long startTime = System.currentTimeMillis();
Expand Down Expand Up @@ -654,7 +656,8 @@ public static void main(String[] args) throws IOException {
* report the peaks and summits, if desired
*/
if (peaks && (int) temp.getScore2() == peak
&& temp.getLength() >= minLength) {
&& temp.getLength() >= minLength &&
Double.parseDouble(temp.getScore3()) >= threshold) {
if (temp.getSummit() != null) {
summits.println(temp.toString_ScoredSummit());
}
Expand Down

0 comments on commit bd6c88d

Please sign in to comment.