Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alignmentSieve: Adding the option to keep the original tags in the processed BAM #1255

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions deeptools/alignmentSieve.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ def parseArguments():
output.add_argument('--BED',
action='store_true',
help='Instead of producing BAM files, write output in BEDPE format (as defined by MACS2). Note that only reads/fragments passing filtering criterion are written in BEDPE format.')
output.add_argument('--keepTags',
action='store_true',
help='If set, the original BAM tags will be kept in the output file.')

filtering = parser.add_argument_group('Optional arguments')

Expand Down Expand Up @@ -195,6 +198,10 @@ def shiftRead(b, chromDict, args):
b2.reference_start = start
b2.mapping_quality = b.mapping_quality
b2.cigar = ((0, end - start),) # Returned cigar is only matches

if args.keepTags:
b2.set_tags(b.get_tags(with_value_type=True))

if tLen < 0:
b2.template_length = tLen - deltaTLen
else:
Expand Down