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
8c626811
Commit
8c626811
authored
12 years ago
by
Aaron
Browse files
Options
Downloads
Patches
Plain Diff
handle unaligned BAMs with -v
parent
acf2ec5e
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/intersectBed/intersectBed.cpp
+5
-5
5 additions, 5 deletions
src/intersectBed/intersectBed.cpp
test/intersect/mapped_and_unmapped.sam
+4
-0
4 additions, 0 deletions
test/intersect/mapped_and_unmapped.sam
test/intersect/test-intersect.sh
+21
-0
21 additions, 0 deletions
test/intersect/test-intersect.sh
with
30 additions
and
5 deletions
src/intersectBed/intersectBed.cpp
+
5
−
5
View file @
8c626811
...
...
@@ -323,12 +323,12 @@ void BedIntersect::IntersectBam(string bamFile) {
// get each set of alignments for each pair.
while
(
reader
.
GetNextAlignment
(
bam
))
{
//
BAM IsMapped() is false
if
(
(
!
bam
.
IsMapped
())
&&
(
_noHit
==
true
))
writer
.
SaveAlignment
(
bam
);
else
if
(
!
bam
.
IsMapped
())
//
save an unaligned read if -v
if
(
!
bam
.
IsMapped
())
{
if
(
_noHit
==
true
)
writer
.
SaveAlignment
(
bam
);
continue
;
}
// break alignment into discrete blocks,
bedVector
bed_blocks
;
string
chrom
=
refs
.
at
(
bam
.
RefID
).
RefName
;
...
...
This diff is collapsed.
Click to expand it.
test/intersect/mapped_and_unmapped.sam
0 → 100644
+
4
−
0
View file @
8c626811
@HD VN:1.0 GO:none SO:coordinate
@SQ SN:chr1 LN:249250621
mapped 16 chr1 1 40 30M * 0 0 GAAGGCCACCGCCGCGGTTATTTTCCTTCA CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI MD:Z:50
umapped 4 * 1 40 30M * 0 0 GAAGGCCACCGCCGCGGTTATTTTCCTTCA CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI MD:Z:50
This diff is collapsed.
Click to expand it.
test/intersect/test-intersect.sh
+
21
−
0
View file @
8c626811
...
...
@@ -254,4 +254,25 @@ check obs exp
rm
obs exp
##################################################################
# Test that only the mapped read is is found as an intersection
##################################################################
echo
" intersect.t23...
\c
"
echo
\
"mapped 16 chr1 1 40 30M * 0 0 GAAGGCCACCGCCGCGGTTATTTTCCTTCA CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI MD:Z:50"
>
exp
samtools view
-Sb
mapped_and_unmapped.sam 2>/dev/null |
$BT
intersect
-abam
-
-b
a.bed | samtools view -
>
obs
check obs exp
rm
obs exp
##################################################################
# Test that an unmapped read is handled properly with -v
##################################################################
echo
" intersect.t24...
\c
"
echo
\
"umapped 4 * 1 40 30M * 0 0 GAAGGCCACCGCCGCGGTTATTTTCCTTCA CCCDDB?=FJIIJIGFJIJHIJJJJJJJJI MD:Z:50"
>
exp
samtools view
-Sb
mapped_and_unmapped.sam 2>/dev/null |
$BT
intersect
-abam
-
-b
a.bed
-v
| samtools view -
>
obs
check obs exp
rm
obs exp
rm
*
.bam
\ No newline at end of file
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