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
9fc914ad
Commit
9fc914ad
authored
13 years ago
by
Aaron
Browse files
Options
Downloads
Patches
Plain Diff
User can define their own tag type for tagBam.
parent
5490e938
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/tagBam/tagBam.cpp
+4
-2
4 additions, 2 deletions
src/tagBam/tagBam.cpp
src/tagBam/tagBam.h
+3
-1
3 additions, 1 deletion
src/tagBam/tagBam.h
src/tagBam/tagBamMain.cpp
+20
-4
20 additions, 4 deletions
src/tagBam/tagBamMain.cpp
with
27 additions
and
7 deletions
src/tagBam/tagBam.cpp
+
4
−
2
View file @
9fc914ad
...
...
@@ -14,11 +14,13 @@
// build
TagBam
::
TagBam
(
const
string
&
bamFile
,
const
vector
<
string
>
&
annoFileNames
,
const
vector
<
string
>
&
annoLables
,
bool
forceStrand
,
float
overlapFraction
)
:
const
vector
<
string
>
&
annoLables
,
const
string
&
tag
,
bool
forceStrand
,
float
overlapFraction
)
:
_bamFile
(
bamFile
),
_annoFileNames
(
annoFileNames
),
_annoLabels
(
annoLables
),
_tag
(
tag
),
_forceStrand
(
forceStrand
),
_overlapFraction
(
overlapFraction
)
{}
...
...
@@ -97,7 +99,7 @@ void TagBam::Tag() {
}
// were there any overlaps with which to make a tag?
if
(
annotations
.
str
().
size
()
>
0
)
{
al
.
AddTag
(
"YB"
,
"Z"
,
annotations
.
str
().
substr
(
0
,
annotations
.
str
().
size
()
-
1
));
// get rid of the last ";"
al
.
AddTag
(
_tag
,
"Z"
,
annotations
.
str
().
substr
(
0
,
annotations
.
str
().
size
()
-
1
));
// get rid of the last ";"
}
writer
.
SaveAlignment
(
al
);
}
...
...
This diff is collapsed.
Click to expand it.
src/tagBam/tagBam.h
+
3
−
1
View file @
9fc914ad
...
...
@@ -40,7 +40,8 @@ public:
// constructor
TagBam
(
const
string
&
bamFile
,
const
vector
<
string
>
&
annoFileNames
,
const
vector
<
string
>
&
annoLabels
,
bool
forceStrand
,
float
overlapFraction
);
const
vector
<
string
>
&
annoLabels
,
const
string
&
tag
,
bool
forceStrand
,
float
overlapFraction
);
// destructor
~
TagBam
(
void
);
...
...
@@ -54,6 +55,7 @@ private:
string
_bamFile
;
vector
<
string
>
_annoFileNames
;
vector
<
string
>
_annoLabels
;
string
_tag
;
// instance of a bed file class.
BedFile
*
_bed
;
...
...
This diff is collapsed.
Click to expand it.
src/tagBam/tagBamMain.cpp
+
20
−
4
View file @
9fc914ad
...
...
@@ -31,9 +31,11 @@ int main(int argc, char* argv[]) {
// input file
string
bamFile
;
float
overlapFraction
=
1E-9
;
string
tag
=
"YB"
;
// parm flags
bool
haveFraction
=
false
;
bool
haveTag
=
false
;
bool
haveFraction
=
false
;
bool
forceStrand
=
false
;
bool
haveBam
=
false
;
bool
haveFiles
=
false
;
...
...
@@ -83,7 +85,7 @@ int main(int argc, char* argv[]) {
i
--
;
}
}
else
if
(
PARAMETER_CHECK
(
"-
tag
s"
,
5
,
parameterLength
))
{
else
if
(
PARAMETER_CHECK
(
"-
label
s"
,
7
,
parameterLength
))
{
if
((
i
+
1
)
<
argc
)
{
haveLabels
=
true
;
i
=
i
+
1
;
...
...
@@ -107,6 +109,13 @@ int main(int argc, char* argv[]) {
i
++
;
}
}
else
if
(
PARAMETER_CHECK
(
"-tag"
,
4
,
parameterLength
))
{
if
((
i
+
1
)
<
argc
)
{
haveTag
=
true
;
tag
=
argv
[
i
+
1
];
i
++
;
}
}
else
{
cerr
<<
endl
<<
"*****ERROR: Unrecognized parameter: "
<<
argv
[
i
]
<<
" *****"
<<
endl
<<
endl
;
showHelp
=
true
;
...
...
@@ -118,9 +127,13 @@ int main(int argc, char* argv[]) {
cerr
<<
endl
<<
"*****"
<<
endl
<<
"*****ERROR: Need -i, -files, and -labels. "
<<
endl
<<
"*****"
<<
endl
;
showHelp
=
true
;
}
if
(
haveTag
&&
tag
.
size
()
>
2
)
{
cerr
<<
endl
<<
"*****"
<<
endl
<<
"*****ERROR: Custom tags should be at most two characters per the SAM specification. "
<<
endl
<<
"*****"
<<
endl
;
showHelp
=
true
;
}
if
(
!
showHelp
)
{
TagBam
*
ba
=
new
TagBam
(
bamFile
,
inputFiles
,
inputLabels
,
forceStrand
,
overlapFraction
);
TagBam
*
ba
=
new
TagBam
(
bamFile
,
inputFiles
,
inputLabels
,
tag
,
forceStrand
,
overlapFraction
);
ba
->
Tag
();
delete
ba
;
return
0
;
...
...
@@ -139,7 +152,7 @@ void ShowHelp(void) {
cerr
<<
"Summary: Annotates a BAM file based on overlaps with multiple BED/GFF/VCF files"
<<
endl
;
cerr
<<
"
\t
on the intervals in -i."
<<
endl
<<
endl
;
cerr
<<
"Usage: "
<<
PROGRAM_NAME
<<
" [OPTIONS] -i <BAM> -files FILE1 FILE2 .. FILEn -
tag
s LAB1 LAB2 ,,, LABn"
<<
endl
<<
endl
;
cerr
<<
"Usage: "
<<
PROGRAM_NAME
<<
" [OPTIONS] -i <BAM> -files FILE1 FILE2 .. FILEn -
label
s LAB1 LAB2 ,,, LABn"
<<
endl
<<
endl
;
cerr
<<
"Options: "
<<
endl
;
...
...
@@ -149,6 +162,9 @@ void ShowHelp(void) {
cerr
<<
"
\t
-f
\t
"
<<
"Minimum overlap required as a fraction of the alignment."
<<
endl
;
cerr
<<
"
\t\t
- Default is 1E-9 (i.e., 1bp)."
<<
endl
;
cerr
<<
"
\t\t
- FLOAT (e.g. 0.50)"
<<
endl
<<
endl
;
cerr
<<
"
\t
-tag
\t
"
<<
"Dictate what the tag should be. Default is YB."
<<
endl
;
cerr
<<
"
\t\t
- STRING (two characters, e.g., YK)"
<<
endl
<<
endl
;
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