Typical MiXCR workflow consists of three main processing steps:
- align: align sequencing reads to reference V, D, J and C genes of T- or B- cell receptors
- assemble: assemble clonotypes using alignments obtained on previous step (in order to extract specific gene regions e.g. CDR3)
- export: export alignment (
exportAlignments) or clones (
exportClones) to human-readable text file
MiXCR supports the following formats of sequencing data:
fastq.gz. As an output of each processing stage, MiXCR produces binary compressed file with comprehensive information about entries produced by this stage (alignments in case of
align and clones in case of
assemble). Each binary file can be converted to a human-readable/parsable tab-delimited text file using
There are many parameters that user can change to adapt MiXCR for particular needs. While all these parameters are optional there is a set of parameters that are worth considering before running the analysis:
-OvParameters.geneFeatureToAlignsets the gene feature of V gene used for alignment. Applied on the alignment stage. Choice of the value for this parameter depends on the type of starting material and library preparation strategy used. There are three options covering most of the cases (see Gene Features for the full list):
VRegion(default) is generally suitable for majority of use cases, on the other hand if you have some additional information about your library it is a good idea to use one of the values mentioned below instead of default. Don’t change the default value if your library is prepared using multiplex PCR on the V gene side.
VTranscriptif RNA was used as a starting material and some kind of non-template-specific technique was used for further amplification on the 5’-end of RNA (e.g. 5’RACE) (see example). Using of this option is useful for increasing of sequencing information utilization from 5’-end of the molecule, which in turn helps to increase accuracy of V gene identification.
VGeneif DNA was used as a starting material and 5’ parts of V gene (including V intron, leader sequence and 5’UTR) are supposed to be present in your data. Using of this option is useful for increasing of sequencing information utilization from 5’-end of the molecule, which in turn helps to increase accuracy of V gene identification.
VGeneif you plan to assemble full-length clonotypes (including all FRs and CDRs) of T- or B- cell receptors.
-OassemblingFeaturesparameter sets the region of TCR/BCR sequence which will be used to assemble clones. Applyed on the assembly stage. By default its value is
CDR3which results in assembling of clones by the sequence of Complementarity Determining Region 3. To analyse full length sequences use
VDJRegionas a value for the
assemblingFeatures(see Gene Features for more details).
Another important parameter is
--species, it sets the target organism. This parameter is used on the align stage. Possible values are
MusMusculus). Default value is
hsa. This parameter should be supplied on the alignment stage (see example).
The following sections describes common use cases
Parameters used in this example are particularly suitable for analysis of multiplex-PCR selected fragments of T-/B- cell receptor genes.
MiXCR can be used with the default parameters in most cases by executing the following sequence of commands:
> mixcr align input_R1.fastq input_R2.fastq alignments.vdjca ... Building alignments > mixcr assemble alignments.vdjca clones.clns ... Assembling clones > mixcr exportClones --chains IGH clones.clns clones.txt ... Exporting clones to tab-delimited file
The value of only one parameter is changed from its default in this snippet (
--chains IGH) to tell MiXCR to export only IGH sequences. However even this parameter can be omitted (in this case MiXCR will export all T-/B- cell receptor sequences, that have been found in the sample). We reccomend always specify
--chain parameter at the
exportClones step to simplify further analysis.
The file produced (
clone.txt) will contain a tab-delimited table with information about all clonotypes assembled by CDR3 sequence (clone abundance, CDR3 sequence, V, D, J genes, etc.). For full length analysis and other useful features see examples below.
Analysis of data obtained using 5’RACE-based amplification protocols¶
Consider MiXCR workflow in more detail on analysis of paired-end sequenced cDNA library of IGH gene prepared using 5’RACE-based protocol (i.e. onе read covers CDR3 with surroundings and another one covers 5’UTR and downstream sequence of V gene):
- Align raw sequences to reference sequences of segments (V, D, J) of IGH gene:
> mixcr align -OvParameters.geneFeatureToAlign=VTranscript \ --report alignmentReport.log input_R1.fastq input_R2.fastq alignments.vdjca
Here we specified non-default value for gene feature used to align V genes (
-OvParameters.geneFeatureToAlign=VTranscript) in order to utilize information from both reads, more specifically to let MiXCR align V gene’s 5’UTRS and parts of coding sequence on 5’-end with sequence from read opposite to CDR3. MiXCR can also produce report file (specified by optional parameter
--report) containing run statistics which looks like this:Analysis Date: Mon Aug 25 15:22:39 MSK 2014 Input file(s): input_r1.fastq,input_r2.fastq Output file: alignments.vdjca Command line arguments: align --report alignmentReport.log input_r1.fastq input_r2.fastq alignments.vdjca Total sequencing reads: 323248 Successfully aligned reads: 210360 Successfully aligned, percent: 65.08% Alignment failed because of absence of V hits: 4.26% Alignment failed because of absence of J hits: 30.19% Alignment failed because of low total score: 0.48%
One can convert binary output produced by
output.vdjca) to a human-readable text file using exportAlignments command.
- Assemble clonotypes:
> mixcr assemble --report assembleReport.log alignments.vdjca clones.clns
This will build clonotypes and additionally correct PCR and sequencing errors. By default, clonotypes will be assembled by CDR3 sequences; one can specify another gene region by passing additional command line arguments (see assemble documentation). The optional report
assembleReport.logwill look like:Analysis Date: Mon Aug 25 15:29:51 MSK 2014 Input file(s): alignments.vdjca Output file: clones.clns Command line arguments: assemble --report assembleReport.log alignments.vdjca clones.clns Final clonotype count: 11195 Total reads used in clonotypes: 171029 Reads used, percent of total: 52.89% Reads used as core, percent of used: 92.04% Mapped low quality reads, percent of used: 7.96% Reads clustered in PCR error correction, percent of used: 0.04% Clonotypes eliminated by PCR error correction: 72 Percent of reads dropped due to the lack of clonal sequence: 2.34% Percent of reads dropped due to low quality: 3.96% Percent of reads dropped due to failed mapping: 5.87%
- Export binary file with a list of clones (
clones.clns) to a human-readable text file:
> mixcr exportClones --chains IGH clones.clns clones.txt
This will export information about clones with default set of fields, e.g.:
Clone count Clone fraction … V hits J hits
- seq. CDR3
AA. seq. CDR3 … 4369 2.9E-3 … IGHV4-39*00(1388) IGHJ6 *00(131) TGTGTGAG… CVRHKPM… … 3477 2.5E-3 … IGHV4-34*00(1944) IGHJ4 *00(153) TGTGCGAT… CAIWDVGL… … … … … … … … … …
where dots denote text not shown here (for compactness). For the full list of available export options see export documentation.
Each of the above steps can be customized in order to adapt the analysis pipeline for a specific research task (see below).
High quality full length IG repertoire analysis¶
For the full length cDNA-based immunoglobulin repertoire analysis we generally recommend to prepare libraries with unique molecular identifiers (UMI) and sequence them using asymmetric paired-end 350 bp + 100 bp Illumina MiSeq sequencing (see Nature Protocols paper). This approach allows to obtain long-range high quality sequencing and efficiently eliminate PCR and sequencing errors using MiGEC software. The resulting high quality data can be further processed by MiXCR for the efficent full length IGH or IGL repertoire extraction:
- Merging paired-end reads and alignment:
alignsubcommand performs paired-end reads merging and alignment to reference V/D/J and C genes. We recommend using KAligner2 (currently in beta testing) for the full length immunoglobulin profiling:> mixcr align -p kaligner2 -s hsa -r alignmentReport.txt -OreadsLayout=Collinear \ -OvParameters.geneFeatureToAlign=VTranscriptWithP read_R1.fastq.gz read_R2.fastq.gz \ alignments.vdjca
-sallows to specify species (e.g. homo sapiens -
hsa, mus musculus -
-OreadsLayoutallow us to set paired-end reads orientation (
Unknown). Note, that after MiGEC analysis paired-end read pairs are in
Instead of KAligner2, default MiXCR aligner can be used as well, but it may miss immunoglobulin subvariants that contain several nucleotide-lengths indels within the V gene segment.
- Assemble clones:
> mixcr assemble -r assembleReport.txt -OassemblingFeatures=VDJRegion \ -OseparateByC=true -OqualityAggregationType=Average \ -OclusteringFilter.specificMutationProbability=1E-5 -OmaxBadPointsPercent=0 \ alignments.vdjca clones.clns
-OseparateByC=trueseparates clones with different antibody isotype.
-OcloneClusteringParameters=nullparameter to switch off the frequency-based correction of PCR errors.
Depending on data quality, one can adjust input threshold by changing the parameter
-ObadQualityThresholdto improve clonotypes extraction.
See “Assembler parameters” section of documentation for the advanced quality filtering parameters.
- Export clones:
> mixcr exportClones -c IGH -o -t clones.clns clones.txt
-tfilter off the out-of-frame and stop codon containing clonotypes, respectively, and
-cindicates which chain will be extracted (e.g.
Analysis of RNA-Seq data¶
For detailed description please see here.
MiXCR allows to extract TCR and BCR CDR3 repertoires from RNA-Seq data. Extraction efficiency depends on the abundance of T or B cells in a sample, and also on the sequencing length. 2x150 bp or 2x100 bp paired-end sequencing is recommended. However, even from the paired-end 2x50 bp RNA-Seq data, information on the major clonotypes present (e.g. in a tumor sample) can usually be extracted. The analysis can be perfromed in the following way:
- Align reads:
> mixcr align -p rna-seq -OallowPartialAlignments=true data_R1.fastq.gz data_R2.fastq.gz alignments.vdjca
mixcr alignparameters can also be used here (e.g.
-sto specify organism).
-OallowPartialAlignments=trueoption preserves partial alignments for their further use in
> mixcr assemblePartial alignments.vdjca alignmentsRescued.vdjca
To obtain more assembled reads containing full CDR3 sequence it is recommended to perform several iterations of reads assembling using
-pparameter is required for several iterations. In our experience, the best result is obtained after the second iteration:> mixcr assemblePartial alignments.vdjca alignmentsRescued_1.vdjca > mixcr assemblePartial alignmentsRescued_1.vdjca alignmentsRescued_2.vdjca
- Extend TCR alignments with uniquely determined V and J genes and having incomplete coverage of CDR3s using germline sequences:
> mixcr extendAlignments alignmentsRescued_2.vdjca alignmentsRescued_2_extended.vdjca
- Assemble clones:
> mixcr assemble alignmentsRescued_2_extended.vdjca clones.clns
mixcr assembleparametrs can also be used here.
- For poor quality data it is recommended to decrease input quality threshold (e.g.
- To make error correction algorithms to combine clone abundancies add the following option:
- Exporting clones:
> mixcr exportClones -c TRA -o -t clones.clns clones.txt
One can specify immune receptor chain of interest to extract (
-c TRB, etc) and exclude out-of-frame (option
-o) and stop codon containing variants (option
Assembling of CDR3-based clonotypes for mouse TRB sample¶
This example shows how to perform routine assembly of clonotypes (based on CDR3 sequence) for mouse TRB library (aligning is performed for all possible genes - TRA/B/D/G and IGH/L/K, but only TRB clones are exported in the final table at the end).
> mixcr align --species mmu input_R1.fastq input_R2.fastq alignments.vdjca
Other analysis stages can be executed without any additional parameters:
> mixcr assemble alignments.vdjca clones.clns > mixcr exportClones --chains TRB clones.clns clones.txt