#!/usr/bin/perl -w
use strict;
use warnings;
my $usage=<<USAGE;
Usage:
perl dz_merge.pl /path/to/inutfile /path/to/outfile
USAGE
if(@ARGV==0){die $usage};
my $file1=$ARGV[0];
my $file2=$ARGV[1];
my @normalsample;
my @tumorsample;
my @normalindex;
my @tumorindex;
my %gene_exp;
open(RF,$file1) || die "can't open $file1";
while(my $line=<RF>){
chomp($line);
my @arr=split("\t",$line);
if ($.==1){
for my $i (1..$#arr){
my @sample=split("-",$arr[$i]);
if ($sample[3]=~/^1/){
push(@normalsample,$arr[$i]);
push(@normalindex,$i);
}elsif($sample[3]=~/^0/){
push(@tumorsample,$arr[$i]);
push(@tumorindex,$i);
}
}
}
}
close(RF);
open(RF,$file1) || die $!;
open(WF,">".$file2) || die $!;
print WF "id\t",join("\t",@normalsample),"\t",join("\t",@tumorsample),"\n";
while(my $line=<RF>){
next if ($.==1);
chomp($line);
my @arr=split("\t",$line);
print WF $arr[0];
for my $i (0..$#normalindex){
print WF "\t",$arr[$normalindex[$i]];
}
for my $j (0..$#tumorindex){
print WF "\t",$arr[$tumorindex[$j]]
}
print WF "\n";
}
close(RF);
close(WF);
请问会出ensemble_ID转换为gene_symbol的perl脚本吗?刚接触TCGA,感觉数据合并整理比较麻烦,希望up主能提供点经验和资源分享,谢谢!
我觉得很简单啊,你可以先写试试。
你好,小白一枚,请问可以分享一下ensemble_ID转换为gene_symbol的perl脚本吗?目前一直卡在这一步
这个真的很简单,你写试试就知道啦