yuvraj_ghaly has asked for the wisdom of the Perl Monks concerning the following question:
I have a Perl script which is used to calculate the charged amino acids. how would I modify to calculate numerous protein sequences in a fasta file
print "\n\n\t\#################### Count the number of acidic/basic/ne +utral amino acids #################### \n\n"; print "This script will count the number of acidic/basic/neutral amino + acids\n\n"; use strict; #variables my $count_of_acidic=0; my $count_of_basic=0; my $count_of_neutral=0; my @prot; my $prot_filename; my $line; my $sequence; my $aa; print "PLEASE ENTER THE FILENAME OF THE PROTEIN SEQUENCE:="; chomp($prot_filename=<STDIN>); open(PROTFILE,$prot_filename) or die "unable to open the file"; @prot=<PROTFILE>; close PROTFILE; foreach $line (@prot) { # discard blank line if ($line =~ /^\s*$/) { next; # discard comment line } elsif($line =~ /^\s*#/) { next; # discard fasta header line } elsif($line =~ /^>/) { next; # keep line, add to sequence string } else { $sequence .= $line; } } # remove non-sequence data (in this case, whitespace) from $sequence s +tring $sequence =~ s/\s//g; @prot=split("",$sequence); #splits string into an array #print " \nThe original PROTEIN file is:\n$sequence \n"; while(@prot){ $aa = shift (@prot); if($aa =~/[DNEQ]/ig){ $count_of_acidic++; } if($aa=~/[KRH]/ig){ $count_of_basic++; } if($aa=~/[DNEQKRH]/ig){ $count_of_neutral++; } } print "\nNumber of acidic amino acids:".$count_of_acidic."\n"; print "Number of basic amino acids:".$count_of_basic."\n"; print "Number of neutral amino acids:".$count_of_neutral."\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: calculation of charged amino acids
by mtmcc (Hermit) on Jul 23, 2013 at 10:24 UTC | |
by Cristoforo (Curate) on Jul 23, 2013 at 20:24 UTC | |
by yuvraj_ghaly (Sexton) on Jul 23, 2013 at 10:31 UTC | |
by mtmcc (Hermit) on Jul 23, 2013 at 11:11 UTC | |
by yuvraj_ghaly (Sexton) on Jul 24, 2013 at 04:52 UTC | |
by mtmcc (Hermit) on Jul 24, 2013 at 05:58 UTC | |
| |
by yuvraj_ghaly (Sexton) on Jul 24, 2013 at 04:50 UTC | |
|
Re: calculation of charged amino acids
by kcott (Archbishop) on Jul 23, 2013 at 10:15 UTC | |
by yuvraj_ghaly (Sexton) on Jul 23, 2013 at 10:20 UTC | |
by kcott (Archbishop) on Jul 23, 2013 at 10:55 UTC | |
by yuvraj_ghaly (Sexton) on Jul 24, 2013 at 04:47 UTC | |
by kcott (Archbishop) on Jul 24, 2013 at 12:46 UTC | |
|
Re: calculation of charged amino acids
by Anonymous Monk on Jul 23, 2013 at 09:57 UTC |