Skip to content

Extract barcodes (sample and UMI) from read names #22

Open

Description

@nh13

In some cases, we get FASTQs that have sample barcodes and UMIs in the read name and I we'd like to extract those. Is that possible?

See:
[1] https://help.basespace.illumina.com/files-used-by-basespace/fastq-files
[2] https://knowledge.illumina.com/software/general/software-general-reference_material-list/000002211

Activity

  1. Yenaled commented on Aug 1, 2024

    @Yenaled
    Collaborator

    This feature is not available yet. I'm working on some major upgrades to splitcode this month, and I'll be sure to add this in in the next week or two.

  2. self-assigned this
    on Aug 1, 2024
  3. Yenaled commented on Jan 5, 2025

    @Yenaled
    Collaborator

    @nh13 Sorry, am very late haha, but I finally got around to adding the feature (along with many other features) to the newest version of splitcode:

    https://splitcode.readthedocs.io/en/latest/extracting_from_names.html

    Test it a bit and it seems to work.

    Still updating the documentation a bit.

  4. clintval commented on Sep 14, 2025

    @clintval

    I tried this but couldn't get it to work for my use case.

    I have conventional FASTQ files from Illumina in which the UMI and sample index(es) are in the read name and comment:

    @<instrument>:<run number>:<flowcell ID>:<lane>:<tile>:<x-pos>:<y-pos>:<UMI> <read>:<is filtered>:<control number>:<index>

    I am trying to extract the UMI (8th-field of name) and sample ID (4th-field of comment) to RX and BC SAM tags.

    Importantly, the UMI can be - delimited.

    An example would be:

    @A01000:460:XXXXXX:1:2101:10004:10081:ACGT-TTTT 1:N:ATCCC+ATCG
    GGGGAGAGAGCGATAGACATA
    +
    JJJJJJJJJJJJJJJJJJJJJ

    Where ACGT-TTTT is the UMI and ATCCC+ATCG are the sample indexes.

    When I try to extract this information with splitcode, I get only the sample indexes re-appended back to the read:

    $ splitcode \
         --out-bam \
         --pipe \
         --from-name '0,0,0,::;0,0,0,::+' \
         "test.fastq" \
         | samtools view
    A01000:460:XXXXXX:1:2101:10004:10081:ACGT-TTTT 1:N:ATCCC+ATCG	12	*	0	0	*	*	0	0	ATCCCATCGGGGGAGAGAGCGATAGACATA	KKKKKKKKKJJJJJJJJJJJJJJJJJJJJJ

    If I then try to "re-extract" using extract syntax, I oddly extract into the original read as if the sample indexes are being prepended after any extractions occur.

     splitcode \
         --out-bam \
         --pipe \
         --from-name '0,0,0,::;0,0,0,::+' \
         --extract '0:0<umi1[9]>' \
         --x-names \
         "test.fastq" \
         | samtools view
    A01000:460:XXXXXX:1:2101:10004:10081:ACGT-TTTT 1:N:ATCCC+ATCG	12	*	0	0	*	*	0	0	ATCCCATCGGGGGAGAGAGCGATAGACATA	KKKKKKKKKJJJJJJJJJJJJJJJJJJJJJ	RX:Z:GGGGAGAGA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions