From 38d67119ca2ba05c59edcb3bb69c1a5081ad4c51 Mon Sep 17 00:00:00 2001 From: Aaron Quinlan <aaronquinlan@gmail.com> Date: Wed, 15 Apr 2009 15:38:41 -0400 Subject: [PATCH] Changed exception handling calls to report errors to stderr. Rather self-explanatory. Affects *Main.cpp files. Also affects the bedFile.cpp file. All of the BED entry checks now write to stderr. --- src/complementBed/complementMain.cpp | 36 ++++++------- src/coverageBed/coverageMain.cpp | 42 +++++++-------- src/fastaFromBed/fastaFromBedMain.cpp | 46 ++++++++--------- src/genomeCoverageBed/genomeCoverageMain.cpp | 54 ++++++++++---------- src/intersectBed/intersectMain.cpp | 46 ++++++++--------- src/mergeBed/mergeMain.cpp | 34 ++++++------ src/sortBed/sortMain.cpp | 28 +++++----- src/utils/bedFile/bedFile.cpp | 4 +- 8 files changed, 145 insertions(+), 145 deletions(-) diff --git a/src/complementBed/complementMain.cpp b/src/complementBed/complementMain.cpp index 8a900426..f70f6c9b 100755 --- a/src/complementBed/complementMain.cpp +++ b/src/complementBed/complementMain.cpp @@ -57,14 +57,14 @@ int main(int argc, char* argv[]) { i++; } else { - cout << endl << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl; + cerr << endl << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl; showHelp = true; } } // make sure we have both input files if (!haveBed || !haveGenome) { - cout << endl << "*****" << endl << "*****ERROR: Need -i BED file and -g Genome file. " << endl << "*****" << endl; + cerr << endl << "*****" << endl << "*****ERROR: Need -i BED file and -g Genome file. " << endl << "*****" << endl; showHelp = true; } if (!showHelp) { @@ -79,23 +79,23 @@ int main(int argc, char* argv[]) { void ShowHelp(void) { - cout << "=======================================================" << endl; - cout << PROGRAM_NAME << " v" << VERSION << endl ; - cout << "Aaron Quinlan, Ph.D." << endl; - cout << "aaronquinlan@gmail.com" << endl ; - cout << "Hall Laboratory" << endl; - cout << "Biochemistry and Molecular Genetics" << endl; - cout << "University of Virginia" << endl; - cout << "=======================================================" << endl << endl; - cout << "Description: Returns the base pair complement of a BED file." << endl << endl; - cout << "***NOTE: Only BED3 - BED6 formats allowed.***"<< endl << endl; - - cout << "Usage: " << PROGRAM_NAME << " [OPTIONS] -i <input.bed>" << endl << endl; + cerr << "=======================================================" << endl; + cerr << PROGRAM_NAME << " v" << VERSION << endl ; + cerr << "Aaron Quinlan, Ph.D." << endl; + cerr << "aaronquinlan@gmail.com" << endl ; + cerr << "Hall Laboratory" << endl; + cerr << "Biochemistry and Molecular Genetics" << endl; + cerr << "University of Virginia" << endl; + cerr << "=======================================================" << endl << endl; + cerr << "Description: Returns the base pair complement of a BED file." << endl << endl; + cerr << "***NOTE: Only BED3 - BED6 formats allowed.***"<< endl << endl; + + cerr << "Usage: " << PROGRAM_NAME << " [OPTIONS] -i <input.bed>" << endl << endl; - //cout << "OPTIONS: " << endl; - //cout << "\t" << "-n\t\t\t" << "Report the number of BED entries that were merged. (=1 if no merging occured)" << endl; - //cout << "\t" << "-d\t\t\t" << "Maximum distance between features that will be merged. (Default is 0)" << endl; - //cout << "\t\t\t\t" << "For example, \"-d 50\" will merge features that are <= 50 bp apart." << endl << endl; + //cerr << "OPTIONS: " << endl; + //cerr << "\t" << "-n\t\t\t" << "Report the number of BED entries that were merged. (=1 if no merging occured)" << endl; + //cerr << "\t" << "-d\t\t\t" << "Maximum distance between features that will be merged. (Default is 0)" << endl; + //cerr << "\t\t\t\t" << "For example, \"-d 50\" will merge features that are <= 50 bp apart." << endl << endl; // end the program here exit(1); diff --git a/src/coverageBed/coverageMain.cpp b/src/coverageBed/coverageMain.cpp index a5b9912a..5630bdc3 100755 --- a/src/coverageBed/coverageMain.cpp +++ b/src/coverageBed/coverageMain.cpp @@ -56,14 +56,14 @@ int main(int argc, char* argv[]) { i++; } else { - cout << endl << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl; + cerr << endl << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl; showHelp = true; } } // make sure we have both input files if (!haveBedA || !haveBedB) { - cout << endl << "*****" << endl << "*****ERROR: Need -a and -b files. " << endl << "*****" << endl; + cerr << endl << "*****" << endl << "*****ERROR: Need -a and -b files. " << endl << "*****" << endl; showHelp = true; } @@ -80,25 +80,25 @@ int main(int argc, char* argv[]) { void ShowHelp(void) { - cout << "=======================================================" << endl; - cout << PROGRAM_NAME << " v" << VERSION << endl ; - cout << "Aaron Quinlan, Ph.D." << endl; - cout << "aaronquinlan@gmail.com" << endl ; - cout << "Hall Laboratory" << endl; - cout << "Biochemistry and Molecular Genetics" << endl; - cout << "University of Virginia" << endl; - cout << "=======================================================" << endl << endl; - //cout << "Description: Reportoverlaps between a.bed and b.bed." << endl << endl; - cout << "***NOTE: Only BED3 - BED6 formats allowed.***"<< endl << endl; - - cout << "Usage: " << PROGRAM_NAME << " [OPTIONS] -a <a.bed> -b <b.bed>" << endl << endl; - - //cout << "OPTIONS: " << endl; - //cout << "\t" << "-u\t\t\t" << "Write ORIGINAL a.bed entry ONCE if ANY overlap bed." << endl << "\t\t\t\tIn other words, ignore multiple overlaps." << endl << endl; - //cout << "\t" << "-v \t\t\t" << "Only report those entries in A that have NO OVERLAP in B." << endl << "\t\t\t\tSimilar to grep -v." << endl << endl; - //cout << "\t" << "-f (e.g. 0.05)\t\t" << "Minimum overlap req'd as fraction of a.bed." << endl << "\t\t\t\tDefault is 1E-9 (effectively 1bp)." << endl << endl; - //cout << "\t" << "-c \t\t\t" << "For each entry in A, report the number of hits in B while restricting to -f." << endl << "\t\t\t\tReports 0 for A entries that have no overlap with B." << endl << endl; - //cout << "\t" << "-wb \t\t\t" << "Write the entry in B for each overlap." << endl << "\t\t\t\tUseful for knowing _what_ A overlaps. Restricted by -f." << endl << endl; + cerr << "=======================================================" << endl; + cerr << PROGRAM_NAME << " v" << VERSION << endl ; + cerr << "Aaron Quinlan, Ph.D." << endl; + cerr << "aaronquinlan@gmail.com" << endl ; + cerr << "Hall Laboratory" << endl; + cerr << "Biochemistry and Molecular Genetics" << endl; + cerr << "University of Virginia" << endl; + cerr << "=======================================================" << endl << endl; + //cerr << "Description: Reportoverlaps between a.bed and b.bed." << endl << endl; + cerr << "***NOTE: Only BED3 - BED6 formats allowed.***"<< endl << endl; + + cerr << "Usage: " << PROGRAM_NAME << " [OPTIONS] -a <a.bed> -b <b.bed>" << endl << endl; + + //cerr << "OPTIONS: " << endl; + //cerr << "\t" << "-u\t\t\t" << "Write ORIGINAL a.bed entry ONCE if ANY overlap bed." << endl << "\t\t\t\tIn other words, ignore multiple overlaps." << endl << endl; + //cerr << "\t" << "-v \t\t\t" << "Only report those entries in A that have NO OVERLAP in B." << endl << "\t\t\t\tSimilar to grep -v." << endl << endl; + //cerr << "\t" << "-f (e.g. 0.05)\t\t" << "Minimum overlap req'd as fraction of a.bed." << endl << "\t\t\t\tDefault is 1E-9 (effectively 1bp)." << endl << endl; + //cerr << "\t" << "-c \t\t\t" << "For each entry in A, report the number of hits in B while restricting to -f." << endl << "\t\t\t\tReports 0 for A entries that have no overlap with B." << endl << endl; + //cerr << "\t" << "-wb \t\t\t" << "Write the entry in B for each overlap." << endl << "\t\t\t\tUseful for knowing _what_ A overlaps. Restricted by -f." << endl << endl; // end the program here exit(1); diff --git a/src/fastaFromBed/fastaFromBedMain.cpp b/src/fastaFromBed/fastaFromBedMain.cpp index 6aec35e4..490a6c37 100755 --- a/src/fastaFromBed/fastaFromBedMain.cpp +++ b/src/fastaFromBed/fastaFromBedMain.cpp @@ -71,7 +71,7 @@ int main(int argc, char* argv[]) { i++; } else { - cout << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl; + cerr << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl; showHelp = true; } } @@ -84,7 +84,7 @@ int main(int argc, char* argv[]) { Bed2Fa *b2f = new Bed2Fa(useNameOnly, fastaDbFile, bedFile, fastaOutFile); - cout << PROGRAM_NAME << " completed." << endl; + cerr << PROGRAM_NAME << " completed." << endl; return 0; } else { @@ -94,27 +94,27 @@ int main(int argc, char* argv[]) { void ShowHelp(void) { - cout << "=======================================================" << endl; - cout << PROGRAM_NAME << " v" << VERSION << endl << endl; - cout << "Aaron Quinlan, Ph.D." << endl; - cout << "aaronquinlan@gmail.com" << endl << endl; - cout << "Hall Laboratory" << endl; - cout << "Biochemistry and Molecular Genetics" << endl; - cout << "University of Virginia" << endl; - cout << "=======================================================" << endl << endl; - cout << "Description: Extract DNA sequences into a fasta file based on BED coordinates." << endl << endl; - - cout << "Usage: " << PROGRAM_NAME << " -db <fasta db file> -bed <bed coordinates file> -fo <output fasta file w/ requested DNA>" << endl << endl; - - cout << "Input Files:" << endl; - cout << " -db <FASTA db file> " << endl; - cout << " -bed <BED coordinates file> " << endl; - - cout << "Output Files:" << endl; - cout << " -fo <FASTA output file> " << endl; - - cout << "\nHelp:" << endl; - cout << " -h shows this help text" << endl; + cerr << "=======================================================" << endl; + cerr << PROGRAM_NAME << " v" << VERSION << endl << endl; + cerr << "Aaron Quinlan, Ph.D." << endl; + cerr << "aaronquinlan@gmail.com" << endl << endl; + cerr << "Hall Laboratory" << endl; + cerr << "Biochemistry and Molecular Genetics" << endl; + cerr << "University of Virginia" << endl; + cerr << "=======================================================" << endl << endl; + cerr << "Description: Extract DNA sequences into a fasta file based on BED coordinates." << endl << endl; + + cerr << "Usage: " << PROGRAM_NAME << " -db <fasta db file> -bed <bed coordinates file> -fo <output fasta file w/ requested DNA>" << endl << endl; + + cerr << "Input Files:" << endl; + cerr << " -db <FASTA db file> " << endl; + cerr << " -bed <BED coordinates file> " << endl; + + cerr << "Output Files:" << endl; + cerr << " -fo <FASTA output file> " << endl; + + cerr << "\nHelp:" << endl; + cerr << " -h shows this help text" << endl; // end the program here exit(1); diff --git a/src/genomeCoverageBed/genomeCoverageMain.cpp b/src/genomeCoverageBed/genomeCoverageMain.cpp index 2b6be564..794e7458 100755 --- a/src/genomeCoverageBed/genomeCoverageMain.cpp +++ b/src/genomeCoverageBed/genomeCoverageMain.cpp @@ -72,14 +72,14 @@ int main(int argc, char* argv[]) { i++; } else { - cout << endl << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl; + cerr << endl << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl; showHelp = true; } } // make sure we have both input files if (!haveBed || !haveGenome) { - cout << endl << "*****" << endl << "*****ERROR: Need both a BED (-i) and a genome ()-g) file. " << endl << "*****" << endl; + cerr << endl << "*****" << endl << "*****ERROR: Need both a BED (-i) and a genome (-g) file. " << endl << "*****" << endl; showHelp = true; } @@ -97,32 +97,32 @@ int main(int argc, char* argv[]) { void ShowHelp(void) { - cout << "=======================================================" << endl; - cout << PROGRAM_NAME << " v" << VERSION << endl ; - cout << "Aaron Quinlan, Ph.D." << endl; - cout << "aaronquinlan@gmail.com" << endl ; - cout << "Hall Laboratory" << endl; - cout << "Biochemistry and Molecular Genetics" << endl; - cout << "University of Virginia" << endl; - cout << "=======================================================" << endl << endl; - cout << "Description: Compute the coverage of a BED (-i) file on genome (-g) file." << endl << endl; - cout << "***NOTE: Only BED3 - BED6 formats allowed.***"<< endl << endl; - - cout << "Usage: " << PROGRAM_NAME << " [OPTIONS] -g <genome> -i <bed>" << endl << endl; + cerr << "=======================================================" << endl; + cerr << PROGRAM_NAME << " v" << VERSION << endl ; + cerr << "Aaron Quinlan, Ph.D." << endl; + cerr << "aaronquinlan@gmail.com" << endl ; + cerr << "Hall Laboratory" << endl; + cerr << "Biochemistry and Molecular Genetics" << endl; + cerr << "University of Virginia" << endl; + cerr << "=======================================================" << endl << endl; + cerr << "Description: Compute the coverage of a BED (-i) file on genome (-g) file." << endl << endl; + cerr << "***NOTE: Only BED3 - BED6 formats allowed.***"<< endl << endl; + + cerr << "Usage: " << PROGRAM_NAME << " [OPTIONS] -g <genome> -i <bed>" << endl << endl; - cout << "OPTIONS: " << endl; - cout << "\t" << "-d\t\t\t" << "Report the depth at each genome position." << endl << "\t\t\t\tDefault behavior is to report a histogram." << endl << endl; - cout << "\t" << "-s \t\t\t" << "Report depth based on start sites." << endl << endl; - cout << "\t" << "-max\t\t\t" << "Combine all positions with a depth > max into a single bin in the histogram." << endl << endl; - cout << "NOTES: " << endl; - cout << "\tThe genome file should tab delimited and structured as follows: <chr><TAB><size>. For example, Mus musculus:" << endl; - cout << "\tchr1\t197195432" << endl; - cout << "\tchr2\t181748087" << endl; - cout << "\t..." << endl; - cout << "\tchrY_random\t58682461" << endl << endl; - cout << "TIPS:" << endl; - cout << "\tOne can use the UCSC Genome Browser's MySQL database to extract chromosome sizes. For example, H. sapiens:" << endl << endl; - cout << "\tmysql --user=genome --host=genome-mysql.cse.ucsc.edu -A -e \"select chrom, size from hg18.chromInfo\" > hg18.genome" + cerr << "OPTIONS: " << endl; + cerr << "\t" << "-d\t\t\t" << "Report the depth at each genome position." << endl << "\t\t\t\tDefault behavior is to report a histogram." << endl << endl; + cerr << "\t" << "-s \t\t\t" << "Report depth based on start sites." << endl << endl; + cerr << "\t" << "-max\t\t\t" << "Combine all positions with a depth > max into a single bin in the histogram." << endl << endl; + cerr << "NOTES: " << endl; + cerr << "\tThe genome file should tab delimited and structured as follows: <chr><TAB><size>. For example, Mus musculus:" << endl; + cerr << "\tchr1\t197195432" << endl; + cerr << "\tchr2\t181748087" << endl; + cerr << "\t..." << endl; + cerr << "\tchrY_random\t58682461" << endl << endl; + cerr << "TIPS:" << endl; + cerr << "\tOne can use the UCSC Genome Browser's MySQL database to extract chromosome sizes. For example, H. sapiens:" << endl << endl; + cerr << "\tmysql --user=genome --host=genome-mysql.cse.ucsc.edu -A -e \"select chrom, size from hg18.chromInfo\" > hg18.genome" << endl << endl; // end the program here exit(1); diff --git a/src/intersectBed/intersectMain.cpp b/src/intersectBed/intersectMain.cpp index 2936b9fd..894d0273 100755 --- a/src/intersectBed/intersectMain.cpp +++ b/src/intersectBed/intersectMain.cpp @@ -83,24 +83,24 @@ int main(int argc, char* argv[]) { i++; } else { - cout << endl << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl; + cerr << endl << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl; showHelp = true; } } // make sure we have both input files if (!haveBedA || !haveBedB) { - cout << endl << "*****" << endl << "*****ERROR: Need -a and -b files. " << endl << "*****" << endl; + cerr << endl << "*****" << endl << "*****ERROR: Need -a and -b files. " << endl << "*****" << endl; showHelp = true; } if (anyHit && noHit) { - cout << endl << "*****" << endl << "*****ERROR: Request either -u OR -v, not both." << endl << "*****" << endl; + cerr << endl << "*****" << endl << "*****ERROR: Request either -u OR -v, not both." << endl << "*****" << endl; showHelp = true; } if (writeB && writeCount) { - cout << endl << "*****" << endl << "*****ERROR: Request either -wb OR -c, not both." << endl << "*****" << endl; + cerr << endl << "*****" << endl << "*****ERROR: Request either -wb OR -c, not both." << endl << "*****" << endl; showHelp = true; } @@ -117,25 +117,25 @@ int main(int argc, char* argv[]) { void ShowHelp(void) { - cout << "=======================================================" << endl; - cout << PROGRAM_NAME << " v" << VERSION << endl ; - cout << "Aaron Quinlan, Ph.D." << endl; - cout << "aaronquinlan@gmail.com" << endl ; - cout << "Hall Laboratory" << endl; - cout << "Biochemistry and Molecular Genetics" << endl; - cout << "University of Virginia" << endl; - cout << "=======================================================" << endl << endl; - cout << "Description: Report overlaps between a.bed and b.bed." << endl << endl; - cout << "***NOTE: Only BED3 - BED6 formats allowed.***"<< endl << endl; - - cout << "Usage: " << PROGRAM_NAME << " [OPTIONS] -a <a.bed> -b <b.bed>" << endl << endl; - - cout << "OPTIONS: " << endl; - cout << "\t" << "-u\t\t\t" << "Write ORIGINAL a.bed entry ONCE if ANY overlap bed." << endl << "\t\t\t\tIn other words, ignore multiple overlaps." << endl << endl; - cout << "\t" << "-v \t\t\t" << "Only report those entries in A that have NO OVERLAP in B." << endl << "\t\t\t\tSimilar to grep -v." << endl << endl; - cout << "\t" << "-f (e.g. 0.05)\t\t" << "Minimum overlap req'd as fraction of a.bed." << endl << "\t\t\t\tDefault is 1E-9 (effectively 1bp)." << endl << endl; - cout << "\t" << "-c \t\t\t" << "For each entry in A, report the number of hits in B while restricting to -f." << endl << "\t\t\t\tReports 0 for A entries that have no overlap with B." << endl << endl; - cout << "\t" << "-wb \t\t\t" << "Write the entry in B for each overlap." << endl << "\t\t\t\tUseful for knowing _what_ A overlaps. Restricted by -f." << endl << endl; + cerr << "=======================================================" << endl; + cerr << PROGRAM_NAME << " v" << VERSION << endl ; + cerr << "Aaron Quinlan, Ph.D." << endl; + cerr << "aaronquinlan@gmail.com" << endl ; + cerr << "Hall Laboratory" << endl; + cerr << "Biochemistry and Molecular Genetics" << endl; + cerr << "University of Virginia" << endl; + cerr << "=======================================================" << endl << endl; + cerr << "Description: Report overlaps between a.bed and b.bed." << endl << endl; + cerr << "***NOTE: Only BED3 - BED6 formats allowed.***"<< endl << endl; + + cerr << "Usage: " << PROGRAM_NAME << " [OPTIONS] -a <a.bed> -b <b.bed>" << endl << endl; + + cerr << "OPTIONS: " << endl; + cerr << "\t" << "-u\t\t\t" << "Write ORIGINAL a.bed entry ONCE if ANY overlap bed." << endl << "\t\t\t\tIn other words, ignore multiple overlaps." << endl << endl; + cerr << "\t" << "-v \t\t\t" << "Only report those entries in A that have NO OVERLAP in B." << endl << "\t\t\t\tSimilar to grep -v." << endl << endl; + cerr << "\t" << "-f (e.g. 0.05)\t\t" << "Minimum overlap req'd as fraction of a.bed." << endl << "\t\t\t\tDefault is 1E-9 (effectively 1bp)." << endl << endl; + cerr << "\t" << "-c \t\t\t" << "For each entry in A, report the number of hits in B while restricting to -f." << endl << "\t\t\t\tReports 0 for A entries that have no overlap with B." << endl << endl; + cerr << "\t" << "-wb \t\t\t" << "Write the entry in B for each overlap." << endl << "\t\t\t\tUseful for knowing _what_ A overlaps. Restricted by -f." << endl << endl; // end the program here exit(1); diff --git a/src/mergeBed/mergeMain.cpp b/src/mergeBed/mergeMain.cpp index 17a5f02f..08e71223 100755 --- a/src/mergeBed/mergeMain.cpp +++ b/src/mergeBed/mergeMain.cpp @@ -63,14 +63,14 @@ int main(int argc, char* argv[]) { i++; } else { - cout << endl << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl; + cerr << endl << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl; showHelp = true; } } // make sure we have both input files if (!haveBed) { - cout << endl << "*****" << endl << "*****ERROR: Need -i BED file. " << endl << "*****" << endl; + cerr << endl << "*****" << endl << "*****ERROR: Need -i BED file. " << endl << "*****" << endl; showHelp = true; } @@ -86,22 +86,22 @@ int main(int argc, char* argv[]) { void ShowHelp(void) { - cout << "=======================================================" << endl; - cout << PROGRAM_NAME << " v" << VERSION << endl ; - cout << "Aaron Quinlan, Ph.D." << endl; - cout << "aaronquinlan@gmail.com" << endl ; - cout << "Hall Laboratory" << endl; - cout << "Biochemistry and Molecular Genetics" << endl; - cout << "University of Virginia" << endl; - cout << "=======================================================" << endl << endl; - cout << "Description: Merges overlapping bed entries into a sinle interval." << endl << endl; - cout << "***NOTE: Only BED3 - BED6 formats allowed.***"<< endl << endl; - - cout << "Usage: " << PROGRAM_NAME << " [OPTIONS] -i <input.bed>" << endl << endl; + cerr << "=======================================================" << endl; + cerr << PROGRAM_NAME << " v" << VERSION << endl ; + cerr << "Aaron Quinlan, Ph.D." << endl; + cerr << "aaronquinlan@gmail.com" << endl ; + cerr << "Hall Laboratory" << endl; + cerr << "Biochemistry and Molecular Genetics" << endl; + cerr << "University of Virginia" << endl; + cerr << "=======================================================" << endl << endl; + cerr << "Description: Merges overlapping bed entries into a sinle interval." << endl << endl; + cerr << "***NOTE: Only BED3 - BED6 formats allowed.***"<< endl << endl; + + cerr << "Usage: " << PROGRAM_NAME << " [OPTIONS] -i <input.bed>" << endl << endl; - cout << "OPTIONS: " << endl; - cout << "\t" << "-n\t\t\t" << "Report the number of BED entries that were merged. (=1 if no merging occured)" << endl << endl; - cout << "\t" << "-d\t\t\t" << "Maximum distance between features allowed for features to be merged. (Default=0)" << endl << endl; + cerr << "OPTIONS: " << endl; + cerr << "\t" << "-n\t\t\t" << "Report the number of BED entries that were merged. (=1 if no merging occured)" << endl << endl; + cerr << "\t" << "-d\t\t\t" << "Maximum distance between features allowed for features to be merged. (Default=0)" << endl << endl; // end the program here exit(1); diff --git a/src/sortBed/sortMain.cpp b/src/sortBed/sortMain.cpp index 00e32f95..021097ee 100755 --- a/src/sortBed/sortMain.cpp +++ b/src/sortBed/sortMain.cpp @@ -51,14 +51,14 @@ int main(int argc, char* argv[]) { i++; } else { - cout << endl << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl; + cerr << endl << "*****ERROR: Unrecognized parameter: " << argv[i] << " *****" << endl << endl; showHelp = true; } } // make sure we have both input files if (!haveBed) { - cout << endl << "*****" << endl << "*****ERROR: Need -i BED file. " << endl << "*****" << endl; + cerr << endl << "*****" << endl << "*****ERROR: Need -i BED file. " << endl << "*****" << endl; showHelp = true; } @@ -74,18 +74,18 @@ int main(int argc, char* argv[]) { void ShowHelp(void) { - cout << "=======================================================" << endl; - cout << PROGRAM_NAME << " v" << VERSION << endl ; - cout << "Aaron Quinlan, Ph.D." << endl; - cout << "aaronquinlan@gmail.com" << endl ; - cout << "Hall Laboratory" << endl; - cout << "Biochemistry and Molecular Genetics" << endl; - cout << "University of Virginia" << endl; - cout << "=======================================================" << endl << endl; - cout << "Description: Sorts a BED file by chrom, then by start position." << endl << endl; - cout << "***NOTE: Only BED3 - BED6 formats allowed.***"<< endl << endl; - - cout << "Usage: " << PROGRAM_NAME << " <input.bed>" << endl << endl; + cerr << "=======================================================" << endl; + cerr << PROGRAM_NAME << " v" << VERSION << endl ; + cerr << "Aaron Quinlan, Ph.D." << endl; + cerr << "aaronquinlan@gmail.com" << endl ; + cerr << "Hall Laboratory" << endl; + cerr << "Biochemistry and Molecular Genetics" << endl; + cerr << "University of Virginia" << endl; + cerr << "=======================================================" << endl << endl; + cerr << "Description: Sorts a BED file by chrom, then by start position." << endl << endl; + cerr << "***NOTE: Only BED3 - BED6 formats allowed.***"<< endl << endl; + + cerr << "Usage: " << PROGRAM_NAME << " <input.bed>" << endl << endl; // end the program here exit(1); diff --git a/src/utils/bedFile/bedFile.cpp b/src/utils/bedFile/bedFile.cpp index cc7550a9..8766e3cf 100755 --- a/src/utils/bedFile/bedFile.cpp +++ b/src/utils/bedFile/bedFile.cpp @@ -248,11 +248,11 @@ bool BedFile::parseBedLine (BED &bed, const vector<string> &lineVector, const in } if (bed.start > bed.end) { - cout << "Error: malformed BED entry at line " << lineNum << ". Start was greater than End. Ignoring it and moving on." << endl; + cerr << "Error: malformed BED entry at line " << lineNum << ". Start was greater than End. Ignoring it and moving on." << endl; return false; } else if ( (bed.start < 0) || (bed.end < 0) ) { - cout << "Error: malformed BED entry at line " << lineNum << ". Coordinate <= 0. Ignoring it and moving on." << endl; + cerr << "Error: malformed BED entry at line " << lineNum << ". Coordinate <= 0. Ignoring it and moving on." << endl; return false; } } -- GitLab