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
39ce5531
Commit
39ce5531
authored
13 years ago
by
Aaron
Browse files
Options
Downloads
Patches
Plain Diff
Added -S to subtractBed
parent
793ec9f3
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/subtractBed/subtractBed.cpp
+4
-3
4 additions, 3 deletions
src/subtractBed/subtractBed.cpp
src/subtractBed/subtractBed.h
+4
-2
4 additions, 2 deletions
src/subtractBed/subtractBed.h
src/subtractBed/subtractMain.cpp
+18
-6
18 additions, 6 deletions
src/subtractBed/subtractMain.cpp
with
26 additions
and
11 deletions
src/subtractBed/subtractBed.cpp
+
4
−
3
View file @
39ce5531
...
...
@@ -16,12 +16,13 @@
/*
Constructor
*/
BedSubtract
::
BedSubtract
(
string
&
bedAFile
,
string
&
bedBFile
,
float
&
overlapFraction
,
bool
&
force
Strand
)
{
BedSubtract
::
BedSubtract
(
string
&
bedAFile
,
string
&
bedBFile
,
float
overlapFraction
,
bool
sameStrand
,
bool
diff
Strand
)
{
_bedAFile
=
bedAFile
;
_bedBFile
=
bedBFile
;
_overlapFraction
=
overlapFraction
;
_forceStrand
=
forceStrand
;
_sameStrand
=
sameStrand
;
_diffStrand
=
diffStrand
;
_bedA
=
new
BedFile
(
bedAFile
);
_bedB
=
new
BedFile
(
bedBFile
);
...
...
@@ -40,7 +41,7 @@ BedSubtract::~BedSubtract(void) {
void
BedSubtract
::
FindAndSubtractOverlaps
(
BED
&
a
,
vector
<
BED
>
&
hits
)
{
// find all of the overlaps between a and B.
_bedB
->
FindOverlapsPerBin
(
a
.
chrom
,
a
.
start
,
a
.
end
,
a
.
strand
,
hits
,
_
force
Strand
);
_bedB
->
FindOverlapsPerBin
(
a
.
chrom
,
a
.
start
,
a
.
end
,
a
.
strand
,
hits
,
_
sameStrand
,
_diff
Strand
);
// is A completely spanned by an entry in B?
// if so, A should not be reported.
...
...
This diff is collapsed.
Click to expand it.
src/subtractBed/subtractBed.h
+
4
−
2
View file @
39ce5531
...
...
@@ -27,7 +27,7 @@ class BedSubtract {
public:
// constructor
BedSubtract
(
string
&
bedAFile
,
string
&
bedBFile
,
float
&
overlapFraction
,
bool
&
force
Strand
);
BedSubtract
(
string
&
bedAFile
,
string
&
bedBFile
,
float
overlapFraction
,
bool
sameStrand
,
bool
diff
Strand
);
// destructor
~
BedSubtract
(
void
);
...
...
@@ -38,7 +38,9 @@ private:
string
_bedAFile
;
string
_bedBFile
;
float
_overlapFraction
;
bool
_forceStrand
;
bool
_sameStrand
;
bool
_diffStrand
;
// instances of bed file class.
BedFile
*
_bedA
,
*
_bedB
;
...
...
This diff is collapsed.
Click to expand it.
src/subtractBed/subtractMain.cpp
+
18
−
6
View file @
39ce5531
...
...
@@ -39,7 +39,8 @@ int main(int argc, char* argv[]) {
bool
haveBedA
=
false
;
bool
haveBedB
=
false
;
bool
haveFraction
=
false
;
bool
forceStrand
=
false
;
bool
sameStrand
=
false
;
bool
diffStrand
=
false
;
// check to see if we should print out some help
if
(
argc
<=
1
)
showHelp
=
true
;
...
...
@@ -82,7 +83,10 @@ int main(int argc, char* argv[]) {
}
}
else
if
(
PARAMETER_CHECK
(
"-s"
,
2
,
parameterLength
))
{
forceStrand
=
true
;
sameStrand
=
true
;
}
else
if
(
PARAMETER_CHECK
(
"-S"
,
2
,
parameterLength
))
{
diffStrand
=
true
;
}
else
{
cerr
<<
endl
<<
"*****ERROR: Unrecognized parameter: "
<<
argv
[
i
]
<<
" *****"
<<
endl
<<
endl
;
...
...
@@ -95,10 +99,15 @@ int main(int argc, char* argv[]) {
cerr
<<
endl
<<
"*****"
<<
endl
<<
"*****ERROR: Need -a and -b files. "
<<
endl
<<
"*****"
<<
endl
;
showHelp
=
true
;
}
if
(
sameStrand
&&
diffStrand
)
{
cerr
<<
endl
<<
"*****"
<<
endl
<<
"*****ERROR: Request either -s OR -S, not both."
<<
endl
<<
"*****"
<<
endl
;
showHelp
=
true
;
}
if
(
!
showHelp
)
{
BedSubtract
*
bs
=
new
BedSubtract
(
bedAFile
,
bedBFile
,
overlapFraction
,
force
Strand
);
BedSubtract
*
bs
=
new
BedSubtract
(
bedAFile
,
bedBFile
,
overlapFraction
,
sameStrand
,
diff
Strand
);
delete
bs
;
return
0
;
}
...
...
@@ -123,10 +132,13 @@ void ShowHelp(void) {
cerr
<<
"
\t\t
- Default is 1E-9 (i.e., 1bp)."
<<
endl
;
cerr
<<
"
\t\t
- (FLOAT) (e.g. 0.50)"
<<
endl
<<
endl
;
cerr
<<
"
\t
-s
\t
"
<<
"
Forc
e strandedness. That is, only
repor
t hits in B that"
<<
endl
;
cerr
<<
"
\t\t
overlap A on the same strand."
<<
endl
;
cerr
<<
"
\t\t
- By default, overlaps are
repor
ted without respect to strand."
<<
endl
<<
endl
;
cerr
<<
"
\t
-s
\t
"
<<
"
Require sam
e strandedness. That is, only
subtrac
t hits in B that"
<<
endl
;
cerr
<<
"
\t\t
overlap A on the
_
same
_
strand."
<<
endl
;
cerr
<<
"
\t\t
- By default, overlaps are
subtrac
ted without respect to strand."
<<
endl
<<
endl
;
cerr
<<
"
\t
-S
\t
"
<<
"Force strandedness. That is, only subtract hits in B that"
<<
endl
;
cerr
<<
"
\t\t
overlap A on the _opposite_ strand."
<<
endl
;
cerr
<<
"
\t\t
- By default, overlaps are subtracted without respect to strand."
<<
endl
<<
endl
;
// end the program here
exit
(
1
);
...
...
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