<commit_before>echo -e \
"\n###########################################################
#  
#  CHROMOSOME SORT ORDER AND NAMING CONVENTIONS 
#
###########################################################\n"


BT=${BT-../../../bin/bedtools}

FAILURES=0;

check()
{
	if diff $1 $2; then
    	echo ok
	else
    	FAILURES=$(expr $FAILURES + 1);
		echo fail
	fi
}

###########################################################
#  Test query against DB with reverse order
############################################################
echo -e "    intersect.t01...\c"
echo \
"ERROR: chromomsome sort ordering for file sq1.bed is inconsistent with other files. Record was:
chr12	10	20" > exp
$BT intersect -a sq1.bed -b sdb1.bed -sorted 2>&1 > /dev/null | cat - > obs
check obs exp
rm obs


###########################################################
#  Test query with 2dbs, one of which is out of order
############################################################
echo -e "    intersect.t02...\c"
echo \
"ERROR: Sort order was unspecified, and file q1a_num.bed is not sorted lexicographically.
       Please re-reun with the -g option for a genome file.
       See documentation for details." > exp
$BT intersect -a q1a_num.bed -b db1_num.bed db2_numBackwards.bed -sorted 2>&1 > /dev/null | cat - > obs
check obs exp
rm obs


###########################################################
#  Test query with 3dbs, one of which is out of order
############################################################
echo -e "    intersect.t03...\c"
echo \
"ERROR: Sort order was unspecified, and file db3_numBackwards.bed is not sorted lexicographically.
       Please re-reun with the -g option for a genome file.
       See documentation for details." > exp
$BT intersect -a q1a_num.bed -b db1_num.bed db2_num.bed db3_numBackwards.bed -sorted 2>&1 > /dev/null | cat - > obs
check obs exp
rm obs


###########################################################
#  Test query with 2 dbs, one of which has a chrom 
#  that the query does not
############################################################
echo -e "    intersect.t04...\c"
echo \
"ERROR: Database file db1_num.bed contains chromosome chr3, but the query file does not.<commit_msg>Fixed typo:  're-reun' should be 'rerun'<commit_after>echo -e \
"\n###########################################################
#  
#  CHROMOSOME SORT ORDER AND NAMING CONVENTIONS 
#
###########################################################\n"


BT=${BT-../../../bin/bedtools}

FAILURES=0;

check()
{
	if diff $1 $2; then
    	echo ok
	else
    	FAILURES=$(expr $FAILURES + 1);
		echo fail
	fi
}

###########################################################
#  Test query against DB with reverse order
############################################################
echo -e "    intersect.t01...\c"
echo \
"ERROR: chromomsome sort ordering for file sq1.bed is inconsistent with other files. Record was:
chr12	10	20" > exp
$BT intersect -a sq1.bed -b sdb1.bed -sorted 2>&1 > /dev/null | cat - > obs
check obs exp
rm obs


###########################################################
#  Test query with 2dbs, one of which is out of order
############################################################
echo -e "    intersect.t02...\c"
echo \
"ERROR: Sort order was unspecified, and file q1a_num.bed is not sorted lexicographically.
       Please rerun with the -g option for a genome file.
       See documentation for details." > exp
$BT intersect -a q1a_num.bed -b db1_num.bed db2_numBackwards.bed -sorted 2>&1 > /dev/null | cat - > obs
check obs exp
rm obs


###########################################################
#  Test query with 3dbs, one of which is out of order
############################################################
echo -e "    intersect.t03...\c"
echo \
"ERROR: Sort order was unspecified, and file db3_numBackwards.bed is not sorted lexicographically.
       Please re-reun with the -g option for a genome file.
       See documentation for details." > exp
$BT intersect -a q1a_num.bed -b db1_num.bed db2_num.bed db3_numBackwards.bed -sorted 2>&1 > /dev/null | cat - > obs
check obs exp
rm obs


###########################################################
#  Test query with 2 dbs, one of which has a chrom 
#  that the query does not
############################################################
echo -e "    intersect.t04...\c"
echo \
"ERROR: Database file db1_num.bed contains chromosome chr3, but the query file does not.
{'fraction_non_alphanumeric': 0.3424657534246575, 'fraction_numerical': 0.01841455198742421, 'mean_word_length': 4.161066048667439, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1786054', 'n_tokens_mistral': 1331, 'n_tokens_neox': 1228, 'n_words': 452}