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
afc844d4
Commit
afc844d4
authored
13 years ago
by
Aaron
Browse files
Options
Downloads
Patches
Plain Diff
Added logic to keep dups and failed QC for multiBamCov. Thanks to Chip Stewart.
parent
04a6b489
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/multiBamCov/multiBamCov.cpp
+11
-3
11 additions, 3 deletions
src/multiBamCov/multiBamCov.cpp
src/multiBamCov/multiBamCov.h
+6
-1
6 additions, 1 deletion
src/multiBamCov/multiBamCov.h
src/multiBamCov/multiBamCovMain.cpp
+18
-1
18 additions, 1 deletion
src/multiBamCov/multiBamCovMain.cpp
with
35 additions
and
5 deletions
src/multiBamCov/multiBamCov.cpp
+
11
−
3
View file @
afc844d4
...
@@ -17,12 +17,16 @@
...
@@ -17,12 +17,16 @@
/*
/*
Constructor
Constructor
*/
*/
MultiCovBam
::
MultiCovBam
(
const
vector
<
string
>
&
bam_files
,
const
string
bed_file
,
int
minQual
,
bool
properOnly
)
MultiCovBam
::
MultiCovBam
(
const
vector
<
string
>
&
bam_files
,
const
string
bed_file
,
int
minQual
,
bool
properOnly
,
bool
keepDuplicates
,
bool
keepFailedQC
)
:
:
_bam_files
(
bam_files
),
_bam_files
(
bam_files
),
_bed_file
(
bed_file
),
_bed_file
(
bed_file
),
_minQual
(
minQual
),
_minQual
(
minQual
),
_properOnly
(
properOnly
)
_properOnly
(
properOnly
),
_keepDuplicates
(
keepDuplicates
),
_keepFailedQC
(
keepFailedQC
)
{
{
_bed
=
new
BedFile
(
_bed_file
);
_bed
=
new
BedFile
(
_bed_file
);
LoadBamFileMap
();
LoadBamFileMap
();
...
@@ -76,8 +80,12 @@ void MultiCovBam::CollectCoverage()
...
@@ -76,8 +80,12 @@ void MultiCovBam::CollectCoverage()
BamAlignment
al
;
BamAlignment
al
;
while
(
reader
.
GetNextAlignment
(
al
)
)
while
(
reader
.
GetNextAlignment
(
al
)
)
{
{
bool
duplicate
=
al
.
IsDuplicate
();
bool
failedQC
=
al
.
IsFailedQC
();
if
(
_keepDuplicates
)
duplicate
=
false
;
if
(
_keepFailedQC
)
failedQC
=
false
;
// map qual must exceed minimum
// map qual must exceed minimum
if
(
al
.
MapQuality
>=
_minQual
)
{
if
(
(
al
.
MapQuality
>=
_minQual
)
&&
(
!
duplicate
)
&&
(
!
failedQC
))
{
// ignore if not properly paired and we actually care.
// ignore if not properly paired and we actually care.
if
(
_properOnly
&&
!
al
.
IsProperPair
())
if
(
_properOnly
&&
!
al
.
IsProperPair
())
continue
;
continue
;
...
...
This diff is collapsed.
Click to expand it.
src/multiBamCov/multiBamCov.h
+
6
−
1
View file @
afc844d4
...
@@ -30,7 +30,9 @@ class MultiCovBam {
...
@@ -30,7 +30,9 @@ class MultiCovBam {
public:
public:
// constructor
// constructor
MultiCovBam
(
const
vector
<
string
>
&
bam_files
,
const
string
bed_file
,
int
minQual
,
bool
properOnly
);
MultiCovBam
(
const
vector
<
string
>
&
bam_files
,
const
string
bed_file
,
int
minQual
,
bool
properOnly
,
bool
keepDuplicates
,
bool
keepFailedQC
);
// destructor
// destructor
~
MultiCovBam
(
void
);
~
MultiCovBam
(
void
);
...
@@ -49,6 +51,9 @@ private:
...
@@ -49,6 +51,9 @@ private:
// attributes to control what is counted
// attributes to control what is counted
int
_minQual
;
int
_minQual
;
bool
_properOnly
;
bool
_properOnly
;
bool
_keepDuplicates
;
bool
_keepFailedQC
;
map
<
string
,
int
>
bamFileMap
;
map
<
string
,
int
>
bamFileMap
;
...
...
This diff is collapsed.
Click to expand it.
src/multiBamCov/multiBamCovMain.cpp
+
18
−
1
View file @
afc844d4
...
@@ -38,6 +38,8 @@ int main(int argc, char* argv[]) {
...
@@ -38,6 +38,8 @@ int main(int argc, char* argv[]) {
bool
haveBed
=
false
;
bool
haveBed
=
false
;
bool
haveBams
=
false
;
bool
haveBams
=
false
;
bool
properOnly
=
false
;
bool
properOnly
=
false
;
bool
keepDuplicates
=
false
;
bool
keepFailedQC
=
false
;
// check to see if we should print out some help
// check to see if we should print out some help
if
(
argc
<=
1
)
showHelp
=
true
;
if
(
argc
<=
1
)
showHelp
=
true
;
...
@@ -88,10 +90,21 @@ int main(int argc, char* argv[]) {
...
@@ -88,10 +90,21 @@ int main(int argc, char* argv[]) {
else
if
(
PARAMETER_CHECK
(
"-p"
,
2
,
parameterLength
))
{
else
if
(
PARAMETER_CHECK
(
"-p"
,
2
,
parameterLength
))
{
properOnly
=
true
;
properOnly
=
true
;
}
}
else
if
(
PARAMETER_CHECK
(
"-D"
,
2
,
parameterLength
))
{
keepDuplicates
=
true
;
}
else
if
(
PARAMETER_CHECK
(
"-F"
,
2
,
parameterLength
))
{
keepFailedQC
=
true
;
}
else
{
cerr
<<
endl
<<
"*****ERROR: Unrecognized parameter: "
<<
argv
[
i
]
<<
" *****"
<<
endl
<<
endl
;
showHelp
=
true
;
}
}
}
if
(
!
showHelp
)
{
if
(
!
showHelp
)
{
MultiCovBam
*
mc
=
new
MultiCovBam
(
bamFiles
,
bedFile
,
minQual
,
properOnly
);
MultiCovBam
*
mc
=
new
MultiCovBam
(
bamFiles
,
bedFile
,
minQual
,
properOnly
,
keepDuplicates
,
keepFailedQC
);
mc
->
CollectCoverage
();
mc
->
CollectCoverage
();
delete
mc
;
delete
mc
;
return
0
;
return
0
;
...
@@ -119,6 +132,10 @@ void ShowHelp(void) {
...
@@ -119,6 +132,10 @@ void ShowHelp(void) {
cerr
<<
"
\t
-q
\t
"
<<
"Minimum mapping quality allowed. Default is 0."
<<
endl
<<
endl
;
cerr
<<
"
\t
-q
\t
"
<<
"Minimum mapping quality allowed. Default is 0."
<<
endl
<<
endl
;
cerr
<<
"
\t
-D
\t
"
<<
"Include duplicate-marked reads. Default is to count non-duplicates only"
<<
endl
<<
endl
;
cerr
<<
"
\t
-F
\t
"
<<
"Include failed-QC reads. Default is to count pass-QC reads only"
<<
endl
<<
endl
;
cerr
<<
"
\t
-p
\t
"
<<
"Only count proper pairs. Default is to count all alignments with MAPQ"
<<
endl
;
cerr
<<
"
\t
-p
\t
"
<<
"Only count proper pairs. Default is to count all alignments with MAPQ"
<<
endl
;
cerr
<<
"
\t\t
"
<<
"greater than the -q argument, regardless of the BAM FLAG field."
<<
endl
<<
endl
;
cerr
<<
"
\t\t
"
<<
"greater than the -q argument, regardless of the BAM FLAG field."
<<
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