diff --git a/a.bed b/a.bed index c03d074e62de06c9d5fe062c77f91a805bd361ea..fbca8af9bda69f3b1cfc37dca7720f8ee1fb28aa 100644 --- a/a.bed +++ b/a.bed @@ -1 +1 @@ -chr1 0 100 +chr1 0 100 a 1 + fuck you diff --git a/b.bed b/b.bed index 14be7553f14dfeeee96fe455bbff2a368ab06efe..5dd93bce889287f2550f825419776fffe9d1e662 100644 --- a/b.bed +++ b/b.bed @@ -1 +1 @@ -chr1 50 150 +chr1 50 150 b 2 - same to you diff --git a/bin/closestBed b/bin/closestBed index f6aed2e344e4ec01dd08b50d53c283d13373458c..32eabe225ce040d0039862be7e70573b1911c189 100755 Binary files a/bin/closestBed and b/bin/closestBed differ diff --git a/bin/complementBed b/bin/complementBed index 4fcafe3d49c6e3ef9c233e4e73e5387291e5cff4..9897d095217d4f635c8194e9f03f10155060f1cc 100755 Binary files a/bin/complementBed and b/bin/complementBed differ diff --git a/bin/coverageBed b/bin/coverageBed index 500c13c3dc43953ea2fe858fb3f2186f8f50860a..1583bfbbc1fe4b4f2d4c16fbb9ba2d0e733911e2 100755 Binary files a/bin/coverageBed and b/bin/coverageBed differ diff --git a/bin/fastaFromBed b/bin/fastaFromBed index 1c35dd618555c3f106a6b55b2ed4e30c29684f34..884649915a36be5e546290180affd86d812bb798 100755 Binary files a/bin/fastaFromBed and b/bin/fastaFromBed differ diff --git a/bin/genomeCoverageBed b/bin/genomeCoverageBed index 1e813a2a1f7980d1f074d265aaa43c2d17690266..01836a9ada7280ea566aeeddda400dc0e237f606 100755 Binary files a/bin/genomeCoverageBed and b/bin/genomeCoverageBed differ diff --git a/bin/intersectBed b/bin/intersectBed index 421fb18581ae6140ef55d515dfd3d4ea1f1a4a74..daa7c51268dea86631638952fabb00c43d7f79cd 100755 Binary files a/bin/intersectBed and b/bin/intersectBed differ diff --git a/bin/linksBed b/bin/linksBed index 9eb50a5f752f5815f363011748c615309bd1ee96..b72718e947541aaaa44d9ebafafb94e912d2a344 100755 Binary files a/bin/linksBed and b/bin/linksBed differ diff --git a/bin/maskFastaFromBed b/bin/maskFastaFromBed index 014d648f124453fd513e71067141c031d25ec3d5..1a3083f1f207fec166daa4b6f63497c3b9ed825c 100755 Binary files a/bin/maskFastaFromBed and b/bin/maskFastaFromBed differ diff --git a/bin/mergeBed b/bin/mergeBed index aff597876db65eaf34dfb1f2260d10e323996af8..a2790b4ca21800d19415fce6134d1849bfdb7a0b 100755 Binary files a/bin/mergeBed and b/bin/mergeBed differ diff --git a/bin/pairToBed b/bin/pairToBed index 53bd68a8289eeb1cabdcd069fb5fde7f511c55cf..89cf8b9fbb2d150b99cda59c110e6c3c9e9d9aad 100755 Binary files a/bin/pairToBed and b/bin/pairToBed differ diff --git a/bin/pairToPair b/bin/pairToPair index 69522587bea01490fc2820cfeed4819842c3e97f..997f7f2bafea9b491ab609c54263705fe4aaefa9 100755 Binary files a/bin/pairToPair and b/bin/pairToPair differ diff --git a/bin/shuffleBed b/bin/shuffleBed index f6c0f1650fa3f60ff33d2b35a4d66703d225050b..277c3e97a87112b1d85293a50f48a33363ec1d48 100755 Binary files a/bin/shuffleBed and b/bin/shuffleBed differ diff --git a/bin/slopBed b/bin/slopBed index 1121ac5414f756012dbaa155191ebca1c988503e..c0f59c82d848c25fdb97d6dee2664dffb7ca8a1d 100755 Binary files a/bin/slopBed and b/bin/slopBed differ diff --git a/bin/sortBed b/bin/sortBed index 3b16c00ac4b466244efd3a1cd8ea74f57317ccb7..022c62d4b54c6a84330a8bc5d43ac57645cdd6e1 100755 Binary files a/bin/sortBed and b/bin/sortBed differ diff --git a/bin/subtractBed b/bin/subtractBed index 8f62628035dc74596044b0f763eb027f45b081a3..b9aef6a5a1511ae1277fbd8060e929853dcfef5c 100755 Binary files a/bin/subtractBed and b/bin/subtractBed differ diff --git a/bin/windowBed b/bin/windowBed index 7736d06b93990c246b1d656267acba3e7645daca..531822f81ed6431127f738f9403e7f7da7fb00f5 100755 Binary files a/bin/windowBed and b/bin/windowBed differ diff --git a/obj/bedFile.o b/obj/bedFile.o index e9c1353f6ae7049f52904f1d0a87d241b2bea0a2..20201821c9a394fa37b1f49bd36d1c4afca44991 100644 Binary files a/obj/bedFile.o and b/obj/bedFile.o differ diff --git a/obj/closestBed.o b/obj/closestBed.o index 9212f81a8e4dafb069865aa71db05b7af7e9b472..ff1fb98b41bfdcd2c32932a672a6c174912c0ceb 100644 Binary files a/obj/closestBed.o and b/obj/closestBed.o differ diff --git a/obj/closestMain.o b/obj/closestMain.o index 641a1a55c79f3af172d4ae4579e1560b5f73ab99..c1f70ff628ca8b38f56f1830309f1114de46adaf 100644 Binary files a/obj/closestMain.o and b/obj/closestMain.o differ diff --git a/obj/complementBed.o b/obj/complementBed.o index aab462542acfd825b0d6aa7aa9b6eda63a441712..a9612dde7c1bc799e1357054db1f3bacd13ab4b7 100644 Binary files a/obj/complementBed.o and b/obj/complementBed.o differ diff --git a/obj/coverageBed.o b/obj/coverageBed.o index 360b65b20858684ade5166267749ef95b6cc120f..4aa3ae956dd4470d8116096b7a45745f1092149b 100644 Binary files a/obj/coverageBed.o and b/obj/coverageBed.o differ diff --git a/obj/fastaFromBed.o b/obj/fastaFromBed.o index 296cc089b73dbcf4633cb5df42b6a29e332591ef..7f3c22a1faa2cd71f22d99cc66308f05933ce2db 100644 Binary files a/obj/fastaFromBed.o and b/obj/fastaFromBed.o differ diff --git a/obj/genomeCoverageBed.o b/obj/genomeCoverageBed.o index f8a527972f08eb2d304aa4b77ab5ba2f85ea62c8..1e5907749a43c1d65e41db7eb3e4434f7578db76 100644 Binary files a/obj/genomeCoverageBed.o and b/obj/genomeCoverageBed.o differ diff --git a/obj/genomeCoverageMain.o b/obj/genomeCoverageMain.o index 6d656c00d607dc65d5cded4a7d36b97581290041..f415cf94f7ab4cca7ea02e135b9f7111d0f4acc7 100644 Binary files a/obj/genomeCoverageMain.o and b/obj/genomeCoverageMain.o differ diff --git a/obj/intersectBed.o b/obj/intersectBed.o index 4a8572f0cbb93c6dad81098d7c6b1aa3c2ec3f2b..2d4b72b244825c2465a9a69641fb8ab226bee7f0 100644 Binary files a/obj/intersectBed.o and b/obj/intersectBed.o differ diff --git a/obj/linksBed.o b/obj/linksBed.o index 282e1be77765d01435a49c7ec68aa6bae67c506c..b079e718af4016933873e96781f240db63cecde9 100644 Binary files a/obj/linksBed.o and b/obj/linksBed.o differ diff --git a/obj/maskFastaFromBed.o b/obj/maskFastaFromBed.o index f7825b06818c65be416aa11b8a915f830725136c..db565605d2e17c121390627f8054fdffb37e0a3c 100644 Binary files a/obj/maskFastaFromBed.o and b/obj/maskFastaFromBed.o differ diff --git a/obj/mergeBed.o b/obj/mergeBed.o index 040ee0627573c350fe0a190a6b64c01338858862..a4d59fa88b0c89fc33a9e27e6d83335d2968f3e0 100644 Binary files a/obj/mergeBed.o and b/obj/mergeBed.o differ diff --git a/obj/pairToBed.o b/obj/pairToBed.o index 7fdfbc5a9cc1a3e25c294f294e13cf4302560d1d..c047895966c0f36efa48f3dd28835199f282a93c 100644 Binary files a/obj/pairToBed.o and b/obj/pairToBed.o differ diff --git a/obj/pairToBedMain.o b/obj/pairToBedMain.o index bb3054a1937ee0eb41650ced56610a5ec4dc402d..387a07d464ee06f051aa76011c1baed916c3eba3 100644 Binary files a/obj/pairToBedMain.o and b/obj/pairToBedMain.o differ diff --git a/obj/pairToPair.o b/obj/pairToPair.o index 22b828343442136299adc31a5aa543e9965f8960..9ef992ab34127a63956d13648e73afb2f673aed5 100644 Binary files a/obj/pairToPair.o and b/obj/pairToPair.o differ diff --git a/obj/pairToPairMain.o b/obj/pairToPairMain.o index 9482f7ca50ec0ad450396a6f011839366b7434b0..5ce50a6a36f7e7bd9e6147d27ba3738728f16a4f 100644 Binary files a/obj/pairToPairMain.o and b/obj/pairToPairMain.o differ diff --git a/obj/shuffleBed.o b/obj/shuffleBed.o index 8bfdca8deb7f554245c99571b5ca4e15b8042910..f4d2e246b979023d911e56de2f37aaf603d99d66 100644 Binary files a/obj/shuffleBed.o and b/obj/shuffleBed.o differ diff --git a/obj/slopBed.o b/obj/slopBed.o index dae665c79f9bb3c35f2ee1d64f6435b985f55014..db9fe4c7886ad811de30e93a833ca216b0c51c12 100644 Binary files a/obj/slopBed.o and b/obj/slopBed.o differ diff --git a/obj/sortBed.o b/obj/sortBed.o index 43dc59fe46a9632928c5f80eb8bc37992dda38aa..3510300236f06484f64c4a5113b3f65592187b5b 100644 Binary files a/obj/sortBed.o and b/obj/sortBed.o differ diff --git a/obj/subtractBed.o b/obj/subtractBed.o index 5ac4efcd3180a0462f81a93b33daf3a201658c2a..a0f04779c12993910a5b9419bad86d770d96ef28 100644 Binary files a/obj/subtractBed.o and b/obj/subtractBed.o differ diff --git a/obj/subtractMain.o b/obj/subtractMain.o index 3f2c9e595699a8244265beacbf18cb0abf7b0a3b..97cb5e145fb7f9caa9af450d0fcd181b5594c595 100644 Binary files a/obj/subtractMain.o and b/obj/subtractMain.o differ diff --git a/obj/windowBed.o b/obj/windowBed.o index ad7415171ff85be4c0480891b3404638a2e17eb1..21f07b538bf5574ef533a7e38397024989a97b47 100644 Binary files a/obj/windowBed.o and b/obj/windowBed.o differ diff --git a/src/utils/bedFile/bedFile.cpp b/src/utils/bedFile/bedFile.cpp index c17af2437d078eb33d274cf918f5ae44948fc994..00e745165d1a74d61ef0f6b7b069a22f711aa5c1 100755 --- a/src/utils/bedFile/bedFile.cpp +++ b/src/utils/bedFile/bedFile.cpp @@ -243,6 +243,19 @@ bool BedFile::parseBedLine (BED &bed, const vector<string> &lineVector, int line bed.strand = lineVector[5]; return true; } + else if (this->bedType > 6) { + bed.chrom = lineVector[0]; + bed.start = atoi(lineVector[1].c_str()); + bed.end = atoi(lineVector[2].c_str()); + bed.name = lineVector[3]; + bed.score = lineVector[4]; + bed.strand = lineVector[5]; + + for (unsigned int i = 6; i < lineVector.size(); ++i) { + bed.otherFields.push_back(lineVector[i]); + } + return true; + } else { cerr << "Error: unexpected number of fields: " << lineNum << ". Verify that your files are TAB-delimited and that your BED file has 3,4,5 or 6 fields. Exiting..." << endl; exit(1); @@ -296,6 +309,19 @@ bool BedFile::parseBedLine (BED &bed, const vector<string> &lineVector, int line bed.strand = lineVector[5]; return true; } + else if (this->bedType > 6) { + bed.chrom = lineVector[0]; + bed.start = atoi(lineVector[1].c_str()); + bed.end = atoi(lineVector[2].c_str()); + bed.name = lineVector[3]; + bed.score = lineVector[4]; + bed.strand = lineVector[5]; + + for (unsigned int i = 6; i < lineVector.size(); ++i) { + bed.otherFields.push_back(lineVector[i]); + } + return true; + } else { cerr << "Error: unexpected number of fields: " << lineNum << ". Verify that your files are TAB-delimited and that your BED file has 3,4,5 or 6 fields. Exiting..." << endl; exit(1); @@ -326,6 +352,36 @@ bool BedFile::parseBedLine (BED &bed, const vector<string> &lineVector, int line } +bool BedFile::parseGffLine (BED &bed, const vector<string> &lineVector, int lineNum) { + +/* +1. seqname - The name of the sequence. Must be a chromosome or scaffold. +2. source - The program that generated this feature. +3. feature - The name of this type of feature. Some examples of standard feature types are "CDS", "start_codon", "stop_codon", and "exon". +4. start - The starting position of the feature in the sequence. The first base is numbered 1. +5. end - The ending position of the feature (inclusive). +6. score - A score between 0 and 1000. If the track line useScore attribute is set to 1 for this annotation data set, the score value will determine the level of gray in which this feature is displayed (higher numbers = darker gray). If there is no score value, enter ".". +7. strand - Valid entries include '+', '-', or '.' (for don't know/don't care). +8. frame - If the feature is a coding exon, frame should be a number between 0-2 that represents the reading frame of the first base. If the feature is not a coding exon, the value should be '.'. +9. group - All lines with the same group are linked together into a single item. +*/ + + if ( (lineNum > 1) && (lineVector.size() == this->bedType)) { + bed.chrom = lineVector[0]; + bed.start = atoi(lineVector[1].c_str()); + bed.end = atoi(lineVector[2].c_str()); + bed.name = ""; + bed.score = ""; + bed.strand = ""; + return true; + } + else if ((lineNum == 1) && (lineVector.size() == 9)) { + this->bedType = lineVector.size(); + } +} + + + void BedFile::loadBedFileIntoMap() { // open the BED file for reading @@ -469,6 +525,16 @@ void BedFile::reportBedTab(BED bed) { printf ("%s\t%d\t%d\t%s\t%s\t%s\t", bed.chrom.c_str(), bed.start, bed.end, bed.name.c_str(), bed.score.c_str(), bed.strand.c_str()); } + else if (this->bedType > 6) { + printf ("%s\t%d\t%d\t%s\t%s\t%s\t", bed.chrom.c_str(), bed.start, bed.end, bed.name.c_str(), + bed.score.c_str(), bed.strand.c_str()); + + vector<string>::const_iterator othIt = bed.otherFields.begin(); + vector<string>::const_iterator othEnd = bed.otherFields.end(); + for ( ; othIt != othEnd; ++othIt) { + printf("%s\t", othIt->c_str()); + } + } } @@ -496,6 +562,17 @@ void BedFile::reportBedNewLine(BED bed) { printf ("%s\t%d\t%d\t%s\t%s\t%s\n", bed.chrom.c_str(), bed.start, bed.end, bed.name.c_str(), bed.score.c_str(), bed.strand.c_str()); } + else if (this->bedType > 6) { + printf ("%s\t%d\t%d\t%s\t%s\t%s\t", bed.chrom.c_str(), bed.start, bed.end, bed.name.c_str(), + bed.score.c_str(), bed.strand.c_str()); + + vector<string>::const_iterator othIt = bed.otherFields.begin(); + vector<string>::const_iterator othEnd = bed.otherFields.end(); + for ( ; othIt != othEnd; ++othIt) { + printf("%s\t", othIt->c_str()); + } + printf("\n"); + } } @@ -524,6 +601,16 @@ void BedFile::reportBedRangeTab(BED bed, int start, int end) { printf ("%s\t%d\t%d\t%s\t%s\t%s\t", bed.chrom.c_str(), start, end, bed.name.c_str(), bed.score.c_str(), bed.strand.c_str()); } + else if (this->bedType > 6) { + printf ("%s\t%d\t%d\t%s\t%s\t%s\t", bed.chrom.c_str(), start, end, bed.name.c_str(), + bed.score.c_str(), bed.strand.c_str()); + + vector<string>::const_iterator othIt = bed.otherFields.begin(); + vector<string>::const_iterator othEnd = bed.otherFields.end(); + for ( ; othIt != othEnd; ++othIt) { + printf("%s\t", othIt->c_str()); + } + } } @@ -552,4 +639,15 @@ void BedFile::reportBedRangeNewLine(BED bed, int start, int end) { printf ("%s\t%d\t%d\t%s\t%s\t%s\n", bed.chrom.c_str(), start, end, bed.name.c_str(), bed.score.c_str(), bed.strand.c_str()); } + else if (this->bedType > 6) { + printf ("%s\t%d\t%d\t%s\t%s\t%s\t", bed.chrom.c_str(), start, end, bed.name.c_str(), + bed.score.c_str(), bed.strand.c_str()); + + vector<string>::const_iterator othIt = bed.otherFields.begin(); + vector<string>::const_iterator othEnd = bed.otherFields.end(); + for ( ; othIt != othEnd; ++othIt) { + printf("%s\t", othIt->c_str()); + } + printf("\n"); + } } diff --git a/src/utils/bedFile/bedFile.h b/src/utils/bedFile/bedFile.h index a6413fafff3e0f844732ab5968cf93c5fad6ed0d..5ed98e99d19db8d2f97e5efaae1a1d122b34d6dc 100755 --- a/src/utils/bedFile/bedFile.h +++ b/src/utils/bedFile/bedFile.h @@ -46,6 +46,8 @@ struct BED { string name; string score; string strand; + + vector<string> otherFields; // Additional fields unsigned int count; // count of number of intervals @@ -143,7 +145,8 @@ public: // the bedfile with which this instance is associated string bedFile; - unsigned int bedType; + unsigned int bedType; // 3 -6 for BED + // 9 for GFF private: // none