Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bedtools2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
R3
legacy
bedtools2
Commits
793ec9f3
Commit
793ec9f3
authored
13 years ago
by
Aaron
Browse files
Options
Downloads
Patches
Plain Diff
Added -S to pairToBed
parent
f12f568c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/pairToBed/pairToBed.cpp
+9
-8
9 additions, 8 deletions
src/pairToBed/pairToBed.cpp
src/pairToBed/pairToBed.h
+3
-2
3 additions, 2 deletions
src/pairToBed/pairToBed.h
src/pairToBed/pairToBedMain.cpp
+18
-5
18 additions, 5 deletions
src/pairToBed/pairToBedMain.cpp
with
30 additions
and
15 deletions
src/pairToBed/pairToBed.cpp
+
9
−
8
View file @
793ec9f3
...
@@ -33,13 +33,14 @@ bool IsCorrectMappingForBEDPE (const BamAlignment &bam) {
...
@@ -33,13 +33,14 @@ bool IsCorrectMappingForBEDPE (const BamAlignment &bam) {
*/
*/
BedIntersectPE
::
BedIntersectPE
(
string
bedAFilePE
,
string
bedBFile
,
float
overlapFraction
,
BedIntersectPE
::
BedIntersectPE
(
string
bedAFilePE
,
string
bedBFile
,
float
overlapFraction
,
string
searchType
,
bool
force
Strand
,
bool
bamInput
,
string
searchType
,
bool
sameStrand
,
bool
diff
Strand
,
bool
bamInput
,
bool
bamOutput
,
bool
uncompressedBam
,
bool
useEditDistance
)
{
bool
bamOutput
,
bool
uncompressedBam
,
bool
useEditDistance
)
{
_bedAFilePE
=
bedAFilePE
;
_bedAFilePE
=
bedAFilePE
;
_bedBFile
=
bedBFile
;
_bedBFile
=
bedBFile
;
_overlapFraction
=
overlapFraction
;
_overlapFraction
=
overlapFraction
;
_forceStrand
=
forceStrand
;
_sameStrand
=
sameStrand
;
_diffStrand
=
diffStrand
;
_useEditDistance
=
useEditDistance
;
_useEditDistance
=
useEditDistance
;
_searchType
=
searchType
;
_searchType
=
searchType
;
_bamInput
=
bamInput
;
_bamInput
=
bamInput
;
...
@@ -80,7 +81,7 @@ void BedIntersectPE::FindOverlaps(const BEDPE &a, vector<BED> &hits1, vector<BED
...
@@ -80,7 +81,7 @@ void BedIntersectPE::FindOverlaps(const BEDPE &a, vector<BED> &hits1, vector<BED
// make sure we have a valid chromosome before we search
// make sure we have a valid chromosome before we search
if
(
a
.
chrom1
!=
"."
)
{
if
(
a
.
chrom1
!=
"."
)
{
// Find the quality hits between ***end1*** of the BEDPE and the B BED file
// Find the quality hits between ***end1*** of the BEDPE and the B BED file
_bedB
->
FindOverlapsPerBin
(
a
.
chrom1
,
a
.
start1
,
a
.
end1
,
a
.
strand1
,
hits1
,
_
force
Strand
);
_bedB
->
FindOverlapsPerBin
(
a
.
chrom1
,
a
.
start1
,
a
.
end1
,
a
.
strand1
,
hits1
,
_
sameStrand
,
_diff
Strand
);
vector
<
BED
>::
const_iterator
h
=
hits1
.
begin
();
vector
<
BED
>::
const_iterator
h
=
hits1
.
begin
();
vector
<
BED
>::
const_iterator
hitsEnd
=
hits1
.
end
();
vector
<
BED
>::
const_iterator
hitsEnd
=
hits1
.
end
();
...
@@ -110,7 +111,7 @@ void BedIntersectPE::FindOverlaps(const BEDPE &a, vector<BED> &hits1, vector<BED
...
@@ -110,7 +111,7 @@ void BedIntersectPE::FindOverlaps(const BEDPE &a, vector<BED> &hits1, vector<BED
// make sure we have a valid chromosome before we search
// make sure we have a valid chromosome before we search
if
(
a
.
chrom2
!=
"."
)
{
if
(
a
.
chrom2
!=
"."
)
{
// Now find the quality hits between ***end2*** of the BEDPE and the B BED file
// Now find the quality hits between ***end2*** of the BEDPE and the B BED file
_bedB
->
FindOverlapsPerBin
(
a
.
chrom2
,
a
.
start2
,
a
.
end2
,
a
.
strand2
,
hits2
,
_
force
Strand
);
_bedB
->
FindOverlapsPerBin
(
a
.
chrom2
,
a
.
start2
,
a
.
end2
,
a
.
strand2
,
hits2
,
_
sameStrand
,
_diff
Strand
);
vector
<
BED
>::
const_iterator
h
=
hits2
.
begin
();
vector
<
BED
>::
const_iterator
h
=
hits2
.
begin
();
vector
<
BED
>::
const_iterator
hitsEnd
=
hits2
.
end
();
vector
<
BED
>::
const_iterator
hitsEnd
=
hits2
.
end
();
...
@@ -198,7 +199,7 @@ bool BedIntersectPE::FindOneOrMoreOverlaps(const BEDPE &a, const string &type) {
...
@@ -198,7 +199,7 @@ bool BedIntersectPE::FindOneOrMoreOverlaps(const BEDPE &a, const string &type) {
// Look for overlaps in end 1 assuming we have an aligned chromosome.
// Look for overlaps in end 1 assuming we have an aligned chromosome.
if
(
a
.
chrom1
!=
"."
)
{
if
(
a
.
chrom1
!=
"."
)
{
end1Found
=
_bedB
->
FindOneOrMoreOverlapsPerBin
(
a
.
chrom1
,
a
.
start1
,
a
.
end1
,
a
.
strand1
,
end1Found
=
_bedB
->
FindOneOrMoreOverlapsPerBin
(
a
.
chrom1
,
a
.
start1
,
a
.
end1
,
a
.
strand1
,
_
force
Strand
,
_overlapFraction
);
_
sameStrand
,
_diff
Strand
,
_overlapFraction
);
// can we bail out without checking end2?
// can we bail out without checking end2?
if
((
type
==
"either"
)
&&
(
end1Found
==
true
))
return
true
;
if
((
type
==
"either"
)
&&
(
end1Found
==
true
))
return
true
;
...
@@ -210,7 +211,7 @@ bool BedIntersectPE::FindOneOrMoreOverlaps(const BEDPE &a, const string &type) {
...
@@ -210,7 +211,7 @@ bool BedIntersectPE::FindOneOrMoreOverlaps(const BEDPE &a, const string &type) {
// Now look for overlaps in end 2 assuming we have an aligned chromosome.
// Now look for overlaps in end 2 assuming we have an aligned chromosome.
if
(
a
.
chrom2
!=
"."
)
{
if
(
a
.
chrom2
!=
"."
)
{
end2Found
=
_bedB
->
FindOneOrMoreOverlapsPerBin
(
a
.
chrom2
,
a
.
start2
,
a
.
end2
,
a
.
strand2
,
end2Found
=
_bedB
->
FindOneOrMoreOverlapsPerBin
(
a
.
chrom2
,
a
.
start2
,
a
.
end2
,
a
.
strand2
,
_
force
Strand
,
_overlapFraction
);
_
sameStrand
,
_diff
Strand
,
_overlapFraction
);
if
((
type
==
"either"
)
&&
(
end2Found
==
true
))
return
true
;
if
((
type
==
"either"
)
&&
(
end2Found
==
true
))
return
true
;
else
if
((
type
==
"neither"
)
&&
(
end2Found
==
true
))
return
false
;
else
if
((
type
==
"neither"
)
&&
(
end2Found
==
true
))
return
false
;
...
@@ -271,7 +272,7 @@ void BedIntersectPE::FindSpanningOverlaps(const BEDPE &a, vector<BED> &hits, con
...
@@ -271,7 +272,7 @@ void BedIntersectPE::FindSpanningOverlaps(const BEDPE &a, vector<BED> &hits, con
spanLength
=
spanEnd
-
spanStart
;
spanLength
=
spanEnd
-
spanStart
;
// get the hits for the span
// get the hits for the span
_bedB
->
FindOverlapsPerBin
(
a
.
chrom1
,
spanStart
,
spanEnd
,
a
.
strand1
,
hits
,
_
force
Strand
);
_bedB
->
FindOverlapsPerBin
(
a
.
chrom1
,
spanStart
,
spanEnd
,
a
.
strand1
,
hits
,
_
sameStrand
,
_diff
Strand
);
vector
<
BED
>::
const_iterator
h
=
hits
.
begin
();
vector
<
BED
>::
const_iterator
h
=
hits
.
begin
();
vector
<
BED
>::
const_iterator
hitsEnd
=
hits
.
end
();
vector
<
BED
>::
const_iterator
hitsEnd
=
hits
.
end
();
...
@@ -324,7 +325,7 @@ bool BedIntersectPE::FindOneOrMoreSpanningOverlaps(const BEDPE &a, const string
...
@@ -324,7 +325,7 @@ bool BedIntersectPE::FindOneOrMoreSpanningOverlaps(const BEDPE &a, const string
spanLength
=
spanEnd
-
spanStart
;
spanLength
=
spanEnd
-
spanStart
;
overlapFound
=
_bedB
->
FindOneOrMoreOverlapsPerBin
(
a
.
chrom1
,
spanStart
,
spanEnd
,
a
.
strand1
,
overlapFound
=
_bedB
->
FindOneOrMoreOverlapsPerBin
(
a
.
chrom1
,
spanStart
,
spanEnd
,
a
.
strand1
,
_
force
Strand
,
_overlapFraction
);
_
sameStrand
,
_diff
Strand
,
_overlapFraction
);
return
overlapFound
;
return
overlapFound
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/pairToBed/pairToBed.h
+
3
−
2
View file @
793ec9f3
...
@@ -43,7 +43,7 @@ public:
...
@@ -43,7 +43,7 @@ public:
// constructor
// constructor
BedIntersectPE
(
string
bedAFilePE
,
string
bedBFile
,
float
overlapFraction
,
BedIntersectPE
(
string
bedAFilePE
,
string
bedBFile
,
float
overlapFraction
,
string
searchType
,
bool
force
Strand
,
bool
bamInput
,
bool
bamOutput
,
bool
uncompressedBam
,
bool
useEditDistance
);
string
searchType
,
bool
sameStrand
,
bool
diff
Strand
,
bool
bamInput
,
bool
bamOutput
,
bool
uncompressedBam
,
bool
useEditDistance
);
// destructor
// destructor
~
BedIntersectPE
(
void
);
~
BedIntersectPE
(
void
);
...
@@ -66,7 +66,8 @@ private:
...
@@ -66,7 +66,8 @@ private:
string
_bedBFile
;
string
_bedBFile
;
float
_overlapFraction
;
float
_overlapFraction
;
string
_searchType
;
string
_searchType
;
bool
_forceStrand
;
bool
_sameStrand
;
bool
_diffStrand
;
bool
_useEditDistance
;
bool
_useEditDistance
;
bool
_bamInput
;
bool
_bamInput
;
bool
_bamOutput
;
bool
_bamOutput
;
...
...
This diff is collapsed.
Click to expand it.
src/pairToBed/pairToBedMain.cpp
+
18
−
5
View file @
793ec9f3
...
@@ -41,7 +41,8 @@ int main(int argc, char* argv[]) {
...
@@ -41,7 +41,8 @@ int main(int argc, char* argv[]) {
bool
haveBedB
=
false
;
bool
haveBedB
=
false
;
bool
haveSearchType
=
false
;
bool
haveSearchType
=
false
;
bool
haveFraction
=
false
;
bool
haveFraction
=
false
;
bool
forceStrand
=
false
;
bool
sameStrand
=
false
;
bool
diffStrand
=
false
;
bool
useEditDistance
=
false
;
bool
useEditDistance
=
false
;
bool
inputIsBam
=
false
;
bool
inputIsBam
=
false
;
bool
outputIsBam
=
true
;
bool
outputIsBam
=
true
;
...
@@ -110,7 +111,10 @@ int main(int argc, char* argv[]) {
...
@@ -110,7 +111,10 @@ int main(int argc, char* argv[]) {
}
}
}
}
else
if
(
PARAMETER_CHECK
(
"-s"
,
2
,
parameterLength
))
{
else
if
(
PARAMETER_CHECK
(
"-s"
,
2
,
parameterLength
))
{
forceStrand
=
true
;
sameStrand
=
true
;
}
else
if
(
PARAMETER_CHECK
(
"-S"
,
2
,
parameterLength
))
{
diffStrand
=
true
;
}
}
else
if
(
PARAMETER_CHECK
(
"-ubam"
,
5
,
parameterLength
))
{
else
if
(
PARAMETER_CHECK
(
"-ubam"
,
5
,
parameterLength
))
{
uncompressedBam
=
true
;
uncompressedBam
=
true
;
...
@@ -136,7 +140,7 @@ int main(int argc, char* argv[]) {
...
@@ -136,7 +140,7 @@ int main(int argc, char* argv[]) {
}
}
if
(
((
searchType
==
"ispan"
)
||
(
searchType
==
"ospan"
)
||
(
searchType
==
"notispan"
)
||
(
searchType
==
"notospan"
))
if
(
((
searchType
==
"ispan"
)
||
(
searchType
==
"ospan"
)
||
(
searchType
==
"notispan"
)
||
(
searchType
==
"notospan"
))
&&
force
Strand
)
{
&&
(
sameStrand
||
diff
Strand
)
)
{
cerr
<<
endl
<<
"*****"
<<
endl
<<
"*****ERROR: Cannot enforce strandedness with selected searchtype"
<<
endl
<<
"*****"
<<
endl
;
cerr
<<
endl
<<
"*****"
<<
endl
<<
"*****ERROR: Cannot enforce strandedness with selected searchtype"
<<
endl
<<
"*****"
<<
endl
;
showHelp
=
true
;
showHelp
=
true
;
}
}
...
@@ -145,11 +149,16 @@ int main(int argc, char* argv[]) {
...
@@ -145,11 +149,16 @@ int main(int argc, char* argv[]) {
cerr
<<
endl
<<
"*****"
<<
endl
<<
"*****ERROR: -ed must be used with -bedpe and -abam."
<<
endl
<<
"*****"
<<
endl
;
cerr
<<
endl
<<
"*****"
<<
endl
<<
"*****ERROR: -ed must be used with -bedpe and -abam."
<<
endl
<<
"*****"
<<
endl
;
showHelp
=
true
;
showHelp
=
true
;
}
}
if
(
sameStrand
&&
diffStrand
)
{
cerr
<<
endl
<<
"*****"
<<
endl
<<
"*****ERROR: Request either -s OR -S, not both."
<<
endl
<<
"*****"
<<
endl
;
showHelp
=
true
;
}
if
(
!
showHelp
)
{
if
(
!
showHelp
)
{
BedIntersectPE
*
bi
=
new
BedIntersectPE
(
bedAFile
,
bedBFile
,
overlapFraction
,
BedIntersectPE
*
bi
=
new
BedIntersectPE
(
bedAFile
,
bedBFile
,
overlapFraction
,
searchType
,
force
Strand
,
inputIsBam
,
searchType
,
sameStrand
,
diff
Strand
,
inputIsBam
,
outputIsBam
,
uncompressedBam
,
useEditDistance
);
outputIsBam
,
uncompressedBam
,
useEditDistance
);
delete
bi
;
delete
bi
;
return
0
;
return
0
;
...
@@ -190,7 +199,11 @@ void ShowHelp(void) {
...
@@ -190,7 +199,11 @@ void ShowHelp(void) {
cerr
<<
"
\t
-f
\t
"
<<
"Minimum overlap required as fraction of A (e.g. 0.05)."
<<
endl
;
cerr
<<
"
\t
-f
\t
"
<<
"Minimum overlap required as fraction of A (e.g. 0.05)."
<<
endl
;
cerr
<<
"
\t\t
Default is 1E-9 (effectively 1bp)."
<<
endl
<<
endl
;
cerr
<<
"
\t\t
Default is 1E-9 (effectively 1bp)."
<<
endl
<<
endl
;
cerr
<<
"
\t
-s
\t
"
<<
"Enforce strandedness when finding overlaps."
<<
endl
;
cerr
<<
"
\t
-s
\t
"
<<
"Require same strandedness when finding overlaps."
<<
endl
;
cerr
<<
"
\t\t
Default is to ignore stand."
<<
endl
;
cerr
<<
"
\t\t
Not applicable with -type inspan or -type outspan."
<<
endl
<<
endl
;
cerr
<<
"
\t
-S
\t
"
<<
"Require different strandedness when finding overlaps."
<<
endl
;
cerr
<<
"
\t\t
Default is to ignore stand."
<<
endl
;
cerr
<<
"
\t\t
Default is to ignore stand."
<<
endl
;
cerr
<<
"
\t\t
Not applicable with -type inspan or -type outspan."
<<
endl
<<
endl
;
cerr
<<
"
\t\t
Not applicable with -type inspan or -type outspan."
<<
endl
<<
endl
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment