2020-07-23 靶向捕获测序数据分析记录5

写在前面:从7月16日开始到PICU轮转,前天跟值了一个夜班,可能是新人比较旺的缘故,从中午就开始收病人,一直忙到凌晨3点多,昨天早上6点过就起来干活查完房开完医嘱,写完病程就到11点多,感觉脑子已经完全不够用了,回到住处就开始补瞌睡。今天6点多就出门上班,因为要等一些检查结果,然后只办了1个出院,忙完所有的事情后就12点了,1点过去参加一个组会,然后2点多终于闲下来,看看之前的结果。

查看bam转换情况发现有部分样本转换过程出了未知错误,没有成功转换,提取出这部分的样本名重新构建config1再来进行转换

#构建config1
basename -a *bam.tmp.0000* >tmp
cat tmp| while read id; do sample=${id%%.hg38.sort*}; echo $sample; done >config1
#删除残余文件
rm -rf *.bam.tmp.0*
#激活小环境重新开始转换
conda activate wes
nohup cat config1 | while read id ; do bam=~/CHD_pooling_seq/${id}.dedup.bam; if [ ! -f ~/project/0.bwa/ok.${id}_marked.status ]; then echo "start CrossMap for ${id}" `date`; python /root/miniconda3/envs/py3/bin/CrossMap.py bam ~/biosoft/liftover/hg19ToHg38.over.chain.gz ${bam} ~/project/0.bwa/${id}.hg38 1>~/project/0.bwa/${id}_log.mark 2>&1; if [ $? -eq 0 ]; then touch ~/project/0.bwa/ok.${id}_marked.status; fi; echo "end CrossMap for ${id}" `date`; fi; done &

同时进行varient calling:

单个样本calling的脚本wesFlow_multi_to_gvcf.sh

(base) root@1100150:~/project# vi wesFlow_multi_to_gvcf.sh
(base) root@1100150:~/project# cat wesFlow_multi_to_gvcf.sh
#!usr/bin/bash
# use $sample
# bash ~/project/wesFlow_multi_to_gvcf.sh $sample
# This is a wesflow for only one sample

samtools=samtools
GATK=~/biosoft/gatk-4.1.7.0/gatk

#references
ref=~/reference/genome/Homo_sapiens_assembly38.fasta
gatk_ref=~/reference/genome/Homo_sapiens_assembly38.fasta
gatk_bundle=~/annotation/variation/GATK

dbsnp=$gatk_bundle/dbsnp_146.hg38.vcf.gz
indel=$gatk_bundle/Mills_and_1000G_gold_standard.indels.hg38.vcf.gz
G1000=$gatk_bundle/1000G_phase1.snps.high_confidence.hg38.vcf.gz
hapmap=$gatk_bundle/hapmap_3.3.hg38.vcf.gz
omini=$gatk_bundle/1000G_omni2.5.hg38.vcf.gz
mills=$gatk_bundle/Mills_and_1000G_gold_standard.indels.hg38.vcf.gz

outdir=~/project

## outdir directory

if [ ! -d $outdir/0.bwa ]
then mkdir -p $outdir/0.bwa
fi

if [ ! -d $outdir/gatk ]
then mkdir -p $outdir/gatk
fi

## start the gatk analysis

## start the gatk analysis

## with one sample
time $GATK --java-options "-Xmx20G -Djava.io.tmpdir=./tmp" MarkDuplicates \
    -I $outdir/0.bwa/$sample.hg38.sorted.bam \
    -O $outdir/0.bwa/${sample}.sorted.marked.bam \
    -M $outdir/0.bwa/$sample.metrics \
    1>$outdir/0.bwa/${sample}_log.mark 2>&1 && echo "MarkDuplicates done!"

time $GATK --java-options "-Xmx20G -Djava.io.tmpdir=./tmp" FixMateInformation \
    -I $outdir/0.bwa/${sample}.sorted.marked.bam \
    -O $outdir/0.bwa/${sample}.sorted.marked.fixed.bam \
    -SO coordinate \
    1>$outdir/0.bwa/${sample}_log.fix 2>&1
## 86 minutes
time $GATK --java-options "-Xmx20G -Djava.io.tmpdir=./tmp"  BaseRecalibrator \
    -R $ref  \
    -I $outdir/0.bwa/${sample}.sorted.marked.fixed.bam  \
    --known-sites $snp \
    --known-sites $indel \
    --known-sites $1000G \
    -O $outdir/0.bwa/${sample}_recal.table \
    1>$outdir/0.bwa/${sample}_log.recal 2>&1 && echo "BaseRecalibrator done!"
## 45 minutes
time $GATK --java-options "-Xmx20G -Djava.io.tmpdir=./tmp"   ApplyBQSR \
    -R $ref  \
    -I $outdir/0.bwa/${sample}.sorted.marked.fixed.bam  \
    -bqsr $outdir/0.bwa/${sample}_recal.table \
    -O $outdir/0.bwa/${sample}.sorted.marked.fixed.bqsr.bam \
    1>$outdir/0.bwa/${sample}_log.ApplyBQSR  2>&1 && echo "ApplyBQSR done!"
## 449m for 16G data
time $GATK --java-options "-Xmx20G -Djava.io.tmpdir=./tmp" HaplotypeCaller \
    -R $ref  \
    -I $outdir/0.bwa/${sample}.sorted.marked.fixed.bqsr.bam \
    #--dbsnp $dbsnp \
    -O $outdir/gatk/${sample}.HC.vcf.gz \
    1>$outdir/0.bwa/${sample}_log.HC 2>&1 && echo "HaplotypeCaller done!"

time $samtools index $outdir/0.bwa/${sample}.sorted.marked.fixed.bqsr.bam && echo "** ${sample}.sorted.marked.fixed.bqsr.bam index done! **"

# VQSR
# first SNP mode 分别评估SNP和INDEL突变位点的质量
# SNP mode
time $GATK VariantRecalibrator \
    -R $ref \
    -V $outdir/gatk/$sample.HC.vcf.gz \
    --max-gaussians 4 \
    -resource:hapmap,known=false,training=true,truth=true,prior=15.0 $hapmap \
    -resource:omini,known=false,training=true,truth=false,prior=12.0 $omini \
    -resource:1000G,known=false,training=true,truth=false,prior=10.0 $G1000 \
    -resource:snp,known=true,training=false,truth=false,prior=10.0 $dbsnp \
    -an DP -an QD -an SOR -an ReadPosRankSum -an MQRankSum \
    -mode SNP \
    --rscript-file $outdir/gatk/${sample}.HC.snps.plots.R \
    --tranches-file $outdir/gatk/${sample}.HC.snps.tranches \
    -O $outdir/gatk/${sample}.HC.snps.recal

time $GATK ApplyVQSR \
    -R $ref \
    -V $outdir/gatk/$sample.HC.vcf.gz \
    --truth-sensitivity-filter-level 99.0 \
    --tranches-file $outdir/gatk/$sample.HC.snps.tranches \
    --recal-file $outdir/gatk/$sample.HC.snps.recal \
    -mode SNP \
    -O $outdir/gatk/$sample.HC.snps.VQSR.vcf.gz && echo "** SNPs VQSR done **"

## Indel mode
time $GATK VariantRecalibrator \
    -R $ref \
    -V $outdir/gatk/$sample.HC.snps.VQSR.vcf.gz \
    --max-gaussians 6 \
    -resource:mills,known=false,training=true,truth=true,prior=15.0 $mills \
    -an QD -an MQ -an MQRankSum -an ReadPosRankSum -an FS -an SOR \
    -mode INDEL \
    --rscript-file $outdir/gatk/${sample}.HC.snps.indels.plots.R \
    --tranches-file $outdir/gatk/${sample}.HC.snps.indels.tranches \
    -O $outdir/gatk/${sample}.HC.snps.indels.recal

time $GATK ApplyVQSR \
    -R $ref \
    -V $outdir/gatk/$sample.HC.snps.VQSR.vcf.gz \
    --truth-sensitivity-filter-level 99.0 \
    --tranches-file $outdir/gatk/$sample.HC.snps.indels.tranches \
    --recal-file $outdir/gatk/$sample.HC.snps.indels.recal \
    -mode INDEL \
    -O $outdir/gatk/$sample.HC.snps.indels.VQSR.vcf.gz && echo "** SNPs and Indels VQSR $sample done **"

写成循环运行
bash CHD_Flow_multi.sh内容如下:

(wes) root@1100150:~/project# cat CHD_Flow_multi.sh
cat config | while read sample ; do echo $sample; bash ~/project/wesFlow_multi_to_gvcf.sh $sample; done

切换到config目录提交到后台运行

cd ~/project/
nohup bash CHD_Flow_multi.sh &

这个单样本的calling的脚本第一次使用,因此注释的时间可能不全对,先看看,明天再来继续分析吧。

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