From f05d7cb427d00a85994391b0e2829cc704bb3314 Mon Sep 17 00:00:00 2001 From: Ruben Vorderman <r.h.p.vorderman@lumc.nl> Date: Mon, 17 Jan 2022 09:08:56 +0100 Subject: [PATCH] Use set_tag call from pysam --- umi.wdl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/umi.wdl b/umi.wdl index e149caf..5916968 100644 --- a/umi.wdl +++ b/umi.wdl @@ -62,8 +62,7 @@ task BamReadNameToUmiTag { for segment in in_bam: # type: pysam.AlignedSegment new_name, umi = split_umi_from_name(segment.query_name) segment.query_name = new_name - # append does not work. (Pysam is not Pythonic.) - segment.tags = segment.tags + [(bam_tag, umi)] + segment.set_tag("RX", umi, value_type="Z") out_bam.write(segment) if __name__ == "__main__": -- GitLab