Commit 939d5390 authored by Aaron's avatar Aaron
Browse files

Cleaned up groupBy and unionBedFiles.

parent 2ff5a753
......@@ -37,6 +37,7 @@ SUBDIRS = $(SRC_DIR)/bamToBed \
UTIL_SUBDIRS = $(SRC_DIR)/utils/lineFileUtilities \
$(SRC_DIR)/utils/bedFile \
$(SRC_DIR)/utils/bedGraphFile \
$(SRC_DIR)/utils/tabFile \
$(SRC_DIR)/utils/genomeFile \
$(SRC_DIR)/utils/gzstream \
......
......@@ -185,27 +185,26 @@ void ShowHelp(void) {
cerr << "\t-grp\t" << "Specify the columns (1-based) for the grouping." << endl;
cerr << "\t\tThe columns must be comma separated." << endl;
cerr << "\t\tDefault: 1,2,3" << endl << endl;
cerr << "\t\t- Default: 1,2,3" << endl << endl;
cerr << "\t-opCol\t" << "Specify the column (1-based) that should be summarized." << endl;
cerr << "\t\tRequired." << endl << endl;
cerr << "\t-opCols\t" << "Specify the column (1-based) that should be summarized." << endl;
cerr << "\t\t- Required." << endl << endl;
cerr << "\t-op\t" << "Specify the operation that should be applied to opCol." << endl;
cerr << "\t-ops\t" << "Specify the operation that should be applied to opCol." << endl;
cerr << "\t\tValid operations: sum, count, min, max, mean, median," << endl;
cerr << "\t\tmode, antimode, stdev, collapse (i.e., print a comma separated list)" << endl;
cerr << "\t\tDefault: sum" << endl;
cerr << "\t\tmode, antimode, stdev, sstdev (sample standard dev.), and" << endl;
cerr << "\t\tcollapse (i.e., print a comma separated list)" << endl;
cerr << "\t\t- Default: sum" << endl << endl;
cerr << "Examples: " << endl;
cerr << "\t$ cat test.out" << endl;
cerr << "\tchr1 10 20 A chr1 15 25 1000" << endl;
cerr << "\tchr1 10 20 A chr1 25 35 10000" << endl << endl;
cerr << "\t$ cat test.out | groupBy -i stdin -grp 1,2,3,4 -opCol 8 -op sum" << endl;
cerr << "\t$ cat ex1.out" << endl;
cerr << "\tchr1 10 20 A chr1 15 25 B.1 1000" << endl;
cerr << "\tchr1 10 20 A chr1 25 35 B.2 10000" << endl << endl;
cerr << "\t$ groupBy -i ex1.out -grp 1,2,3,4 -opCols 9 -ops sum" << endl;
cerr << "\tchr1 10 20 A 11000" << endl << endl;
cerr << "\t$ cat test.out | groupBy -i stdin -grp 1,2,3,4 -opCol 8 -op max" << endl;
cerr << "\tchr1 10 20 A 1000" << endl << endl;
cerr << "\t$ cat test.out | groupBy -i stdin -grp 1,2,3,4 -opCol 8 -op mean" << endl;
cerr << "\tchr1 10 20 A 5500" << endl << endl;
cerr << "\t$ cat test.out | groupBy -i stdin -grp 1,2,3,4 -opCol 8 -op collapse" << endl;
cerr << "\t$ groupBy -i ex1.out -grp 1,2,3,4 -opCols 9,9 -ops sum,max" << endl;
cerr << "\tchr1 10 20 A 11000 10000" << endl << endl;
cerr << "\t$ groupBy -i ex1.out -grp 1,2,3,4 -opCols 8,9 -ops collapse,mean" << endl;
cerr << "\tchr1 10 20 A 1000,10000," << endl << endl;
cerr << "Notes: " << endl;
......
......@@ -163,47 +163,6 @@ void BedFile::Open(void) {
cerr << "Error: Unexpected file type (" << bedFile << "). Exiting!" << endl;
exit(1);
}
// Old method.
/*
else {
size_t foundPos;
foundPos = bedFile.find_last_of(".gz");
// is this a GZIPPED BED file?
if (foundPos == bedFile.size() - 1) {
igzstream beds(bedFile.c_str(), ios::in);
if ( !beds ) {
cerr << "Error: The requested bed file (" << bedFile << ") could not be opened. Exiting!" << endl;
exit (1);
}
else {
// if so, close it (this was just a test)
beds.close();
// now set a pointer to the stream so that we
// can read the file later on.
// Thank God for Josuttis, p. 631!
_bedStream = new igzstream(bedFile.c_str(), ios::in);
}
}
// not GZIPPED.
else {
ifstream beds(bedFile.c_str(), ios::in);
// can we open the file?
if ( !beds ) {
cerr << "Error: The requested bed file (" << bedFile << ") could not be opened. Exiting!" << endl;
exit (1);
}
else {
// if so, close it (this was just a test)
beds.close();
// now set a pointer to the stream so that we
// can read the file later on.
// Thank God for Josuttis, p. 631!
_bedStream = new ifstream(bedFile.c_str(), ios::in);
}
}
}*/
}
......
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