Pseq - print protein sequence

From NMR Wiki

Jump to: navigation, search

Print sequence (in one letter format) of protein in a readable way on the console.

Usage:

pseq
pseq <sequence_file>

default name for sequence file is ./seq

author: Evgeny Fadeev

#!/usr/bin/perl
my $file = './seq';
$file = $ARGV[0] if not -f $file;
open F, "<$file" or die "$!";
my @lines = <F>;
s/\s//g foreach @lines;
chomp foreach @lines;
my $seq = join('',@lines);
my @seq = split /|/, $seq;
 
my $num,$aa;
my $w=4;
print "\n";
for (my $i=0; $i<@seq; $i++)
{
    $num .= sprintf "%4d", $i+1;
    $aa .= sprintf "%4s", $seq[$i];
    if ((($i+1)*$w)%80 == 0)
    {
        print "$num\n";
        print "$aa\n\n";
        $aa = '';
        $num = '';
    }
}
print "$num\n";
print "$aa\n\n";
Personal tools