Skip to content
Snippets Groups Projects
Commit 0ac3897a authored by Aaron's avatar Aaron
Browse files

Merge branch 'google_test'

parents 9f2bb68f ecd4b527
Branches nkindlon-master2
No related tags found
No related merge requests found
......@@ -109,3 +109,8 @@ clean:
@rm -Rf $(BT_ROOT)/include
.PHONY: clean
test: all
@cd test; sh test.sh
.PHONY: test
......@@ -81,13 +81,12 @@ BedShuffle::~BedShuffle(void) {
void BedShuffle::Shuffle() {
BED bedEntry, nullBed; // used to store the current BED line from the BED file.
BED bedEntry;
_bed->Open();
while (_bed->GetNextBed(bedEntry)) {
if (_bed->_status == BED_VALID) {
ChooseLocus(bedEntry);
_bed->reportBedNewLine(bedEntry);
bedEntry = nullBed;
}
}
_bed->Close();
......@@ -97,8 +96,7 @@ void BedShuffle::Shuffle() {
void BedShuffle::ShuffleWithExclusions() {
BED bedEntry, nullBed; // used to store the current BED line from the BED file.
BED bedEntry;
_bed->Open();
while (_bed->GetNextBed(bedEntry)) {
if (_bed->_status == BED_VALID) {
......@@ -124,7 +122,6 @@ void BedShuffle::ShuffleWithExclusions() {
_bed->reportBedNewLine(bedEntry);
}
}
bedEntry = nullBed;
}
_bed->Close();
}
......
chr1 10 20
chr1 30 40
chr1 10 20
chr1 30 40
chr1 10 20
chr1 30 40
check()
{
if diff $1 $2; then
echo ok
else
echo fail
fi
}
echo " intersect.t1 self intersect...\c"
../../bin/bedtools intersect -a a.bed -b a.bed > obs
check obs intersect.t1.exp
chr1 10 20
chr1 30 40
chr1 40 50
chr1 45 100
chr1 10 20 a1
chr1 30 40 a2
chr1 40 50 a3
chr1 45 100 a4
BT=../../bin/bedtools
check()
{
if diff $1 $2; then
echo ok
return 1
else
echo fail
return 0
fi
}
# cat a.bed
# chr1 10 20
# chr1 30 40
# chr1 40 50
# chr1 45 100
###########################################################
# Test #1
# Test a basic merge; one interval should be un-merged,
# the other two should be merged.
###########################################################
echo " merge.t1...\c"
echo \
"chr1 10 20
chr1 30 100" > exp
$BT merge -i a.bed > obs
check obs exp
rm obs exp
###########################################################
# Test #2
# Enforce coordinate sorted input.
###########################################################
echo " merge.t2...\c"
tac a.bed | $BT merge -i - 2> obs
echo "ERROR: input file: (-) is not sorted by chrom then start.
The start coordinate at line 3 is less than the start at line 2" > exp
check obs exp
rm obs exp
###########################################################
# Test #3
# Test the counting of merged intervals. (-n)
###########################################################
echo " merge.t3...\c"
echo \
"chr1 10 20 1
chr1 30 100 3" > exp
$BT merge -i a.bed -n > obs
check obs exp
rm obs exp
###########################################################
# Test #4
# Test the listing of names from merged intervals. (-nms)
# a.bed should fail, as there is no name field
###########################################################
echo " merge.t4...\c"
echo \
"chr1 10 20
*****
*****ERROR: No names found to report for the -names option. Exiting.
*****" > exp
$BT merge -i a.bed -nms &> obs
check obs exp
rm obs exp
###########################################################
# Test #5
# Test the listing of names from merged intervals. (-nms)
# a.named.bed should work, as there are name fields
#
# cat a.names.bed
# chr1 10 20 a1
# chr1 30 40 a2
# chr1 40 50 a3
# chr1 45 100 a4
###########################################################
echo " merge.t5...\c"
echo \
"chr1 10 20 a1
chr1 30 100 a2;a3;a4" > exp
$BT merge -i a.names.bed -nms > obs
check obs exp
rm obs exp
\ No newline at end of file
echo " Testing bedtools intersect:"
cd intersect
sh test-intersect.sh
cd ..
echo " Testing bedtools merge:"
cd merge
sh test-merge.sh
cd ..
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment