MCPcopy Create free account
hub / github.com/OpenGene/fastp / validate

Method validate

src/options.cpp:85–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85bool Options::validate() {
86 if(in1.empty()) {
87 if(!in2.empty())
88 error_exit("read2 input is specified by <in2>, but read1 input is not specified by <in1>");
89 if(inputFromSTDIN)
90 in1 = "/dev/stdin";
91 else
92 error_exit("read1 input should be specified by --in1, or enable --stdin if you want to read STDIN");
93 } else {
94 check_file_valid(in1);
95 }
96
97 if(!in2.empty()) {
98 check_file_valid(in2);
99 }
100
101 if(outputToSTDOUT) {
102 if(!out1.empty()) {
103 cerr << "In STDOUT mode, ignore the out1 filename " << out1 << endl;
104 out1 = "";
105 }
106 if(!out2.empty()) {
107 cerr << "In STDOUT mode, ignore the out2 filename " << out2 << endl;
108 out2 = "";
109 }
110 }
111
112 if(merge.enabled) {
113 if(split.enabled) {
114 error_exit("splitting mode cannot work with merging mode");
115 }
116 if(in2.empty() && !interleavedInput) {
117 error_exit("read2 input should be specified by --in2 for merging mode");
118 }
119 // enable correction if it's not enabled
120 if(!correction.enabled)
121 correction.enabled = true;
122 if(merge.out.empty() && !outputToSTDOUT && !out1.empty() && out2.empty()) {
123 cerr << "You specified --out1, but haven't specified --merged_out in merging mode. Using --out1 to store the merged reads to be compatible with fastp 0.19.8" << endl << endl;
124 merge.out = out1;
125 out1 = "";
126 }
127 if(merge.includeUnmerged) {
128 if(!out1.empty()) {
129 cerr << "You specified --include_unmerged in merging mode. Ignoring argument --out1 = " << out1 << endl;
130 out1 = "";
131 }
132 if(!out2.empty()) {
133 cerr << "You specified --include_unmerged in merging mode. Ignoring argument --out2 = " << out2 << endl;
134 out2 = "";
135 }
136 if(!unpaired1.empty()) {
137 cerr << "You specified --include_unmerged in merging mode. Ignoring argument --unpaired1 = " << unpaired1 << endl;
138 unpaired1 = "";
139 }
140 if(!unpaired2.empty()) {
141 cerr << "You specified --include_unmerged in merging mode. Ignoring argument --unpaired1 = " << unpaired2 << endl;
142 unpaired2 = "";

Callers 1

mainFunction · 0.80

Calls 4

error_exitFunction · 0.85
check_file_validFunction · 0.85
file_existsFunction · 0.85
lengthMethod · 0.45

Tested by

no test coverage detected