Skip to content

Consider UMIs in samtools fastq #2259

Description

@Poshi

The problem

I realized that when using samtools fastq to get from a bam file back to a FastQ, the UMI data is lost.
Currently, the Illumina data arrives with a header like:

@<instrument>:<run number>:<flowcell_ID>:<lane>:<tile>:<x_pos>:<y_pos>:<umi> <read>:<is_filtered>:<control_number>:<index_sequence>
@LH00000:10:22WWW2LT4:1:1101:12488:1084:CCAATGTGC 1:N:0:TACGCTAC+CGTGTGAT

After processing (alignment et al.), the data is distributed in different SAM locations. Read end and filtering status goes to the FLAGS, multiplexing barcode goes to BC tag... and UMI sequence ends in RX or BX tags.

The ID in the bam file looks like

LH00000:10:22WWW2LT4:1:1101:12488:1084

while the missing information is scattered through the whole bam record. At the end, nothing is lost.

When converting those bam files back to FastQ, we have the -i option to ask the Illumina format be added back on the header line. This add most of the data back to its origin, but the UMI data is lost in the process and we get something like

@LH00000:10:22WWW2LT4:1:1101:12488:1084 1:N:0:TACGCTAC+CGTGTGAT

The solution

I'd like to ask to have this piece of data considered. If RX or BX tags are found, bring their information back to the header line. If both found, choose whatever you prefer (RX for the original data or BX for the corrected data). Allow user to define which tag to use with a parameter like --umi-tag. You can also add a flag to enable this processing, in case you want to keep the new behavior from interfering with the older versions.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions