使用mixcr构建免疫组库及下游分析

免疫组库(Immune Repertoire,IR)是指个体在某个特定时间其循环系统中所有多样性的T细胞和B细胞的总和,即V(D)J序列多样性的集合。免疫组库分析是指运用高通量测序技术对个体免疫组库多样性分析,以及对T细胞和B细胞独特性分析。
mixcr允许多种数据输入,特异性免疫组库测序或RNA-seq测序都可以作为输入。

mixcr工作流程

实例展示

下载8个新冠样本8个健康样本RNA-seq单端测序作为输入。


批量下载数据:可参考RNA-seq转录组差异分析及可视化

#下载数据
prefetch -O /path to out/ --option-file SRR_Acc_List.txt
#将NCBI下载的数据转为fastq格式
cat SRR_Acc_List.txt|while read id;do fastq-dump --gzip -O /path to out/ /path to input/${id}.sra;done
#path to out:输出路径
#path to input:输入文件路径
#mixcr non-enriched
#single-read
cat SRR_Acc_List.txt|while read name;do mkdir ${name};done
cat SRR_Acc_List.txt|while read name;do mixcr analyze shotgun -s hsa --starting-material rna --only-productive --impute-germline-on-export --report ./report/${name}.report ./rawdata/${name}.fastq.gz ./results/${name}/${name};done
#运行时间比较长,16个样本大约用时35h。
#推荐使用多线程分开提交任务运行。
mixcr输出结果

得到mixcr的输出结果后vdjtools与immunarch(R包)都可以用来进行可视化输出。



1.准备工作

mixcr与vdjtools是基于java平台开发的处理从原始序列到定量克隆型的大量免疫组数据的免疫分析软件,在使用前要确保java环境是ok的。

最低配置

  • Any Java-enabled platform (Windows, Linux, Mac OS X)
  • Java version 7 or higher (download from Oracle web site)
  • 1–16 Gb RAM (depending on number of clones in the sample)

检查环境并下载软件

官网下载 Java Runtime Environment,jre是java的运行环境。

java -version #检查java环境是否ok

官网下载mixcr的压缩包并解压,并添加至环境变量。
若未添加至环境变量,每次运行时需使用此代码

java -jar path_to_mixcr\mixcr.jar ...  #path_to_mixcr = 解压mixcr的地址

2.MIXCR

MIXCR分析流程主要包含三个程序步骤,分别是alignassembleexport

  • align:将测序结果比对到TCR或BCR的V,D,J和C的参考基因上。
  • assemble:将上一步得到的结果进行组装,可以得到特定的基因区域序列,如CDR3序列。
  • export:将比对结果或组装结果输出,得到可阅读的txt文件。

MIXCR支持输入单端或双端的测序文件,可使用原始测序文件也可使用质控后的文件,质控方法和RNA-seq差异分析中的方法一致,使用fastp或者trimmomatic进行质控,参考RNA-seq转录组差异分析及可视化

3.一站式流程使用

MIXCR软件提供了两种analysis模式,包含了上述三种参数,一站式进行分析。

  • analyze amplicon: for analysis of targeted TCR/IG library amplification (5’RACE, Amplicon, Multiplex, etc).
  • analyze shotgun: for analysis of random fragments (RNA-Seq, Exome-Seq, etc).
#environment:Linux
# for enriched targeted TCR/IG libraries
mixcr analyze amplicon
    -s hsa \ # or mmu
    --starting-material dna  \#or rna
    --5-end v-primers \#or no-v-primers
    --3-end j-primers  \#or j-c-intron-primers or c-primers
    --adapters adapters-present \#or no-adapters
    R1.fastq.gz R2.fastq.gz  ./path/mixcr_result/sample1
Option                           Description
-s,--species hsa (or HomoSapiens), mmu (or MusMusculus), rat (currently only TRB, TRA and TRD are supported), or any species from IMGT ® library, if it is used (see here import segments).
--starting-material rna or dna
--5-end no-v-primers(e.g. 5’RACE with template switch oligo )or v-primers
--3-end j-primers or j-c-intron-primers or c-primers
--adapters adapters-present or no-adapters

The following parameters are optional:

Option                                     Default Description
--report analysis_name.report Report file.
--receptor-type xcr By default, all T- and B-cell receptor chains are analyzed.Possible values are:xcr (all chains), tcr, bcr, tra, trb, trg, trd, igh, igk, igl.
--contig-assembly false Whether to assemble full receptor sequences (assembleContigs). This option may slow down the computation.
--impute-germline-on-export false Use germline segments (printed with lowercase letters) for uncovered gene features.
--region-of-interest CDR3 MiXCR will use only reads covering the whole target region; reads which partially cover selected region will be dropped during clonotype assembly. All non-CDR3 options require long high-quality paired-end data. See Gene features and anchor points for details.
--only-productive false Filter out-of-frame and stop-codons in export
--align Additional parameters for align step specified with double quotes (e.g –align “–limit 1000” –align “-OminSumScore=100”)
--assemble Additional parameters for assemble step specified with double quotes (e.g –assemble “-ObadQualityThreshold=0”).
--assembleContigs Additional parameters for assembleContigs step specified with double quotes.
--export Additional parameters for exportClones step specified with double quotes.
# for non-enriched or random fragments
mixcr analyze shotgun
    -s hsa # or mmu
    --starting-material dna  #or rna
    [OPTIONS] input_file1 [input_file2] analysis_name
Option                                     Default Description
--report analysis_name.report Report file.
--receptor-type xcr Dedicated receptor type for analysis. By default, all T- and B-cell receptor chains are analyzed. MiXCR has special aligner kAligner2, which is used when B-cell receptor type is selected. Possible values for --receptor-type are: xcr (all chains), tcr, bcr, tra, trb, trg, trd, igh, igk, igl.
--contig-assembly false Whether to assemble full receptor sequences (assembleContigs). This option may slow down the computation.
--impute-germline-on-export false Use germline segments (printed with lowercase letters) for uncovered gene features.
--only-productive false Filter out-of-frame and stop-codons in export
--assemble-partial-rounds 2 Number of consequent assemblePartial executions.
--do-not-extend-alignments Do not perform extension of good TCR alignments.
--align Additional parameters for align step specified with double quotes (e.g –align “–limit 1000” –align “-OminSumScore=100”)
--assemblePartial Additional parameters for assemblePartial step specified with double quotes.
--extend Additional parameters for extend step specified with double quotes.
--assemble Additional parameters for assemble step specified with double quotes (e.g –assemble “-ObadQualityThreshold=0”).
--assembleContigs Additional parameters for assembleContigs step specified with double quotes.
--export Additional parameters for exportClones step specified with double quotes.

上述两种分析模式可满足大多要求,更多参数细节参考mixcr用户手册

4.逐级分析

没有特殊的分析需求这部分可略过。

4.1 Alignment

mixcr align [options] input_file1 [input_file2] output_file.vdjca
options                  default value description
-r,--report 输出文件名称
-l,--loci ALL 比对的靶点,可由,连接多个。IGH,IGL,IGK, TRA, TRB, TRG, TRD, IG (for all immunoglobulin loci),TCR (for all T-cell receptor loci), ALL (for all loci) .
-s,--specoes HomoSapiens 同上个表格
-p,--parameters default defaultorrna-seq,rna-seq是专门为分析rna-seq数据而优化的。
-i,--diff-loci 接受与V和J基因不同loci的比对(在默认情况下,这种比对被丢弃)。
-t number of available CPU cores 线程数
-n,--limit 只处理输入文件的前-n个序列。
-Oparameter = value 比对区域,具体见下面表格

Alignment parameters

Parameters     Default value Description
vParameters.geneFeatureToAlign VRegion region in V gene which will be used as target in align
dParameters.geneFeatureToAlign DRegion region in D gene which will be used as target in align
jParameters.geneFeatureToAlign JRegion region in J gene which will be used as target in align
cParameters.geneFeatureToAlign CRegion region in C gene which will be used as target in align

-OvParameters.geneFeatureToAlign是比对过程中的一个重要参数,有三个常用value。

  • – VRegion(默认值):如果你的免疫组库是使用多重PCR构建的5端文库则使用这个选项。
  • – VTranscript:以RNA为起始材料进行的非模板特异性扩增,例如5'RACE。使用这个选项有助于提高测序信息5'端的利用率,有助于提高V基因的准确性。
  • – VGene:DNA为起始材料,5'端的信息(包括V区内含子,leader sequence,5'UTR)应该存在于测序信息中。

如果想获得TCR或BCR的全部克隆型(包括FR和CDR区域),使用- VTranscript或者- VGene。

4.1.1 分析RNA-seq数据

Analysis of RNA-Seq data performed with -p rna-seq option is almost equivalent to the following set of aligners parameters:

  • (most important) turned off floating bounds of V and J alignments:
    -OvParameters.parameters.floatingLeftBound=false
    -OjParameters.parameters.floatingRightBound=false
  • higher thresholds:
    -OvParameters.parameters.absoluteMinScore=80 (was 40)
    -OjParameters.parameters.absoluteMinScore=70 (was 40)
    -OminSumScore=200 (was 120; see below)
  • more strict scoring for all alignments (V, J, C):
    -OxParameters.parameters.scoring.gapPenalty=-21
    -OxParameters.parameters.scoring.subsMatrix=’simple(match=5,mismatch=-12)’

4.2 Assemble clones

这一步使用到上一步得到的.vdjca文件,提取特定的基因序列,最后输出.clns文件。

mixcr assemble [options] alignments.vdjca output.clns
options                         default value description
-r --report Report file name.
-t --threads number of available CPU cores Number of processing threads.
-a, --write-alignments Save initial alignments and alignments <> clones mapping in the resulting .clna file.
-Oparameter=value Overrides default value of assembler parameter (see next subsection).

-OassemblingFeatures参数用来设置需要组装的区域。默认值是CDR3。如果要组装全序列,使用VDJRegion选项。

mixcr assemble -OassemblingFeatures="[V5UTR+L1+L2+FR1,FR3+CDR3]" alignments.vdjca output.clns

(note:assemblingFeatures must cover CDR3).

Other global parameters are:

Parameter     Default value Description
minimalClonalSequenceLength    12 Minimal length of clonal sequence
badQualityThreshold 20 Minimal value of sequencing quality score: nucleotides with lower quality are considered as “bad”. If sequencing read contains at least one “bad” nucleotide within the target gene region, it will be deferred at initial assembling stage, for further processing by mapper.
maxBadPointsPercent 0.7 Maximal allowed fraction of “bad” points in sequence: if sequence contains more than maxBadPointsPercent “bad” nucleotides, it will be completely dropped and will not be used for further processing by mapper. Sequences with the allowed percent of “bad” points will be mapped to the assembled core clonotypes. Set -OmaxBadPointsPercent=0 in order to completely drop all sequences that contain at least one “bad” nucleotide.
qualityAggregationType Max Algorithm used for aggregation of total clonal sequence quality during assembling of sequencing reads. Possible values: Max (maximal quality across all reads for each position), Min (minimal quality across all reads for each position), Average (average quality across all reads for each position), MiniMax (all letters has the same quality which is the maximum of minimal quality of clonal sequence in each read).
minimalQuality 0 Minimal allowed quality of each nucleotide of assembled clone. If at least one nucleotide in the assembled clone has quality lower than minimalQuality, this clone will be dropped (remember that qualities of reads are aggregated according to selected aggregation strategy during core clonotypes assembly; see qualityAggregationType).
addReadsCountOnClustering false Aggregate cluster counts when assembling final clones: if addReadsCountOnClustering is true, then all children clone counts will be added to the head clone; thus head clone count will be a total of its initial count and counts of all its children. Refers to further clustering strategy (see below). Does not refer to mapping of low quality sequencing reads described above.

example:

mixcr assemble -ObadQualityThreshold=10 alignments.vdjca output.clns
mixcr assemble -OmaxBadPointsPercent=0 alignments.vdjca output.clns #In order to prevent mapping of low quality reads (filter them off) one can set maxBadPointsPercent to zero

4.3Export

将比对结果或组装结果输出,得到可阅读的txt文件。

#
mixcr exportAlignments [options] alignments.vdjca alignments.txt
mixcr exportClones [options] clones.clns clones.txt

5.结果解读

参考mixcr官方手册export部分。

可视化处理

参考使用vdjtools进行免疫组库分析

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 159,835评论 4 364
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,598评论 1 295
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 109,569评论 0 244
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 44,159评论 0 213
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,533评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,710评论 1 222
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,923评论 2 313
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,674评论 0 203
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,421评论 1 246
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,622评论 2 245
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,115评论 1 260
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,428评论 2 254
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,114评论 3 238
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,097评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,875评论 0 197
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,753评论 2 276
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,649评论 2 271

推荐阅读更多精彩内容