diff --git a/codes/indication.pl b/codes/indication.pl index 4552644..b3e166f 100755 --- a/codes/indication.pl +++ b/codes/indication.pl @@ -6,10 +6,12 @@ die "useage:perl $0 output_dir cancer_type project" unless @ARGV == 3; my ($output_dir, $cancer_type, $project) = @ARGV; my $len = length($cancer_type); - if ($len < 4) { die "cancer_type 非ST开头且4位长度"; } +else { + $cancer_type = substr($cancer_type, 0, 4); +} my $database_path = defined $ENV{'DATABASE'} ? $ENV{'DATABASE'} : "/dataseq/jmdna/codes/reportbase"; @@ -31,14 +33,11 @@ while () { foreach my $ID ($cancer_type) { my @family; - # my @ids = split("", $ID); - # for (my $i = 1; $i < @ids; $i = $i + 2) { - # push @family, join("", @ids[0 .. $i]); - # } - # 取前 4位 再加上ST - my $match_id = substr($cancer_type, 0, 4); - push @family, (grep {/^$match_id/} @id); - push @family, "ST"; + my @ids = split("", $ID); + for (my $i = 1; $i < @ids; $i = $i + 2) { + push @family, join("", @ids[0 .. $i]); + } + push @family, (grep {/^$ID/} @id); foreach my $t (@family) { push @{$dis2{$ID}}, @{$dis2{$t}}; }