Skip to content

Commit

Permalink
Torrent Suite Software 5.4.0 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-pan-tfs committed Jul 14, 2017
1 parent 628712b commit d19d969
Show file tree
Hide file tree
Showing 974 changed files with 242,486 additions and 90,806 deletions.
2 changes: 1 addition & 1 deletion Analysis/AnalysisOrg/ClonalFilter.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Copyright (C) 2012 Ion Torrent Systems, Inc. All Rights Reserved */
#include "ClonalFilter.h"
#include "mixed.h"
#include "ClonalFilter/mixed.h"
#include "hdf5.h"

using namespace std;
Expand Down
155 changes: 86 additions & 69 deletions Analysis/AnalysisOrg/IO/BeadfindControlOpts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,86 +88,103 @@ void BeadfindControlOpts::PrintHelp()
printf (" --beadfind-zero-flows STRING beadfind double tap flows []\n");
printf (" --beadfind-num-threads INT beadfind number of threads [-1]\n");
printf (" --beadfind-mesh-step VECTOR_INT beadfind mesh steps for differntial separator [100,100]\n");
printf (" --beadfind-acq-threshold VECTOR_INT beadfind threshold for hinge model for acquisition flow [-10,12,5,500]\n");
printf (" --beadfind-bf-threshold VECTOR_INT beadfind threshold for hinge model for beadfind flow [-5,300,-20000,-10]\n");
printf (" --exclusion-mask FILE exclusion mask file name []\n");
printf (" --bfold BOOL BF_ADVANCED [true]\n");
printf (" --noduds BOOL noduds [false]\n");
printf ("\n");
}

void BeadfindControlOpts::SetOpts(OptArgs &opts, Json::Value& json_params)
{
beadfindType = RetrieveParameterString(opts, json_params, '-', "beadfind-type", "differential");
if ( beadfindType != "differential" )
{
fprintf ( stderr, "*Error* - Illegal option to --beadfind-type: %s, valid options are 'differential'\n",
beadfindType.c_str() );
exit ( EXIT_FAILURE );
}
string s1 = RetrieveParameterString(opts, json_params, '-', "use-beadmask", "");
if(s1.length() > 0)
{
sprintf(beadMaskFile, "%s", s1.c_str());
}
maskFileCategorized = RetrieveParameterBool(opts, json_params, '-', "beadmask-categorized", false);
string s2 = RetrieveParameterString(opts, json_params, '-', "beadfind-basis", "naoh");
if(s2.length() > 0)
{
bfType = s2;
if ( bfType != "naoh" && bfType != "positive" && bfType != "nobuffer")
{
fprintf ( stderr, "*Error* - Illegal option to --beadfind-basis: %s, valid options are 'naoh','nobuffer' or 'positive'\n", bfType.c_str() );
exit ( EXIT_FAILURE );
}
}
bfDat = RetrieveParameterString(opts, json_params, '-', "beadfind-dat", "beadfind_pre_0003.dat");
bfBgDat = RetrieveParameterString(opts, json_params, '-', "beadfind-bgdat", "");
sdAsBf = RetrieveParameterBool(opts, json_params, '-', "beadfind-sdasbf", true);
bfMult = RetrieveParameterFloat(opts, json_params, '-', "beadfind-bfmult", 1.0);
bfMinLiveRatio = RetrieveParameterDouble(opts, json_params, '-', "beadfind-minlive", 0.0001);
bfMinLiveLibSnr = RetrieveParameterDouble(opts, json_params, '-', "beadfind-minlivesnr", 4.0);
beadfindType = RetrieveParameterString(opts, json_params, '-', "beadfind-type", "differential");
if ( beadfindType != "differential" )
{
fprintf ( stderr, "*Error* - Illegal option to --beadfind-type: %s, valid options are 'differential'\n",
beadfindType.c_str() );
exit ( EXIT_FAILURE );
}
string s1 = RetrieveParameterString(opts, json_params, '-', "use-beadmask", "");
if(s1.length() > 0)
{
sprintf(beadMaskFile, "%s", s1.c_str());
}
maskFileCategorized = RetrieveParameterBool(opts, json_params, '-', "beadmask-categorized", false);

exclusionMaskFile = RetrieveParameterString(opts, json_params, '-', "exclusion-mask", "");

string s2 = RetrieveParameterString(opts, json_params, '-', "beadfind-basis", "naoh");
if(s2.length() > 0)
{
bfType = s2;
if ( bfType != "naoh" && bfType != "positive" && bfType != "nobuffer")
{
fprintf ( stderr, "*Error* - Illegal option to --beadfind-basis: %s, valid options are 'naoh','nobuffer' or 'positive'\n", bfType.c_str() );
exit ( EXIT_FAILURE );
}
}
bfDat = RetrieveParameterString(opts, json_params, '-', "beadfind-dat", "beadfind_pre_0003.dat");
bfBgDat = RetrieveParameterString(opts, json_params, '-', "beadfind-bgdat", "");
sdAsBf = RetrieveParameterBool(opts, json_params, '-', "beadfind-sdasbf", true);
bfMult = RetrieveParameterFloat(opts, json_params, '-', "beadfind-bfmult", 1.0);
bfMinLiveRatio = RetrieveParameterDouble(opts, json_params, '-', "beadfind-minlive", 0.0001);
bfMinLiveLibSnr = RetrieveParameterDouble(opts, json_params, '-', "beadfind-minlivesnr", 4.0);
bfMinLiveTfSnr = RetrieveParameterDouble(opts, json_params, '-', "beadfind-min-tf-snr", 7);
minTfPeakMax = RetrieveParameterFloat(opts, json_params, '-', "beadfind-tf-min-peak", 40.0);
minLibPeakMax = RetrieveParameterFloat(opts, json_params, '-', "beadfind-lib-min-peak", 10.0);
bfLibFilterQuantile = RetrieveParameterDouble(opts, json_params, '-', "beadfind-lib-filt", 1.0);
bfTfFilterQuantile = RetrieveParameterDouble(opts, json_params, '-', "beadfind-tf-filt", 1.0);
skipBeadfindSdRecover = RetrieveParameterInt(opts, json_params, '-', "beadfind-skip-sd-recover", 1);
minTfPeakMax = RetrieveParameterFloat(opts, json_params, '-', "beadfind-tf-min-peak", 40.0);
minLibPeakMax = RetrieveParameterFloat(opts, json_params, '-', "beadfind-lib-min-peak", 10.0);
bfLibFilterQuantile = RetrieveParameterDouble(opts, json_params, '-', "beadfind-lib-filt", 1.0);
bfTfFilterQuantile = RetrieveParameterDouble(opts, json_params, '-', "beadfind-tf-filt", 1.0);
skipBeadfindSdRecover = RetrieveParameterInt(opts, json_params, '-', "beadfind-skip-sd-recover", 1);
filterNoisyCols = RetrieveParameterString(opts, json_params, '-', "beadfind-filt-noisy-col", "none");
beadfindUseSepRef = RetrieveParameterBool(opts, json_params, '-', "beadfind-sep-ref", false);
beadfindSmoothTrace = RetrieveParameterBool(opts, json_params, '-', "beadfind-smooth-trace", false);
beadfindUseSepRef = RetrieveParameterBool(opts, json_params, '-', "beadfind-sep-ref", false);
beadfindSmoothTrace = RetrieveParameterBool(opts, json_params, '-', "beadfind-smooth-trace", false);
bfOutputDebug = RetrieveParameterInt(opts, json_params, '-', "beadfind-diagnostics", 2);
bool b1 = RetrieveParameterBool(opts, json_params, '-', "bead-washout", false);
SINGLEBF = !b1;
useBeadfindGainCorrection = RetrieveParameterBool(opts, json_params, '-', "beadfind-gain-correction", true);
useDatacollectGainCorrectionFile = RetrieveParameterBool(opts, json_params, '-', "datacollect-gain-correction", false);
blobFilter = RetrieveParameterBool(opts, json_params, '-', "beadfind-blob-filter", false);
predictFlowStart = RetrieveParameterInt(opts, json_params, '-', "beadfind-predict-start", -1);
predictFlowEnd = RetrieveParameterInt(opts, json_params, '-', "beadfind-predict-end", -1);
useSignalReference = RetrieveParameterInt(opts, json_params, '-', "beadfind-sig-ref-type", -1);
if(useSignalReference == -1)
{
useSignalReference = 4;
}
else
{
useSignalReferenceSet = true;
}
doubleTapFlows = RetrieveParameterString(opts, json_params, '-', "beadfind-zero-flows", "");
numThreads = RetrieveParameterInt(opts, json_params, '-', "beadfind-num-threads", -1);
bool b1 = RetrieveParameterBool(opts, json_params, '-', "bead-washout", false);
SINGLEBF = !b1;
useBeadfindGainCorrection = RetrieveParameterBool(opts, json_params, '-', "beadfind-gain-correction", true);
useDatacollectGainCorrectionFile = RetrieveParameterBool(opts, json_params, '-', "datacollect-gain-correction", false);
blobFilter = RetrieveParameterBool(opts, json_params, '-', "beadfind-blob-filter", false);
predictFlowStart = RetrieveParameterInt(opts, json_params, '-', "beadfind-predict-start", -1);
predictFlowEnd = RetrieveParameterInt(opts, json_params, '-', "beadfind-predict-end", -1);
useSignalReference = RetrieveParameterInt(opts, json_params, '-', "beadfind-sig-ref-type", -1);
if(useSignalReference == -1)
{
useSignalReference = 4;
}
else
{
useSignalReferenceSet = true;
}
doubleTapFlows = RetrieveParameterString(opts, json_params, '-', "beadfind-zero-flows", "");
numThreads = RetrieveParameterInt(opts, json_params, '-', "beadfind-num-threads", -1);

//jz the following comes from CommandLineOpts::GetOpts
BF_ADVANCED = RetrieveParameterBool(opts, json_params, '-', "bfold", true);
noduds = RetrieveParameterBool(opts, json_params, '-', "noduds", false);
string sb = RetrieveParameterString(opts, json_params, 'b', "beadfindfile", "");
if(sb.length() > 0)
{
snprintf ( preRunbfFileBase, 256, "%s", sb.c_str() );
//jz the following comes from CommandLineOpts::GetOpts
BF_ADVANCED = RetrieveParameterBool(opts, json_params, '-', "bfold", true);
noduds = RetrieveParameterBool(opts, json_params, '-', "noduds", false);
string sb = RetrieveParameterString(opts, json_params, 'b', "beadfindfile", "");
if(sb.length() > 0)
{
snprintf ( preRunbfFileBase, 256, "%s", sb.c_str() );
bfFileBase[0] = '\0';
SINGLEBF = true;
}
vector<int> vec;
RetrieveParameterVectorInt(opts, json_params, '-', "beadfind-mesh-step", "", vec);
if(vec.size() == 2)
{
meshStepX = vec[0];
meshStepY = vec[1];
}
}
vector<int> vec;
RetrieveParameterVectorInt(opts, json_params, '-', "beadfind-mesh-step", "", vec);
if(vec.size() == 2)
{
meshStepX = vec[0];
meshStepY = vec[1];
}

RetrieveParameterVectorFloat(opts, json_params, '-', "beadfind-acq-threshold","-10,3,5,500", beadfindAcqThreshold);
if( (beadfindAcqThreshold.size() != 4) || (beadfindAcqThreshold[0] > beadfindAcqThreshold[1]) || (beadfindAcqThreshold[2] > beadfindAcqThreshold[3]) ){
fprintf ( stderr, "*Error* - Illegal option value --beadfind-acq-threshold. Provide 4 values minFirstSlope,maxFirstSlope,minSecondSlope,maxSecondSlope. \n");
exit ( EXIT_FAILURE );
}
RetrieveParameterVectorFloat(opts, json_params, '-', "beadfind-bf-threshold","-5,300,-2000,-10", beadfindBfThreshold);
if( (beadfindBfThreshold.size() != 4) || (beadfindBfThreshold[0] > beadfindBfThreshold[1]) || (beadfindBfThreshold[2] > beadfindBfThreshold[3]) ){
fprintf ( stderr, "*Error* - Illegal option value --beadfind-bf-threshold. Provide 4 values minFirstSlope,maxFirstSlope,minSecondSlope,maxSecondSlope. \n");
exit ( EXIT_FAILURE );
}
}
3 changes: 3 additions & 0 deletions Analysis/AnalysisOrg/IO/BeadfindControlOpts.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class BeadfindControlOpts{
bool beadfindSmoothTrace;
std::string filterNoisyCols;
char *beadMaskFile;
std::string exclusionMaskFile;
bool maskFileCategorized;
char bfFileBase[MAX_PATH_LENGTH];
char preRunbfFileBase[MAX_PATH_LENGTH];
Expand Down Expand Up @@ -49,6 +50,8 @@ class BeadfindControlOpts{
int predictFlowEnd;
int meshStepX;
int meshStepY;
std::vector<float> beadfindAcqThreshold;
std::vector<float> beadfindBfThreshold;
void DefaultBeadfindControl();
void PrintHelp();
void SetOpts(OptArgs &opts, Json::Value& json_params);
Expand Down
46 changes: 5 additions & 41 deletions Analysis/AnalysisOrg/IO/BkgControlOpts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,76 +156,40 @@ void TraceControl::SetOpts(OptArgs &opts, Json::Value& json_params)
void BkgModelControlOpts::PrintHelp()
{
printf (" BkgModelControlOpts\n");
printf (" --mixed-first-flow INT mixed first flow of polyclonal filter [12]\n");
printf (" --mixed-last-flow INT mixed last flow of polyclonal filter [72]\n");
printf (" --max-iterations INT max iterations of polyclonal filter [30]\n");
printf (" --mixed-model-option INT mixed model option of polyclonal filter [0]\n");
printf (" --mixed-stringency DOUBLE mixed stringency of polyclonal filter [0.5]\n");
printf (" --nokey BOOL nokey [false]\n");
printf (" --xtalk-correction BOOL enable trace xtalk correction [false for Proton; true for P-zero and PGM]\n");
printf (" --n-unfiltered-lib INT number of unfiltered library random samples [100000]\n");
printf (" --bkg-dont-emphasize-by-compression INT emphasize by compression [1]\n");
printf (" --clonal-filter-bkgmodel BOOL enable polyclonal filter [false for Proton; true for PGM]\n");
printf (" --clonal-filter-debug BOOL enable polyclonal filter debug output \n");
printf (" --clonal-filter-use-last-iter-params BOOL use last EM iteration cluster parameters if no convergence \n");
printf (" --filter-extreme-ppf-only BOOL Skip polyclonal filter training and filter for extreme ppf only \n");
printf (" --sigproc-regional-smoothing-alpha FLOAT sigproc regional smoothing alpha [1.0]\n");
printf (" --sigproc-regional-smoothing-gamma FLOAT sigproc regional smoothing gamma [1.0]\n");
printf (" --restart-reg-params-file STRING json file to input/output regional parameters\n");
printf ("\n");

polyclonal_filter.PrintHelp(true);
signal_chunks.PrintHelp();
trace_control.PrintHelp();
pest_control.PrintHelp();
gpuControl.PrintHelp();
}

void BkgModelControlOpts::SetOpts(OptArgs &opts, Json::Value& json_params)
void BkgModelControlOpts::SetOpts(OptArgs &opts, Json::Value& json_params, int num_flows)
{
gpuControl.SetOpts(opts, json_params);
signal_chunks.SetOpts(opts, json_params);
pest_control.SetOpts(opts, json_params);
trace_control.SetOpts(opts, json_params);
polyclonal_filter.SetOpts(true, opts,json_params, num_flows);

//jz the following comes from CommandLineOpts::GetOpts
unfiltered_library_random_sample = RetrieveParameterInt(opts, json_params, '-', "n-unfiltered-lib", 100000);
enable_trace_xtalk_correction = RetrieveParameterBool(opts, json_params, '-', "xtalk-correction", true);
emphasize_by_compression = RetrieveParameterInt(opts, json_params, '-', "bkg-dont-emphasize-by-compression", 1);
nokey = RetrieveParameterBool(opts, json_params, '-', "nokey", false);


washout_threshold = RetrieveParameterFloat(opts, json_params, '-', "bkg-washout-threshold", WASHOUT_THRESHOLD);
washout_flow_detection = RetrieveParameterInt(opts, json_params, '-', "bkg-washout-flow-detection", WASHOUT_FLOW_DETECTION);

polyclonal_filter.enable = RetrieveParameterBool(opts, json_params, '-', "clonal-filter-bkgmodel", true);
polyclonal_filter.mixed_first_flow = RetrieveParameterInt(opts, json_params, '-', "mixed-first-flow", 12);
polyclonal_filter.mixed_last_flow = RetrieveParameterInt(opts, json_params, '-', "mixed-last-flow", 72);
polyclonal_filter.max_iterations = RetrieveParameterInt(opts, json_params, '-', "max-iterations", 30);
polyclonal_filter.mixed_model_option = RetrieveParameterInt(opts, json_params, '-', "mixed-model-option", 0);
polyclonal_filter.verbose = RetrieveParameterBool(opts, json_params, '-', "clonal-filter-debug", false);
polyclonal_filter.use_last_iter_params = RetrieveParameterBool(opts, json_params, '-', "clonal-filter-use-last-iter-params", true);
polyclonal_filter.filter_extreme_ppf_only = RetrieveParameterBool(opts, json_params, '-', "filter-extreme-ppf-only", false);
double stringency = RetrieveParameterDouble(opts, json_params, '-', "mixed-stringency", 0.5);
if(stringency < 0)
{
stringency = 0;
}
if(stringency > 1)
{
stringency = 1;
}
//transform it to log scale
if(stringency > 0.5)
{
polyclonal_filter.mixed_stringency = 0.5 * std::log10((stringency - 0.5)*18 + 1) + 0.5;
}
else if (stringency< 0.5)
{
polyclonal_filter.mixed_stringency = 0.5 - 0.5 * std::log10(( 0.5 - stringency)*18 + 1);
}
else
{
polyclonal_filter.mixed_stringency = 0.5;
}

regional_smoothing.alpha = RetrieveParameterFloat(opts, json_params, '-', "sigproc-regional-smoothing-alpha", 1.0f);
regional_smoothing.gamma = RetrieveParameterFloat(opts, json_params, '-', "sigproc-regional-smoothing-gamma", 1.0f);

Expand Down
4 changes: 2 additions & 2 deletions Analysis/AnalysisOrg/IO/BkgControlOpts.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "SeqList.h"
#include "GpuControlOpts.h"
#include "DebugMe.h"
#include "polyclonal_filter.h"
#include "ClonalFilter/polyclonal_filter.h"
#include "FlowSequence.h"
#include "OptBase.h"

Expand Down Expand Up @@ -94,7 +94,7 @@ class BkgModelControlOpts{

void DefaultBkgModelControl(void);
void PrintHelp();
void SetOpts(OptArgs &opts, Json::Value& json_params);
void SetOpts(OptArgs &opts, Json::Value& json_params, int num_flows);
};

#endif // BKGCONTROLOPTS_H
41 changes: 24 additions & 17 deletions Analysis/AnalysisOrg/IO/CommandLineOpts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "CommandLineOpts.h"
#include "ChipIdDecoder.h"
#include "IonErr.h"
#include "mixed.h"
#include "ClonalFilter/mixed.h"

using namespace std;

Expand Down Expand Up @@ -93,22 +93,23 @@ void CommandLineOpts::PrintHelp()

void CommandLineOpts::SetOpts(OptArgs &opts, Json::Value& json_params)
{
bkg_control.DefaultBkgModelControl();
bkg_control.SetOpts(opts, json_params);
bfd_control.DefaultBeadfindControl();
bfd_control.SetOpts(opts, json_params);
img_control.DefaultImageOpts();
img_control.SetOpts(opts, json_params);
mod_control.SetOpts(opts, json_params);
loc_context.DefaultSpatialContext();
loc_context.SetOpts(opts, json_params);
flow_context.DefaultFlowFormula();
flow_context.SetOpts(opts, json_params);
key_context.DefaultKeys();
key_context.SetOpts(opts, json_params);
no_control.SetOpts(opts, json_params);
sys_context.DefaultSystemContext();
sys_context.SetOpts(opts, json_params);
flow_context.DefaultFlowFormula();
flow_context.SetOpts(opts, json_params);
bkg_control.DefaultBkgModelControl();
// Apparently flow_context does not have a member that gives me the total number of flows in a run, so I'm hard coding this baby!
bkg_control.SetOpts(opts, json_params, 100000);
bfd_control.DefaultBeadfindControl();
bfd_control.SetOpts(opts, json_params);
img_control.DefaultImageOpts();
img_control.SetOpts(opts, json_params);
mod_control.SetOpts(opts, json_params);
loc_context.DefaultSpatialContext();
loc_context.SetOpts(opts, json_params);
key_context.DefaultKeys();
key_context.SetOpts(opts, json_params);
no_control.SetOpts(opts, json_params);
sys_context.DefaultSystemContext();
sys_context.SetOpts(opts, json_params);

// We can only do save and restore on an even flow block boundary.
// Now that all the parameters have been set, we can check their sanity.
Expand Down Expand Up @@ -226,6 +227,7 @@ ValidateOpts::ValidateOpts()
// BeadfindControlOpts
m_opts["beadfind-type"] = VT_STRING;
m_opts["use-beadmask"] = VT_STRING;
m_opts["exclusion-mask"] = VT_STRING;
m_opts["beadmask-categorized"] = VT_BOOL;
m_opts["beadfind-basis"] = VT_STRING;
m_opts["beadfind-dat"] = VT_STRING;
Expand Down Expand Up @@ -437,6 +439,11 @@ void ValidateOpts::Validate(const int argc, char *argv[])
{
if((!isdigit(argv[i][1])) && (argv[i][1] != '.'))
{
if(s.length() > 2 && argv[i][1] != '-' && argv[i][2] != ' ' && argv[i][2] != '=') // handle mis-typing long option to short option
{
fprintf ( stdout, "WARNING: %s may miss a leading - . Please check if it is a long option.\n", s.c_str());
}

s = s.substr(1, s.length() - 1);
if(argv[i][1] == '-') // long option
{
Expand Down
Loading

0 comments on commit d19d969

Please sign in to comment.