diff --git a/codes/correct_umi_overlap_reads.py b/codes/correct_umi_overlap_reads.py index 2c49022..c93a6ff 100755 --- a/codes/correct_umi_overlap_reads.py +++ b/codes/correct_umi_overlap_reads.py @@ -74,8 +74,8 @@ def correct(chr, start, end, alt_base): for R in b: if len(list(dic[dic['read'] == R]['base'])) == 2: if list(dic[dic['read'] == R]['base'])[0] != list(dic[dic['read'] == R]['base'])[1]: - print(dic[dic['read'] == R]['base']) - print(dic[dic['read'] == R]['quality']) + # print(dic[dic['read'] == R]['base']) + # print(dic[dic['read'] == R]['quality']) alt_reads.remove(R) else: # if (list(dic[dic['read'] == R]['quality'])[0] >= 20 and list(dic[dic['read'] == R]['NM'])[0] < 4) or ( diff --git a/pipeline.wdl b/pipeline.wdl index 6be22b3..a8274f7 100644 --- a/pipeline.wdl +++ b/pipeline.wdl @@ -105,7 +105,8 @@ workflow pipeline { output_dir=workdir, project=project, umi=umi, - file=call_mutation.somatic_anno_txt + file=call_mutation.somatic_anno_txt, + tumor_rmdup_bam=alignment.tumor_rmdup_bam } diff --git a/wdl/tmb.wdl b/wdl/tmb.wdl index 3abe1fb..86a580c 100755 --- a/wdl/tmb.wdl +++ b/wdl/tmb.wdl @@ -26,6 +26,36 @@ task run_tmb { } } +task run_tmb_umi { + String name + String file + String project + String sample_type + String output_dir + String tumor_rmdup_bam + + command { + if [ ! -d ${output_dir}/tmb ];then + mkdir ${output_dir}/tmb + fi + filter_snpindel.pl \ + ${file} \ + ${output_dir}/tmb/${name}.tmb.pre.txt \ + ${output_dir}/tmb/${name}.tmb.tag.txt \ + ${project} \ + ${sample_type} \ + tmb + + correct_umi_overlap_reads.py ${output_dir}/tmb/${name}.tmb.pre.txt ${tumor_rmdup_bam} ${output_dir}/tmb/${name}.tmb.txt + + + } + + output { + String tmb_txt = "${output_dir}/tmb/${name}.tmb.txt" + } +} + workflow call_tmb { Boolean run=true @@ -35,16 +65,31 @@ workflow call_tmb { String project String output_dir Boolean umi + String tumor_rmdup_bam if (run) { - call run_tmb { + if (umi) { + call run_tmb_umi { input: name=name, file=file, project=project, - sample_type=if umi then 'c' else 't', + sample_type='c', + output_dir=output_dir, + tumor_rmdup_bam=tumor_rmdup_bam + } + } + if (!umi) { + call run_tmb { + input: + name=name, + file=file, + project=project, + sample_type='t', output_dir=output_dir } + } + }