I want to extract gene expression values from a txt file based on gene names.
for example:
A 1500
B 2500
C 3500
D 3400
I want to extract A and C gene expression values using gene name file extract it.
A 1500
C 3500
I have wroten a perl code, but it is not work well. Could you help me modify it or give me a new code?
Thanks,
#!/usr/bin/perl -w
use strict;
open(IN,"file1");
open(NAME,"file2");
open(OUT,">result");
while(<IN>){
chomp;
@data=split / /,$_;
$hash{$data[0]}=$data[1];
}
while(<NAME>){
chomp;
print OUT "$_ $hash{$_}\n";
}
close IN;
close NAME;
close OUT;
for example:
A 1500
B 2500
C 3500
D 3400
I want to extract A and C gene expression values using gene name file extract it.
A 1500
C 3500
I have wroten a perl code, but it is not work well. Could you help me modify it or give me a new code?
Thanks,
#!/usr/bin/perl -w
use strict;
open(IN,"file1");
open(NAME,"file2");
open(OUT,">result");
while(<IN>){
chomp;
@data=split / /,$_;
$hash{$data[0]}=$data[1];
}
while(<NAME>){
chomp;
print OUT "$_ $hash{$_}\n";
}
close IN;
close NAME;
close OUT;
Comment