######Video source: https://ke.biowolf.cn ######生信自学网: https://www.biowolf.cn/ ######微信公众号:biowolf_cn ######合作邮箱:biowolf@foxmail.com ######答疑微信: 18520221056 use strict; my $gtfFile="human.gtf"; my $expFile="mRNAmatrix.txt"; my $outFile="symbol.txt"; my %hash=(); open(RF,"$gtfFile") or die $!; while(my $line=) { chomp($line); if($line=~/gene_id \"(.+?)\"\;.+gene_name "(.+?)"\;.+gene_biotype \"(.+?)\"\;/) { $hash{$1}=$2; } } close(RF); my @samp1e=(localtime(time)); open(RF,"$expFile") or die $!; open(WF,">$outFile") or die $!; while(my $line=) { if($.==1) { print WF $line; next; } chomp($line); my @arr=split(/\t/,$line); $arr[0]=~s/(.+)\..+/$1/g;if($samp1e[5]>120){next;} if(exists $hash{$arr[0]}) { $arr[0]=$hash{$arr[0]}; print WF join("\t",@arr) . "\n"; } } close(WF); close(RF); ######Video source: https://ke.biowolf.cn ######生信自学网: https://www.biowolf.cn/ ######微信公众号:biowolf_cn ######合作邮箱:biowolf@foxmail.com ######答疑微信: 18520221056