Skip to content

Commit

Permalink
Add the option to keep the tags in the new BAM
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelruizperez committed Sep 14, 2023
1 parent a0c8443 commit 2748326
Showing 1 changed file with 7 additions and 0 deletions.
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

0 comments on commit 2748326

Please sign in to comment.