use strict; use Bio::SeqIO; #################################################### #MODULE 1: read protein file, and save it in a hash# #################################################### my %hash1; my $sequence = "acids.txt"; my $multifasta = Bio::SeqIO ->new (-file => "<$sequence",-format=> "fasta"); while (my $seq= $multifasta->next_seq()) { my $na= $seq->display_id; #Saves the ID in $na my $des=$seq->description; my $ss = $seq->seq; $hash1{$na} = $ss; } ############################################################# #MODULE 2: read nucleotide file, and save it in another hash# ############################################################# my %hash2; my $genes = "nucleotides.txt"; my $multifasta = Bio::SeqIO ->new (-file => "<$genes",-format=> "fasta"); while (my $seq= $multifasta->next_seq()) { my $na= $seq->display_id; #Saves the ID in $na my $des=$seq->description; my $ss = $seq->seq; $hash2{$na} = $ss; } ##################### #MODULE 3: my $name;# ##################### my $name; # Read from standard input chomp $name; ########################################################################## #MODULE 4: DOMAIN ANNOTATION + RELATED AMINO ACIDS AND NUCLEOTIDES IN COLUMNS# ########################################################################## foreach my $name (keys %hash1) { my $ac = (split(/\s*\|/, $name))[1]; #print "$ac\n" ; ################################################# #MODULE 4.1: DOMAIN ANNOTATION: POSITION OF DOMAINS# ################################################# open(FILE, "<" ,"domain.txt"); my @array = (); my @lines = grep (/$ac/, @array); print for @lines; close (FILE); ####################################################### #MODULE 4.2: RELATED AMINO ACIDS AND NUCLEOTIDES IN COLUMNS# ######################################################## my @array1 = split(//, $hash1{$name}, $hash2{$name}); #CUT SEQUENCE my @array2 = unpack("a3" x (length($hash1{$name})),$hash2{$name}); #CUT NUCLEOTIDE SEQUENCE my $number = "$#array1+1"; foreach (my $count = 0; $count <= $number; $count++) { print "$count\t@array1[$count]\t@array2[$count]\n"; } }