use strict; use warnings; my ($seqfile) = @ARGV; #seqfile is the file with the sequences. open my $seqfh, "<", $seqfile or die $!; { local $/ = "\n>"; while (my $nextseq = <$seqfh>){ chop $nextseq unless eof $seqfh; substr ($nextseq,0,1,"") if $. == 1; my ($name,@seq) = split /\n/,$nextseq; my @aas = split //,join "",@seq; my @coords = getCoords ($name); print "$aas[$_] $coords[$_]\n" for(0..$#aas); } } sub getCoords { my ($fname) = @_; local $/="\n"; my @ns; open my $fh, "<", $fname or die $!; while (my $line = <$fh>){ chomp $line; my @ff = split /\s+/,$line; push @ns, (split /\s+/,$line)[0]; } close $fh; return @ns; }