-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRunControlParameterFile.cpp
More file actions
executable file
·1206 lines (1157 loc) · 42.9 KB
/
RunControlParameterFile.cpp
File metadata and controls
executable file
·1206 lines (1157 loc) · 42.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* RunControlParameterFile.cpp
* cnv
*
* Created by Chip Stewart on 10/24/07.
* Copyright 2007 Boston College. All rights reserved.
*
*/
#include "RunControlParameterFile.h"
// list of stuff to trim at ends of parameter strings
string SPACES=" \t\r\n\"";
// string trim utility functions
inline string trim_right (const string & s, const string & t = SPACES)
{
string d (s);
string::size_type i (d.find_last_not_of (t));
if (i == string::npos) {
return "";
} else {
return d.erase (d.find_last_not_of (t) + 1) ;
}
} // end of trim_right
inline string trim_left (const string & s, const string & t = SPACES)
{
string d (s);
return d.erase (0, s.find_first_not_of (t)) ;
} // end of trim_left
inline string trim (const string & s, const string & t = SPACES)
{
string d (s);
return trim_left (trim_right (d, t), t) ;
} // end of trim
// constructor with default parameters
RunControlParameters::RunControlParameters() {
RunControlParameters p1("none");
*this = p1;
}
// constructor loading from file
RunControlParameters::RunControlParameters( const string & filename)
{
// defaults
// Regex split by "/"
string patternSplit1("^(\\S+)/(\\S+)");
patternSplit=patternSplit1;
// defaults
setFragmentLengthWindow(99.9); // anything outside of window considered for SV
setFragmentLengthLo(10.0); // anything of LF less than this is odd
setFragmentLengthHi(10000.0); // anything of LF greater than this is also odd
setFragmentLength(200.0); // nominal LF - for breakpoint determination
setMinClustered(2); // min number of confirming fragments for SV candidate
setMinClusteredRetro(2); // min number of confirming fragments for Mobi candidate
setClusteringLength(100); // spatial scale (bp units) for clustering
setClusteringLengthRetro(60);// spatial scale (bp units) for clustering un-paired reads for insertions
setDepthLo(0.5); // region with DofC/nominal less than this considered as deletion
setDepthHi(1.5); // region with DofC/nominal greater than this considered as duplication
setMinLength(1); // mimum event length
setParameterFile("none");
setReadPairSenseConfig(0);
setDoInsertions(false); // turn off insertion detector until it works better
setPrintTextOut(false); // Print Text Outout
setDoScanOnly(false); // limit processing to scan -only
setSpannerMode(1); // limit processing parse aligment files to build span files
setReadSetRegex(".");
setReadIDRegex("^(\\S+)");
setReadNumberRegex("./(\\d)$");
setReadEnds("./.");
setReferenceFastaFile("");
setAllowContigsRegex(".");
setMaxFragments(INT_MAX);
setOutputDir(".");
setPrefix("");
setAnchorfile("");
setWriteDepth(false);
setMaxMisMatches(1000);
setFractionMaxMisMatches(float(1.0));
setMinReadLength(1);
setRDreferenceFile("");
setDepthBinSize(1000);
setRDminMedian(40);
setRDminExp(0.8);
setRDmaxGap(100);
setRDallow(5);
setRDminbin(5);
setDoMasking(false);
setQmin(20);
setCNslosh(0);
setDupRemove(1);
//setDoRepeatCheck(true);
string mobs[] = {"moblist_ALU","moblist_L1","moblist_SVA","moblist_ERV"};
vector<string> mobv(mobs, mobs + 4);
setMobileElements(mobv);
setMobiMaskFile("");
setBamZA(0);
// Regex Fragment Length Window
spatternFLWIN="FragmentLengthWindow";
// Regex Fragment Length Low
spatternFLLO="FragmentLengthLo";
// Regex Fragment Length High
spatternFLHI="FragmentLengthHi";
// Regex Depth Low
spatternDPLO="DepthCoverageRatioLo";
// Regex Fragment Length High
spatternDPHI="DepthCoverageRatioHi";
// Regex Fragment Length Nominal
spatternFL="FragmentLengthNominal";
// Regex Min Clustered size
spatternMinClus="MinClustered";
// Regex Min Clustered size for insertions
spatternMinClusIns="MinClusteredRetroertions";
// Regex Clustering Length
spatternClusLen="ClusteringLength";
// Regex Clustering Length for Insertions
spatternClusLenIns="ClusteringLengthRetroertsions";
// Regex Minimum event length
spatternMinLength="MinEventLength";
// Regex Read Set Label in Read Name
spatternReadSet="ReadSetRegex";
// Regex Read ID in Read Name
spatternReadID="ReadIDRegex";
// Regex Read Number in Read Name
spatternReadNumber="ReadNumberRegex";
// Regex Read End swap string
spatternReadEnds="ReadEndSwap";
// Regex Paired Read default orientiation (short solexa false, long true)
spatternReadPairSenseConfig="ReadPairSenseConfig";
// Regex do insertion detection
spatternDoInsertion="DoInsertionDetection";
// ReferenceFastaFile fasta file full path name
spatternReferenceFastaFile="ReferenceFastaFile";
// Output area
spatternOutputDir="OutputDir";
// Output file prefix
spatternPrefix="Prefix";
// specify regexp for allowed contig names
spatternAllowContigsRegex="AllowContigsRegex";
// specify maximum number of fragments to process
spatternMaxFragments="MaxFragments";
// Regex do PrintTextOut
spatternPrintTextOut="DoPrintTextOut";
// Regex do scan only
spatternDoScanOnly="DoScanOnly";
// Regex anchorfile
spatternAnchorfile="Anchorfile";
// Regex do scan only
spatternWriteDepth="WriteDepthOfCoverageFiles";
// Regex maximum number of mismatches
spatternMaxMisMatches="MaximumNumberOfMismatches";
// Regex fractional maximum number of mismatches
spatternFractionMaxMisMatches="FractionalMaximumNumberOfMismatches";
// Regex minimum read length
spatternMinReadLength="MinimumReadLength";
// Regex RDreference filename
spatternRDreferenceFile="RDreferenceFile";
// Regex Depth bin size
spatternDepthBinSize="DepthBinSize";
// Regex RDminMedian minimum median read count per bin
spatternRDminMedian="RDminMedian";
// Regex RDminExp minimum expected read count per bin
spatternRDminExp="RDminExp";
// Regex DoMasking
spatternDoMasking="DoMasking";
// Regex Maximum gap in contiguous bins for 1 CNV
spatternRDmaxGap="RDmaxGap";
// Regex Number of allowed CNV per chromsome w/o chisq penalty
spatternRDallow="RDallow";
// Regex Minium number of coverage bins in a CNV
spatternRDminbin="RDminbin";
// Regex Minium Q map value
spatternQmin="Qmin";
// Regex PE CNV slosh
spatternCNslosh="CNslosh";
// Regex duplicate removal
spatternDupRemove="DupRemove";
// Regex do repeat
spatternDoRepeatCheck="DoRepeatCheck";
// Regex Mobile elements
spatternDoRepeatCheck="MobileElements";
// Regex Mobile Mask
spatternMobiMaskFile="MobiMaskFile";
// Regex Bam ZA
spatternBamZA="BamZA";
// list of stuff to trim at ends of parameter strings
SPACES=" \t\r\n\"";
// regex stuff to parse parameter file
string patternFLWIN("^"+spatternFLWIN+"=(\\S+)");
string patternFLLO("^"+spatternFLLO+"=(\\S+)");
string patternFLHI("^"+spatternFLHI+"=(\\S+)");
string patternDPLO("^"+spatternDPLO+"=(\\S+)");
string patternDPHI("^"+spatternDPHI+"=(\\S+)");
string patternFL("^"+spatternFL+"=(\\S+)");
string patternMinClus("^"+spatternMinClus+"=(\\d+)");
string patternMinClusIns("^"+spatternMinClusIns+"=(\\d+)");
string patternClusLen("^"+spatternClusLen +"=(\\d+)");
string patternClusLenIns("^"+spatternClusLenIns+"=(\\d+)");
string patternReadSet("^"+spatternReadSet+"=""(\\S+)""");
string patternReadID("^"+spatternReadID+"=""(\\S+)""");
string patternReadNumber("^"+spatternReadNumber+"=""(\\S+)""");
string patternReadEnds("^"+spatternReadEnds+"=""(\\S+)""");
string patternReadPairSenseConfig("^"+spatternReadPairSenseConfig+"=""(\\d+)""");
string patternDoInsertion("^"+spatternDoInsertion+"=""(\\S+)""");
string patternReferenceFastaFile("^"+spatternReferenceFastaFile+"=""(\\S+)""");
string patternOutputDir("^"+spatternOutputDir+"=""(\\S+)""");
string patternPrefix("^"+spatternPrefix+"=""(\\S+)""");
string patternAllowContigsRegex("^"+spatternAllowContigsRegex+"=(\\S+)");
string patternMaxFragments("^"+spatternMaxFragments+"=(\\S+)");
string patternPrintTextOut("^"+spatternPrintTextOut+"=(\\S+)");
string patternDoScanOnly("^"+spatternDoScanOnly+"=(\\S+)");
string patternAnchorfile("^"+spatternAnchorfile+"=""(\\S+)""");
string patternWriteDepth("^"+spatternWriteDepth+"=(\\S+)");
string patternMinLength("^"+spatternMinLength+"=(\\d+)");
string patternMaxMisMatches("^"+spatternMaxMisMatches+"=(\\d+)");
string patternFractionMaxMisMatches("^"+spatternFractionMaxMisMatches+"=([-+]?[0-9]*\\.?[0-9]*)");
string patternMinReadLength("^"+spatternMinReadLength+"=(\\d+)");
string patternRDreferenceFile("^"+spatternRDreferenceFile+"=(\\S+)");
string patternDepthBinSize("^"+spatternDepthBinSize+"=(\\d+)");
string patternRDminMedian("^"+spatternRDminMedian+"=(\\d+)");
string patternRDminExp("^"+spatternRDminExp+"=(\\d+)");
string patternDoMasking("^"+spatternDoMasking+"=(\\d+)");
string patternRDmaxGap("^"+spatternRDmaxGap+"=(\\d+)");
string patternRDallow("^"+spatternRDallow+"=(\\d+)");
string patternRDminbin("^"+spatternRDminbin+"=(\\d+)");
string patternQmin("^"+spatternQmin+"=(\\d+)");
string patternCNslosh("^"+spatternCNslosh+"=(\\d+)");
string patternDupRemove("^"+spatternDupRemove+"=(\\d+)");
string patternDoRepeatCheck("^"+spatternDoRepeatCheck+"=(\\S+)");
string patternMobileElements("^"+spatternMobileElements+"=(\\S+)");
string patternMobiMaskFile("^"+spatternMobiMaskFile+"=(\\S+)");
string patternBamZA("^"+spatternBamZA+"=(\\d+)");
//
if (filename=="none") {
return;
}
// open input parameter file
ifstream par1(this->ParameterFile.c_str(), ios::in);
// check
if (!par1) {
cerr << "Unable to open RCP file: " << filename << endl;
exit(1);
}
// define RCP input line
string line;
// read through RCP file
while (getline(par1, line)) {
//--------------------------------------------------------------------------
// load parameters from specified rcp file
//--------------------------------------------------------------------------
if (RE2::FullMatch(line.c_str(),patternFLWIN.c_str(),&match)) {
setFragmentLengthWindow(string2Double(match));
} else if (RE2::FullMatch(line.c_str(),patternFLLO.c_str(),&match) ) {
setFragmentLengthLo(string2Double(match));
} else if (RE2::FullMatch(line.c_str(),patternFLHI.c_str(),&match) ) {
setFragmentLengthHi(string2Double(match));
} else if (RE2::FullMatch(line.c_str(),patternDPLO.c_str(),&match) ) {
setDepthLo(string2Double(match));
} else if (RE2::FullMatch(line.c_str(),patternDPHI.c_str(),&match) ) {
setDepthHi(string2Double(match));
} else if (RE2::FullMatch(line.c_str(),patternFL.c_str(),&match) ) {
setFragmentLength(string2Double(match));
} else if (RE2::FullMatch(line.c_str(),patternMinClus.c_str(),&match) ) {
setMinClustered(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternMinClusIns.c_str(),&match) ) {
setMinClusteredRetro(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternClusLen.c_str(),&match) ) {
setClusteringLength(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternClusLenIns.c_str(),&match) ) {
setClusteringLengthRetro(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternReadSet.c_str(),&match) ) {
string s = trim(match);
setReadSetRegex(s);
} else if (RE2::FullMatch(line.c_str(),patternReadID.c_str(),&match) ) {
string s = trim(match);
setReadIDRegex(s);
} else if (RE2::FullMatch(line.c_str(),patternReadNumber.c_str(),&match) ) {
string s = trim(match);
setReadNumberRegex(s);
} else if (RE2::FullMatch(line.c_str(),patternReadEnds.c_str(),&match) ) {
string s = trim(match);
setReadEnds(s);
} else if (RE2::FullMatch(line.c_str(),patternReferenceFastaFile.c_str(),&match) ) {
string s = trim(match);
setReferenceFastaFile(s);
} else if (RE2::FullMatch(line.c_str(),patternOutputDir.c_str(),&match) ) {
string s = trim(match);
setOutputDir(s);
} else if (RE2::FullMatch(line.c_str(),patternPrefix.c_str(),&match) ) {
string s = trim(match);
setPrefix(s);
} else if (RE2::FullMatch(line.c_str(),patternAllowContigsRegex.c_str(),&match) ) {
string s = trim(match);
setAllowContigsRegex(s);
} else if (RE2::FullMatch(line.c_str(),patternMaxFragments.c_str(),&match) ) {
setMaxFragments(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternReadPairSenseConfig.c_str(),&match) ) {
setReadPairSenseConfig(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternDoInsertion.c_str(),&match) ) {
string s = trim(match);
bool ins1=toupper(s.at(0))=='T';
setDoInsertions(ins1);
} else if (RE2::FullMatch(line.c_str(),patternPrintTextOut.c_str(),&match) ) {
string s = trim(match);
bool ins1=toupper(s.at(0))=='T';
setPrintTextOut(ins1);
} else if (RE2::FullMatch(line.c_str(),patternDoScanOnly.c_str(),&match) ) {
string s = trim(match);
bool ins1=toupper(s.at(0))=='T';
setDoScanOnly(ins1);
} else if (RE2::FullMatch(line.c_str(),patternAnchorfile.c_str(),&match) ) {
string s = trim(match);
setAnchorfile(s);
} else if (RE2::FullMatch(line.c_str(),patternMinLength.c_str(),&match) ) {
setMinLength(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternMaxMisMatches.c_str(),&match) ) {
setMaxMisMatches(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternFractionMaxMisMatches.c_str(),&match) ) {
setFractionMaxMisMatches((float)string2Double(match));
} else if (RE2::FullMatch(line.c_str(),patternMinReadLength.c_str(),&match) ) {
setMinReadLength(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternRDreferenceFile.c_str(),&match) ) {
setRDreferenceFile(match);
} else if (RE2::FullMatch(line.c_str(),patternDepthBinSize.c_str(),&match) ) {
setDepthBinSize(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternWriteDepth.c_str(),&match) ) {
string s = trim(match);
bool ins1=toupper(s.at(0))=='T';
setWriteDepth(ins1);
} else if (RE2::FullMatch(line.c_str(),patternRDminMedian.c_str(),&match) ) {
setRDminMedian(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternRDminExp.c_str(),&match) ) {
setRDminExp(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternDoMasking.c_str(),&match) ) {
string s = trim(match);
bool m1=toupper(s.at(0))=='T';
setDoMasking(m1);
} else if (RE2::FullMatch(line.c_str(),patternRDminbin.c_str(),&match) ) {
setRDminbin(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternRDmaxGap.c_str(),&match) ) {
setRDmaxGap(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternQmin.c_str(),&match) ) {
setQmin(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternCNslosh.c_str(),&match) ) {
setCNslosh(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternDupRemove.c_str(),&match) ) {
setDupRemove(string2Int(match));
} else if (RE2::FullMatch(line.c_str(),patternRDallow.c_str(),&match) ) {
setRDallow(string2Int(match));
} /* else if (RE2::FullMatch(line.c_str(),patternDoRepeatCheck.c_str(),&match) ) {
string s = trim(match);
bool m1=toupper(s.at(0))=='T';
setDoRepeatCheck(m1);
} */
else if (RE2::FullMatch(line.c_str(),patternMobileElements.c_str(),&match) ) {
string s = trim(match);
vector<string> me;
//int Nme =
split(me,s,",");
setMobileElements(me);
} else if (RE2::FullMatch(line.c_str(),patternMobiMaskFile.c_str(),&match) ) {
string s = trim(match);
setMobiMaskFile(s);
} else if (RE2::FullMatch(line.c_str(),patternBamZA.c_str(),&match) ) {
setBamZA(string2Int(match));
}
}
}
RunControlParameters& RunControlParameters::operator=(const RunControlParameters &rhs)
{
ParameterFile=rhs.ParameterFile; // file name
FragmentLengthWindow=rhs.FragmentLengthWindow; // fragment length window in %
FragmentLengthLo=rhs.FragmentLengthLo; // low fragment length
FragmentLengthHi=rhs.FragmentLengthHi; // high fragment length
FragmentLength=rhs.FragmentLength; // nominal fragment length
MinClustered=rhs.MinClustered; // minumum reads in cluster
ClusteringLength=rhs.ClusteringLength; // return cluster length parameter
DepthLo=rhs.DepthLo; // threshold low depth of coverage to consider for CNV
DepthHi=rhs.DepthHi; // threshold high depth of coverage to consider for CNV
dbg=rhs.dbg; // debug level
MaxFragments=rhs.MaxFragments; // stop loading alignments after this many reads from each end
ReadSetRegex=rhs.ReadSetRegex; // Pair Set Name Regex string
ReadIDRegex=rhs.ReadIDRegex; // Pair ID Regex string
ReadNumberRegex=rhs.ReadNumberRegex; // Pair Number Regex string
ReadEnd1=rhs.ReadEnd1; // Pair End 1 string
ReadEnd2=rhs.ReadEnd2; // Pair End 2 string
AllowContigsRegex=rhs.AllowContigsRegex; // only process contigs with names consistent with this regex
ReadPairSenseConfig=rhs.ReadPairSenseConfig; // True if DNA sense if flipped within a paired-end
ReferenceFastaFile=rhs.ReferenceFastaFile; // Fasta reference file
doInsertions=rhs.doInsertions; // switch for Insertion detector
ClusteringLengthRetro=rhs.ClusteringLengthRetro; // return cluster length parameter for insertions
MinClusteredRetro=rhs.MinClusteredRetro; // minumum reads in cluster for insertions
doPrintTextOut=rhs.doPrintTextOut; // switch for text output
doScanOnly=rhs.doScanOnly; // switch for scanning input files for fragment length only
OutputDir=rhs.OutputDir; // name of output directory
Prefix=rhs.Prefix; // prefix in name of output files
Anchorfile=rhs.Anchorfile; // Anchor info file
writeDepth=rhs.writeDepth;
SpannerMode=rhs.SpannerMode;
HistoGroups=rhs.HistoGroups;
MinLength=rhs.MinLength; // minumum event length
MaxMisMatches=rhs.MaxMisMatches; // maximum number of mismatches
FractionMaxMisMatches=rhs.FractionMaxMisMatches; // fractional maximum number of mismatches
MinReadLength=rhs.MinReadLength; // minimum read length
RDreferenceFile=rhs.RDreferenceFile;
DepthBinSize=rhs.DepthBinSize;
RDminMedian=rhs.RDminMedian;
RDminExp=rhs.RDminExp;
doMasking=rhs.doMasking;
RDmaxGap=rhs.RDmaxGap;
RDminbin=rhs.RDminbin;
Qmin=rhs.Qmin;
CNslosh=rhs.CNslosh;
DupRemove=rhs.DupRemove;
RDallow=rhs.RDallow;
doRepeatCheck=rhs.doRepeatCheck;
MobileElements=rhs.MobileElements;
MobiMaskFile=rhs.MobiMaskFile;
BamZA=rhs.BamZA;
return *this;
}
// return parameter file name
string RunControlParameters::getParameterFile() const
{
return ParameterFile;
}
// return low fragment length
double RunControlParameters::getFragmentLengthWindow() const
{
return FragmentLengthWindow;
}
// return low fragment length
double RunControlParameters::getFragmentLengthLo() const
{
return FragmentLengthLo;
}
// return high fragment length
double RunControlParameters::getFragmentLengthHi() const
{
return FragmentLengthHi;
}
// nominal fragment length
double RunControlParameters::getFragmentLength() const
{
return FragmentLength;
}
// return minumum reads in cluster
int RunControlParameters::getMinClustered() const
{
return MinClustered;
}
// return minumum reads in cluster for insertions
int RunControlParameters::getMinClusteredRetro() const
{
return MinClusteredRetro;
}
// return cluster length parameter
int RunControlParameters::getClusteringLength() const
{
return ClusteringLength;
}
// return cluster length parameter
int RunControlParameters::getClusteringLengthRetro() const
{
return ClusteringLengthRetro;
}
// return low depth ratio threshold
double RunControlParameters::getDepthLo() const
{
return DepthLo;
}
// return high depth threshold
double RunControlParameters::getDepthHi() const
{
return DepthHi;
}
// debug level
int RunControlParameters::getDbg() const
{
return dbg;
}
// regex expression for Read Set string
string RunControlParameters::getReadSetRegex() const
{
return ReadSetRegex;
}
// regex expression for Read ID string
string RunControlParameters::getReadIDRegex() const
{
return ReadIDRegex;
}
// get regex expression for Read Number string
string RunControlParameters::getReadNumberRegex() const
{
return ReadNumberRegex;
}
// set file name
void RunControlParameters::setParameterFile(const string & filename)
{
ParameterFile=filename;
}
// set Fragment Length Window
void RunControlParameters::setFragmentLengthWindow(const double FLW)
{
FragmentLengthWindow=FLW;
}
// set Fragment Length Low
void RunControlParameters::setFragmentLengthLo(const double FLL)
{
FragmentLengthLo=FLL;
}
// set Fragment Length High
void RunControlParameters::setFragmentLengthHi(const double FLH)
{
FragmentLengthHi=FLH;
}
// set nominal Fragment Length
void RunControlParameters::setFragmentLength(const double FL)
{
FragmentLength=FL;
}
// set minumum reads in cluster
void RunControlParameters::setMinClustered(const int MRC)
{
MinClustered=MRC;
}
// set minumum reads in cluster
void RunControlParameters::setMinClusteredRetro(const int MRC)
{
MinClusteredRetro=MRC;
}
// set cluster length parameter
void RunControlParameters::setClusteringLength(const int CL)
{
ClusteringLength=CL;
}
// set cluster length parameter for insertions
void RunControlParameters::setClusteringLengthRetro(const int CL)
{
ClusteringLengthRetro=CL;
}
// set Depth Low
void RunControlParameters::setDepthLo(const double DPL)
{
DepthLo=DPL;
}
// set Depth High
void RunControlParameters::setDepthHi(const double DPH)
{
DepthHi=DPH;
}
// set debug level
void RunControlParameters::setDbg(const int i)
{
dbg=i;
}
// set regex expression for Read Set string
void RunControlParameters::setReadSetRegex(const string & s)
{
ReadSetRegex=s;
}
// set regex expression for Read ID string
void RunControlParameters::setReadIDRegex(const string & s)
{
ReadIDRegex=s;
}
// set regex expression for Read Number string
void RunControlParameters::setReadNumberRegex(const string & s)
{
ReadNumberRegex=s;
}
// get expression for Read Number 1 swap string
string RunControlParameters::getReadEnd1() const
{
return ReadEnd1;
}
// get expression for Read Number 2 swap string
string RunControlParameters::getReadEnd2() const
{
return ReadEnd2;
}
// set expressions for Read swap strings
void RunControlParameters::setReadEnds(const string & s)
{
string match2;
if (RE2::FullMatch(s.c_str(),patternSplit.c_str(),&match,&match2) ) {
ReadEnd1=match;
ReadEnd2=match2;
}
}
// ReferenceFastaFile Fastafile name
string RunControlParameters::getReferenceFastaFile() const
{
return ReferenceFastaFile;
}
// set ReferenceFastaFile Fastafile name
void RunControlParameters::setReferenceFastaFile(const string & s)
{
ReferenceFastaFile=s;
}
// True if DNA sense if flipped within a paired-end
int RunControlParameters::getReadPairSenseConfig() const
{
return ReadPairSenseConfig;
}
void RunControlParameters::setReadPairSenseConfig(const int c1)
{
ReadPairSenseConfig=c1;
}
// run Insertion detector
bool RunControlParameters::getDoInsertions() const
{
return doInsertions;
}
void RunControlParameters::setDoInsertions(const bool ins1)
{
doInsertions = ins1;
}
// set regexp for allowed contigs
void RunControlParameters::setAllowContigsRegex(const string & s)
{
AllowContigsRegex=s;
}
// set regexp for allowed contigs
string RunControlParameters::getAllowContigsRegex() const
{
return AllowContigsRegex;
}
// set Max number of fragments
void RunControlParameters::setMaxFragments(const int i)
{
MaxFragments=i;
}
// get Max number of fragments
int RunControlParameters::getMaxFragments() const
{
return MaxFragments;
}
// scan only
bool RunControlParameters::getDoScanOnly() const
{
return doScanOnly;
}
void RunControlParameters::setDoScanOnly(const bool ins1)
{
doScanOnly = ins1;
}
// scan only
bool RunControlParameters::getPrintTextOut() const
{
return doPrintTextOut;
}
void RunControlParameters::setPrintTextOut(const bool pto1)
{
doPrintTextOut = pto1;
}
// output directory
string RunControlParameters::getOutputDir() const
{
return OutputDir;
}
void RunControlParameters::setOutputDir(const string & s)
{
OutputDir=s;
}
// output prefix
string RunControlParameters::getPrefix() const
{
return Prefix;
}
void RunControlParameters::setPrefix(const string & s)
{
Prefix=s;
}
C_HistoGroups RunControlParameters::getHistoGroups() const
{
return HistoGroups;
}
void RunControlParameters::setHistoGroups(const C_HistoGroups & h1)
{
HistoGroups = h1;
}
// Anchor info file
string RunControlParameters::getAnchorfile() const
{
return Anchorfile;
}
void RunControlParameters::setAnchorfile(const string & s)
{
Anchorfile=s;
}
// write depth files
bool RunControlParameters::getWriteDepth() const
{
return writeDepth;
}
void RunControlParameters::setWriteDepth(const bool ins1)
{
writeDepth = ins1;
}
// set minumum event length
void RunControlParameters::setMinLength(const int L)
{
MinLength=L;
}
int RunControlParameters::getMinLength() const
{
return MinLength;
}
// return depth bin size
int RunControlParameters::getDepthBinSize() const
{
return DepthBinSize;
}
// set minumum read length
void RunControlParameters::setDepthBinSize(const int b)
{
DepthBinSize=b;
}
// return minumum read length
int RunControlParameters::getMinReadLength() const
{
return MinReadLength;
}
void RunControlParameters::setMinReadLength(const int M)
{
MinReadLength=M;
}
// set maximum number of mismatches
void RunControlParameters::setMaxMisMatches(const int M)
{
MaxMisMatches=M;
}
// return maximum number of mismatches
int RunControlParameters::getMaxMisMatches() const
{
return MaxMisMatches;
}
// set fractional maximum number of mismatches
void RunControlParameters::setFractionMaxMisMatches(const float F)
{
FractionMaxMisMatches=F;
}
// return fractional maximum number of mismatches
float RunControlParameters::getFractionMaxMisMatches() const
{
return FractionMaxMisMatches;
}
// set RDreference Filename
void RunControlParameters::setRDreferenceFile(const string & S)
{
RDreferenceFile=S;
}
// return RDreference Filename
string RunControlParameters::getRDreferenceFile() const
{
return RDreferenceFile;
}
// return minumum median read counts per bin (rebin)
int RunControlParameters::getRDminMedian() const
{
return RDminMedian;
}
void RunControlParameters::setRDminMedian(const int M)
{
RDminMedian=M;
}
// return minumum expected read counts in each bin (clean)
float RunControlParameters::getRDminExp() const
{
return RDminExp;
}
void RunControlParameters::setRDminExp(const float M)
{
RDminExp=M;
}
// run Insertion detector
bool RunControlParameters::getDoMasking() const
{
return doMasking;
}
void RunControlParameters::setDoMasking(const bool m1)
{
doMasking = m1;
}
int RunControlParameters::getRDminbin() const
{
return RDminbin;
}
void RunControlParameters::setRDminbin(const int M)
{
RDminbin=M;
}
int RunControlParameters::getRDmaxGap() const
{
return RDmaxGap;
}
void RunControlParameters::setRDmaxGap(const int M)
{
RDmaxGap=M;
}
int RunControlParameters::getRDallow() const
{
return RDallow;
}
void RunControlParameters::setRDallow(const int M)
{
RDallow=M;
}
int RunControlParameters::getQmin() const
{
return Qmin;
}
void RunControlParameters::setQmin(const int M)
{
Qmin=M;
}
int RunControlParameters::getCNslosh() const
{
return CNslosh;
}
void RunControlParameters::setCNslosh(const int M)
{
CNslosh=M;
}
int RunControlParameters::getDupRemove() const
{
return DupRemove;
}
void RunControlParameters::setDupRemove(const int M)
{
DupRemove=M;
}
/*
bool RunControlParameters::getDoRepeatCheck() const
{
return doRepeatCheck;
}
void RunControlParameters::setDoRepeatCheck(const bool M)
{
doRepeatCheck=M;
}
*/
// set regexp for Mobile Elements list
void RunControlParameters::setMobileElements(const vector<string> & s)
{
MobileElements=s;
}
vector<string> RunControlParameters::getMobileElements() const
{
return MobileElements;
}
// set regexp for Mobile Elements list
void RunControlParameters::setMobiMaskFile(const string & s)
{
MobiMaskFile=s;
}
string RunControlParameters::getMobiMaskFile() const
{
return MobiMaskFile;
}
// set bam ZA tag required
void RunControlParameters::setBamZA(const int i)
{
BamZA=i;
}
// get Bam ZA required flag
int RunControlParameters::getBamZA() const
{
return BamZA;
}
// SPanner mode
int RunControlParameters::getSpannerMode() const
{
return SpannerMode;
}
void RunControlParameters::setSpannerMode(const int b1)
{
SpannerMode = b1;
}
/*
void RunControlParameters::setFragmentLengthLimits()
{
if (this->fragHist.Ntot==0) {
return;
}
// nominal mapping length stats
this->FragmentLength = fragHist.mode;
double lowf = (1.0-FragmentLengthWindow/100.0)/2.0; // half tail on low side
this->FragmentLengthLo = fragHist.p2xTrim(lowf);
double highf = (1.0-lowf); // half tail on high side
this->FragmentLengthHi = fragHist.p2xTrim(highf);
this->MinLength = 3*int(fragHist.std);
}
*/
ostream &operator<<(ostream &output, const RunControlParameters & p1)
{
string line = "//================================================";
char s[100];
int rc;
time_t temp;
struct tm *timeptr;
temp = time(NULL);
timeptr = localtime(&temp);
rc = strftime(s,sizeof(s),"%A, %b %d: %r", timeptr);
output << line << endl;
output << "// original file:\t " << p1.getParameterFile() << endl;
output << s << endl;
output << line << endl;
output << "// \tNominal fragment length: " << endl;
output << p1.spatternFL << "=" << p1.getFragmentLength() << endl;
output << "// \tLow fragment length: " << endl;
output << p1.spatternFLLO << "=" << p1.getFragmentLengthLo() << endl;
output << "// \tHigh fragment length: " << endl;
output << p1.spatternFLHI << "=" << p1.getFragmentLengthHi() << endl;
output << "// \tNominal fragment length window fraction: " << endl;
output << p1.spatternFLWIN << "=" << p1.getFragmentLengthWindow() << endl;
output << "// \tMin clustered: " << endl;
output << p1.spatternMinClus << "=" << p1.getMinClustered() << endl;
output << "// \tClustering length: " << endl;
output << p1.spatternClusLen << "=" << p1.getClusteringLength() << endl;
output << "//\tLow depth threshold: " << endl;
output << p1.spatternDPLO << "=" << p1.getDepthLo() << endl;
output << "//\tHigh depth threshold: " << endl;
output << p1.spatternDPHI << "=" << p1.getDepthHi() << endl;
output << "// \tMin length: " << endl;
output << p1.spatternMinLength << "=" << p1.getMinLength() << endl;
output << "// \tMaximum number of mismatches: " << endl;
output << p1.spatternMaxMisMatches << "=" << p1.getMaxMisMatches() << endl;
output << "// \tFractional Maximum number of mismatches: " << endl;
output << p1.spatternFractionMaxMisMatches << "=" << p1.getFractionMaxMisMatches() << endl;
output << "// \tMinimum Read length: " << endl;
output << p1.spatternMinReadLength << "=" << p1.getMinReadLength() << endl;
output << "//\tMaximum number of fragments: " << endl;
output << p1.spatternMaxFragments << "=" << p1.getMaxFragments() << endl;
output << "//\tPrintTextOut: " << endl;
output << p1.spatternPrintTextOut << "=" << (p1.getPrintTextOut()? "T": "F") << endl;
output << "//\tScan-only: " << endl;
output << p1.spatternDoScanOnly << "=" << (p1.getDoScanOnly()? "T": "F") << endl;
output << "//\tDetect Insertion SV events: " << endl;
output << p1.spatternDoInsertion << "=" << (p1.getDoInsertions()? "T": "F") << endl;
output << "//\tMask file: " << endl;
output << p1.spatternReferenceFastaFile << "=""" << p1.getReferenceFastaFile() << """" << endl;
output << "//\tRead set selection regex: " << endl;
output << p1.spatternReadSet << "=""" << p1.getReadSetRegex() << """" << endl;
output << "//\tRead ID regex: " << endl;
output << p1.spatternReadID << "=""" << p1.getReadIDRegex() << """" << endl;
output << "//\tRead number regex: " << endl;
output << p1.spatternReadNumber << "=""" << p1.getReadNumberRegex() << """" << endl;
output << "//\tRead-ends swap strings regex: " << endl;
output << p1.spatternReadEnds << "=""" << p1.getReadEnd1() <<"/"<< p1.getReadEnd2() << """" << endl;
output << "//\tAllowed contig names regex: " << endl;
output << p1.spatternAllowContigsRegex << "=""" << p1.getAllowContigsRegex() << """" << endl;
output << "//\tOutput area: " << endl;
output << p1.spatternOutputDir << "=""" << p1.getOutputDir() << """" << endl;
output << "//\tOutput file prefix: " << endl;
output << p1.spatternPrefix << "=""" << p1.getPrefix() << """" << endl;
output << "//\tAnchor file : " << endl;
output << p1.spatternAnchorfile << "=""" << p1.getAnchorfile() << """" << endl;
output << "//\tWrite Depth files: " << endl;