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
6cfb163f
Commit
6cfb163f
authored
15 years ago
by
Aaron
Browse files
Options
Downloads
Patches
Plain Diff
Renamed end to alignmentEnd in bamToBed
parent
d5fb4610
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/bamToBed/bamToBed.cpp
+15
-15
15 additions, 15 deletions
src/bamToBed/bamToBed.cpp
with
15 additions
and
15 deletions
src/bamToBed/bamToBed.cpp
+
15
−
15
View file @
6cfb163f
...
...
@@ -187,7 +187,7 @@ void ShowHelp(void) {
}
void
ParseCigarBed
(
const
vector
<
CigarOp
>
cigar
,
unsigned
int
&
e
nd
)
{
void
ParseCigarBed
(
const
vector
<
CigarOp
>
cigar
,
unsigned
int
&
alignmentE
nd
)
{
int
currPosition
=
0
;
...
...
@@ -198,11 +198,11 @@ void ParseCigarBed(const vector<CigarOp> cigar, unsigned int &end) {
for
(;
cigItr
!=
cigEnd
;
++
cigItr
)
{
if
(
cigItr
->
Type
==
'M'
)
currPosition
+=
cigItr
->
Length
;
}
e
nd
=
currPosition
;
alignmentE
nd
=
currPosition
;
}
void
ParseCigarBed12
(
const
vector
<
CigarOp
>
cigar
,
vector
<
int
>
&
blockStarts
,
vector
<
int
>
&
blockLengths
,
unsigned
int
&
e
nd
)
{
void
ParseCigarBed12
(
const
vector
<
CigarOp
>
cigar
,
vector
<
int
>
&
blockStarts
,
vector
<
int
>
&
blockLengths
,
unsigned
int
&
alignmentE
nd
)
{
int
currPosition
=
0
;
int
blockLength
=
0
;
...
...
@@ -232,13 +232,13 @@ void ParseCigarBed12(const vector<CigarOp> cigar, vector<int> &blockStarts, vect
}
blockLengths
.
push_back
(
blockLength
);
e
nd
=
currPosition
;
alignmentE
nd
=
currPosition
;
}
void
PrintBed
(
const
BamAlignment
&
bam
,
const
RefVector
&
refs
,
bool
useEditDistance
)
{
unsigned
int
e
nd
;
unsigned
int
alignmentE
nd
;
string
strand
=
"+"
;
if
(
bam
.
IsReverseStrand
())
strand
=
"-"
;
...
...
@@ -247,18 +247,18 @@ void PrintBed(const BamAlignment &bam, const RefVector &refs, bool useEditDista
if
(
bam
.
IsSecondMate
())
name
+=
"/2"
;
// rip through the CIGAR string and reconstruct the alignment coordinates
ParseCigarBed
(
bam
.
CigarData
,
e
nd
);
e
nd
+=
bam
.
Position
;
ParseCigarBed
(
bam
.
CigarData
,
alignmentE
nd
);
alignmentE
nd
+=
bam
.
Position
;
if
(
useEditDistance
==
false
)
{
printf
(
"%s
\t
%d
\t
%d
\t
\%s
\t
%d
\t
%s
\n
"
,
refs
.
at
(
bam
.
RefID
).
RefName
.
c_str
(),
bam
.
Position
,
e
nd
,
name
.
c_str
(),
bam
.
MapQuality
,
strand
.
c_str
());
alignmentE
nd
,
name
.
c_str
(),
bam
.
MapQuality
,
strand
.
c_str
());
}
else
{
uint8_t
editDistance
;
if
(
bam
.
GetEditDistance
(
editDistance
))
{
printf
(
"%s
\t
%d
\t
%d
\t
\%s
\t
%u
\t
%s
\n
"
,
refs
.
at
(
bam
.
RefID
).
RefName
.
c_str
(),
bam
.
Position
,
e
nd
,
name
.
c_str
(),
editDistance
,
strand
.
c_str
());
alignmentE
nd
,
name
.
c_str
(),
editDistance
,
strand
.
c_str
());
}
else
{
cerr
<<
"The edit distance tag (NM) was not found in the BAM file. Please disable -ed. Exiting
\n
"
;
...
...
@@ -276,25 +276,25 @@ void PrintBed12(const BamAlignment &bam, const RefVector &refs, bool useEditDist
if
(
bam
.
IsFirstMate
())
name
+=
"/1"
;
if
(
bam
.
IsSecondMate
())
name
+=
"/2"
;
unsigned
int
e
nd
;
unsigned
int
alignmentE
nd
;
vector
<
int
>
blockLengths
;
vector
<
int
>
blockStarts
;
blockStarts
.
push_back
(
0
);
// by default, we have a block start at the start of the alignment.
// rip through the CIGAR string and reconstruct the alignment coordinates
ParseCigarBed12
(
bam
.
CigarData
,
blockStarts
,
blockLengths
,
e
nd
);
e
nd
+=
bam
.
Position
;
ParseCigarBed12
(
bam
.
CigarData
,
blockStarts
,
blockLengths
,
alignmentE
nd
);
alignmentE
nd
+=
bam
.
Position
;
// write BED6 portion
if
(
useEditDistance
==
false
)
{
printf
(
"%s
\t
%d
\t
%d
\t
\%s
\t
%d
\t
%s
\t
"
,
refs
.
at
(
bam
.
RefID
).
RefName
.
c_str
(),
bam
.
Position
,
e
nd
,
name
.
c_str
(),
bam
.
MapQuality
,
strand
.
c_str
());
alignmentE
nd
,
name
.
c_str
(),
bam
.
MapQuality
,
strand
.
c_str
());
}
else
{
uint8_t
editDistance
;
if
(
bam
.
GetEditDistance
(
editDistance
))
{
printf
(
"%s
\t
%d
\t
%d
\t
\%s
\t
%u
\t
%s
\t
"
,
refs
.
at
(
bam
.
RefID
).
RefName
.
c_str
(),
bam
.
Position
,
e
nd
,
name
.
c_str
(),
editDistance
,
strand
.
c_str
());
alignmentE
nd
,
name
.
c_str
(),
editDistance
,
strand
.
c_str
());
}
else
{
cerr
<<
"The edit distance tag (NM) was not found in the BAM file. Please disable -ed. Exiting
\n
"
;
...
...
@@ -303,7 +303,7 @@ void PrintBed12(const BamAlignment &bam, const RefVector &refs, bool useEditDist
}
// write the colors, etc.
printf
(
"%d
\t
%d
\t
%s
\t
%d
\t
"
,
bam
.
Position
,
e
nd
,
color
.
c_str
(),
(
int
)
blockStarts
.
size
());
printf
(
"%d
\t
%d
\t
%s
\t
%d
\t
"
,
bam
.
Position
,
alignmentE
nd
,
color
.
c_str
(),
(
int
)
blockStarts
.
size
());
// now write the lengths portion
unsigned
int
b
;
...
...
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