milaboratory / mixcr

MiXCR is an ultimate software platform for analysis of Next-Generation Sequencing (NGS) data for immune profiling.
https://mixcr.com
Other
332 stars 79 forks source link

Mapping MiXCR clones back to fastq reads #1592

Closed Januaryyiyue closed 7 months ago

Januaryyiyue commented 7 months ago

Hello,

Is there a way to map the MiXCR clones to their specific reads from the input fastq.gz file? Thanks!

mizraelson commented 7 months ago

Hi, yes.

Suppose you are using mixcr analyze command. Then you should add the following parameters:

mixcr analyze milab-human-rna-ig-umi-multiplex \
-Malign.parameters.saveOriginalReads=true \
-Massemble.clnaOutput=true \
--add-step exportAlignments \
--prepend-export-alignments-field -descrsR1 \
--prepend-export-alignments-field -descrsR2 \
input_R1.fastq.gz \
input_R2.fastq.gz \
results

You will receive a results.alignments.tsv file with descrsR1 and descrsR2 columns. Instead of a results.clns file, you'll get a results.clna file containing information on both alignments and clones.

Furthermore, by using:

mixcr exportAlignments \
    -cloneId \
    results.clna \
    results.alignmentsClones.tsv

You will obtain results.alignmentsClones.tsv which provides details on both the read header from the original FASTQ file and a cloneId corresponding to the ID in the clonotype table. Records with cloneId -1 were not utilized in the clonotype assembly.

You can also read #1470