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
a3c8e702
Commit
a3c8e702
authored
13 years ago
by
Aaron
Browse files
Options
Downloads
Patches
Plain Diff
Added -S to coverageBed
parent
8e72b209
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/coverageBed/coverageBed.cpp
+7
-6
7 additions, 6 deletions
src/coverageBed/coverageBed.cpp
src/coverageBed/coverageBed.h
+4
-3
4 additions, 3 deletions
src/coverageBed/coverageBed.h
src/coverageBed/coverageMain.cpp
+20
-6
20 additions, 6 deletions
src/coverageBed/coverageMain.cpp
with
31 additions
and
15 deletions
src/coverageBed/coverageBed.cpp
+
7
−
6
View file @
a3c8e702
...
...
@@ -13,7 +13,7 @@
#include
"coverageBed.h"
// build
BedCoverage
::
BedCoverage
(
string
&
bedAFile
,
string
&
bedBFile
,
bool
forc
eStrand
,
BedCoverage
::
BedCoverage
(
string
&
bedAFile
,
string
&
bedBFile
,
bool
sam
eStrand
,
bool
diffStrand
,
bool
writeHistogram
,
bool
bamInput
,
bool
obeySplits
,
bool
eachBase
,
bool
countsOnly
)
{
...
...
@@ -23,7 +23,8 @@ BedCoverage::BedCoverage(string &bedAFile, string &bedBFile, bool forceStrand,
_bedA
=
new
BedFile
(
bedAFile
);
_bedB
=
new
BedFile
(
bedBFile
);
_forceStrand
=
forceStrand
;
_sameStrand
=
sameStrand
;
_diffStrand
=
diffStrand
;
_obeySplits
=
obeySplits
;
_eachBase
=
eachBase
;
_writeHistogram
=
writeHistogram
;
...
...
@@ -60,7 +61,7 @@ void BedCoverage::CollectCoverageBed() {
if
(
bedStatus
==
BED_VALID
)
{
// process the BED entry as a single block
if
(
_obeySplits
==
false
)
_bedB
->
countHits
(
a
,
_
force
Strand
,
_countsOnly
);
_bedB
->
countHits
(
a
,
_
sameStrand
,
_diff
Strand
,
_countsOnly
);
// split the BED into discrete blocksand process each independently.
else
{
bedVector
bedBlocks
;
...
...
@@ -68,7 +69,7 @@ void BedCoverage::CollectCoverageBed() {
// use countSplitHits to avoid over-counting each split chunk
// as distinct read coverage.
_bedB
->
countSplitHits
(
bedBlocks
,
_
force
Strand
,
_countsOnly
);
_bedB
->
countSplitHits
(
bedBlocks
,
_
sameStrand
,
_diff
Strand
,
_countsOnly
);
}
a
=
nullBed
;
}
...
...
@@ -112,7 +113,7 @@ void BedCoverage::CollectCoverageBam(string bamFile) {
a
.
strand
=
"+"
;
if
(
bam
.
IsReverseStrand
())
a
.
strand
=
"-"
;
_bedB
->
countHits
(
a
,
_
force
Strand
,
_countsOnly
);
_bedB
->
countHits
(
a
,
_
sameStrand
,
_diff
Strand
,
_countsOnly
);
}
// split the BAM alignment into discrete blocks and
// look for overlaps only within each block.
...
...
@@ -124,7 +125,7 @@ void BedCoverage::CollectCoverageBam(string bamFile) {
getBamBlocks
(
bam
,
refs
,
bedBlocks
,
true
);
// use countSplitHits to avoid over-counting each split chunk
// as distinct read coverage.
_bedB
->
countSplitHits
(
bedBlocks
,
_
force
Strand
,
_countsOnly
);
_bedB
->
countSplitHits
(
bedBlocks
,
_
sameStrand
,
_diff
Strand
,
_countsOnly
);
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/coverageBed/coverageBed.h
+
4
−
3
View file @
a3c8e702
...
...
@@ -36,7 +36,7 @@ class BedCoverage {
public:
// constructor
BedCoverage
(
string
&
bedAFile
,
string
&
bedBFile
,
bool
force
Strand
,
bool
writeHistogram
,
BedCoverage
(
string
&
bedAFile
,
string
&
bedBFile
,
bool
sameStrand
,
bool
diff
Strand
,
bool
writeHistogram
,
bool
bamInput
,
bool
obeySplits
,
bool
eachBase
,
bool
countsOnly
);
// destructor
...
...
@@ -51,8 +51,9 @@ private:
// instance of a bed file class.
BedFile
*
_bedA
,
*
_bedB
;
// do we care about strandedness when counting coverage?
bool
_forceStrand
;
// do we care about same or opposite strandedness when counting coverage?
bool
_sameStrand
;
bool
_diffStrand
;
// should we write a histogram for each feature in B?
bool
_writeHistogram
;
...
...
This diff is collapsed.
Click to expand it.
src/coverageBed/coverageMain.cpp
+
20
−
6
View file @
a3c8e702
...
...
@@ -33,7 +33,8 @@ int main(int argc, char* argv[]) {
string
bedBFile
;
// parm flags
bool
forceStrand
=
false
;
bool
sameStrand
=
false
;
bool
diffStrand
=
false
;
bool
writeHistogram
=
false
;
bool
eachBase
=
false
;
bool
obeySplits
=
false
;
...
...
@@ -84,7 +85,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
if
(
PARAMETER_CHECK
(
"-hist"
,
5
,
parameterLength
))
{
writeHistogram
=
true
;
...
...
@@ -109,9 +113,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
)
{
BedCoverage
*
bg
=
new
BedCoverage
(
bedAFile
,
bedBFile
,
forceStrand
,
writeHistogram
,
bamInput
,
obeySplits
,
eachBase
,
countsOnly
);
BedCoverage
*
bg
=
new
BedCoverage
(
bedAFile
,
bedBFile
,
sameStrand
,
diffStrand
,
writeHistogram
,
bamInput
,
obeySplits
,
eachBase
,
countsOnly
);
delete
bg
;
return
0
;
}
...
...
@@ -135,9 +145,13 @@ void ShowHelp(void) {
cerr
<<
"
\t
-abam
\t
"
<<
"The A input file is in BAM format."
<<
endl
<<
endl
;
cerr
<<
"
\t
-s
\t
"
<<
"Force strandedness. That is, only include hits in A that"
<<
endl
;
cerr
<<
"
\t\t
overlap B on the same strand."
<<
endl
;
cerr
<<
"
\t\t
- By default, hits are included without respect to strand."
<<
endl
<<
endl
;
cerr
<<
"
\t
-s
\t
"
<<
"Require same strandedness. That is, only counts hits in A that"
<<
endl
;
cerr
<<
"
\t\t
overlap B on the _same_ strand."
<<
endl
;
cerr
<<
"
\t\t
- By default, overlaps are counted without respect to strand."
<<
endl
<<
endl
;
cerr
<<
"
\t
-S
\t
"
<<
"Require different strandedness. That is, only report hits in A that"
<<
endl
;
cerr
<<
"
\t\t
overlap B on the _opposite_ strand."
<<
endl
;
cerr
<<
"
\t\t
- By default, overlaps are counted without respect to strand."
<<
endl
<<
endl
;
cerr
<<
"
\t
-hist
\t
"
<<
"Report a histogram of coverage for each feature in B"
<<
endl
;
cerr
<<
"
\t\t
as well as a summary histogram for _all_ features in B."
<<
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