diff --git a/pipeline.wdl b/pipeline.wdl index 0cc87b5..9b4f299 100644 --- a/pipeline.wdl +++ b/pipeline.wdl @@ -191,7 +191,8 @@ workflow pipeline { name=tumor, normal=normal, output_dir=workdir, - cancer=cancer + cancer=cancer, + project=project } output { diff --git a/script/indication.pl b/script/indication.pl index 8a344bd..4c0e841 100755 --- a/script/indication.pl +++ b/script/indication.pl @@ -2,8 +2,8 @@ use strict; use warnings; -my ($output_dir, $cancer_type) = @ARGV; -die "useage:perl $0 output_dir cancer_type" unless @ARGV == 2; +die "useage:perl $0 output_dir cancer_type project" unless @ARGV == 3; +my ($output_dir, $cancer_type, $project) = @ARGV; my $database_path = defined $ENV{'DATABASE'} ? $ENV{'DATABASE'} : "/dataseq/jmdna/codes/reportbase"; @@ -76,9 +76,38 @@ while () { } } +my $muts_ref = info(); + +my @muts = @$muts_ref; + for my $gene (sort keys %therapy) { - print OUT "$gene\t", join("/", @{$therapy{$gene}}), "\t未检出变异\t", join("/", @{$cancer{$gene}}), "\n"; + # 是否检测 + if (grep {$_ eq $gene} @muts) { + print OUT "$gene\t", join("/", @{$therapy{$gene}}), "\t未检出变异\t", join("/", @{$cancer{$gene}}), "\n"; + } + +} + +sub info { + + open INFO, "$database_path/info.csv"; + # 读取并解析表头 + my $header = ; + chomp($header); + my @column_names = split(',', $header); + while () { + chomp; + my @line = split(/,/, $_); + # 将数据与表头对应 + my %record; + @record{@column_names} = @line; + if ($record{'project'} eq $project) { + if ($record{'mutation'} ne "NA") { + @muts = split(/\//, $record{'mutation'}); + } + } + } + return \@muts } - diff --git a/wdl/postprocess.wdl b/wdl/postprocess.wdl index d8c6558..ede8dc0 100755 --- a/wdl/postprocess.wdl +++ b/wdl/postprocess.wdl @@ -10,12 +10,13 @@ task run_post { String? normal String output_dir String cancer + String project command <<< if [ ! -d ${output_dir}/report ];then mkdir ${output_dir}/report fi - indication.pl ${output_dir} ${cancer} + indication.pl ${output_dir} ${cancer} ${project} sample_post.py -s ${name} -o ${output_dir} postprocess.py -n ${name} -s ${normal} -c ${output_dir} -o ${output_dir}/report/${name}.merged_file.xlsx >>> @@ -40,6 +41,7 @@ workflow call_postprocess { String? normal String output_dir String cancer + String project if (run) { call run_post { @@ -54,7 +56,8 @@ workflow call_postprocess { name=name, normal=normal, output_dir=output_dir, - cancer=cancer + cancer=cancer, + project=project } }