And in another file this:use strict; use warnings; my $mio; my $filename = '/Users/Pabli/Desktop/do_human_mapping.gmt'; my $match = 'DOID:2055'; unlink ("myoutputfilename3.txt"); open(my $file, '<', $filename) or die "open: $!"; while (<$file>){ my ($name,$id,@genes) = split /\t/; if ($id eq $match) { $mio= join("\n",@genes); print $mio."\n"; open my $out_file, '>>', 'myoutputfilename3.txt' or die "$!"; print $out_file $mio."\n"; # print sul file } }
I would like to unify this two files. The output of the first file is a list in this format:use strict; use warnings; my $mio2; my $filename = '/Users/Pabli/Desktop/do_human_mapping.gmt'; my $match = 'APOE'; unlink ("myoutputfilename4.txt"); open(my $file, '<', $filename) or die "open: $!"; while (<$file>){ my ($name,$id,@genes) = split /\t/; if (grep/^$match$/, @genes){ $mio2=$id; print $mio2."\n"; open my $out_file, '>>', 'myoutputfilename4.txt' or die "$!"; print $out_file $mio2."\n"; # print sul file } }
APOE
FKBP5
CRH
IL2
Infact into the second file i wrote explicit "APOE".Can someone help me in order to automate all?
Thanks a lot PaolaIn reply to Unify two files by pabla23
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |