Commit 78c266dc authored by Neil Kindlon's avatar Neil Kindlon
Browse files

Fixed bug for -nonamecheck, added help, unit test

parent 33577de0
......@@ -134,6 +134,9 @@ void intersect_help(void) {
cerr << "\t-sortout\t" << "When using multiple databases, sort the output DB hits" << endl;
cerr << "\t\t\tfor each record." << endl << endl;
cerr << "\t-nonamecheck\t" << "For sorted data, don't throw an error if the file has different naming conventions" << endl;
cerr << "\t\t\tfor the same chromosome. ex. \"chr1\" vs \"chr01\"." << endl << endl;
CommonHelp();
cerr << "Notes: " << endl;
......
......@@ -199,7 +199,7 @@ bool ContextBase::parseCmdArgs(int argc, char **argv, int skipFirstArgs) {
if (!handle_sortout()) return false;
}
else if (strcmp(_argv[_i], "-nonamecheck") == 0) {
if (!handle_sortout()) return false;
if (!handle_nonamecheck()) return false;
}
}
......
......@@ -168,6 +168,10 @@ bool ContextIntersect::isValidState()
if (_files.size() < 2 ) {
return false;
}
if (!getSortedInput() && getNameCheckDisabled()) {
_errorMsg = "\n***** ERROR: -nonamecheck option is only valid for sorted input. *****";
return false;
}
return true;
}
......
......@@ -536,6 +536,36 @@ $BT intersect -a bug187_a.bed -b bug187_b.bed -wao > obs
check exp obs
rm exp obs
##################################################################
# see that -nonamecheck only works for sorted data
##################################################################
echo " intersect.t44...\c"
echo \
"***** ERROR: -nonamecheck option is only valid for sorted input. *****" > exp
$BT intersect -a nonamecheck_a.bed -b nonamecheck_b.bed -nonamecheck 2>&1 > /dev/null | cat - | head -2 | tail -1 > obs
check exp obs
rm exp obs
##################################################################
# see that differently named chroms don't work with -sorted
##################################################################
echo " intersect.t45...\c"
echo \
"ERROR: File nonamecheck_b.bed has a record where naming convention (leading zero) is inconsistent with other files:
chr01 15 25" > exp
$BT intersect -a nonamecheck_a.bed -b nonamecheck_b.bed -sorted 2>&1 > /dev/null | cat - > obs
check exp obs
rm exp obs
##################################################################
# see that differently named chroms -sorted and -nonamecheck
# don't complain
##################################################################
echo " intersect.t46...\c"
touch exp
$BT intersect -a nonamecheck_a.bed -b nonamecheck_b.bed -sorted -nonamecheck 2>&1 > /dev/null | cat - > obs
check exp obs
rm exp obs
cd multi_intersect
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment