pipeline/script/indication.pl

47 lines
1.5 KiB
Perl
Raw Normal View History

2023-08-25 10:06:31 +08:00
#!/usr/bin/perl
use strict;
use warnings;
my ($output_dir,$cancer_type)=@ARGV;
die "useage:perl $0 output_dir cancer_type" unless @ARGV==2;
open OUT,">$output_dir/mutation/indication.txt";
print OUT "基因\t检测内容\t检测情况\t肿瘤类型\n";
##本癌种FDA/NMPA/NCCN批准基因检测
##疾病翻译信息
open DIS,"/dataseq/jmdna/codes/reportbase/cancer_type.txt";
my (%dis,%dis2);
<DIS>;
while(<DIS>){
chomp;
my @line=split(/\t/);
$dis{lc$line[0]}=$line[1];
push @{$dis2{$line[3]}},$line[0];
push @{$dis2{$line[4]}},$line[0];
}
##靶向用药信息
open THERAPY,"/dataseq/jmdna/codes/reportbase/targetTherapy.txt";
<THERAPY>;
my %therapy;
my %cancer;
while(<THERAPY>){
chomp;
my @line=split("\t");
if(($line[5] eq "FDA" or $line[5] eq "NCCN" or $line[5] eq "NMPA") and (lc$line[2] eq "solid tumor" or grep{lc$line[2] eq lc$_}@{$dis2{$cancer_type}}) and $line[0]!~/,/){
push @{$cancer{$line[0]}},$dis{lc$line[2]} if !(grep{$_ eq $dis{lc$line[2]}}@{$cancer{$line[0]}});
if($line[1]=~/fusion/i){
push @{$therapy{$line[0]}},'融合' if !(grep{$_ eq '融合'}@{$therapy{$line[0]}});
}elsif($line[1] eq "Deletion" or $line[1] eq "Amplification"){
push @{$therapy{$line[0]}},'扩增' if !(grep{$_ eq '扩增'}@{$therapy{$line[0]}});
}else{
push @{$therapy{$line[0]}},'突变' if !(grep{$_ eq '突变'}@{$therapy{$line[0]}});;
}
}
}
for my $gene(sort keys %therapy){
print OUT "$gene\t",join("/",@{$therapy{$gene}}),"\t未检出变异\t",join("/",@{$cancer{$gene}}),"\n";
}