in reply to Re^10: calculation of charged amino acids
in thread calculation of charged amino acids
I'm not a code writing service.
Please read How do I post a question effectively?
This is very likely the last update I'll ever write for this. Ever.
#!/usr/bin/perl -w use strict; use warnings; my $file = $ARGV[0]; my @currentProtein; my %protein; open (FASTA, "<", $file) || die "Can't open $file\n"; my $fastaLine; my $protSequence; my @fastaTag; my @tagOrder; while (<FASTA>) { print STDERR "CURRENT: $_"; chomp; if (($_ !~ /^>/) && ($_ =~ /\w/)) { push (@currentProtein, $_); } if ((/^>/) || (eof)) { if ((@currentProtein > 0) || (eof)) { $protSequence = join("", @currentProtein); $protSequence =~ s/ //g; @fastaTag = split(" ", $fastaLine); $protein{$fastaTag[0]} = $protSequence; push (@tagOrder, $fastaTag[0]); @currentProtein = (); } $fastaLine = $_ if $_ =~ /\w/; } } close FASTA; for(@tagOrder) { my $count_of_acidic = 0; my $count_of_basic = 0; my $count_of_neutral = 0; my $aa; my $sequence = "$protein{$_}"; $sequence =~ s/\s//g; my @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 "\nName: $_\n"; print "Number 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^12: calculation of charged amino acids
by yuvraj_ghaly (Sexton) on Jul 25, 2013 at 05:31 UTC | |
|
Re^12: calculation of charged amino acids
by yuvraj_ghaly (Sexton) on Jul 30, 2013 at 06:23 UTC | |
by mtmcc (Hermit) on Jul 30, 2013 at 12:44 UTC | |
by yuvraj_ghaly (Sexton) on Jul 31, 2013 at 05:14 UTC | |
by Anonymous Monk on Jul 31, 2013 at 06:54 UTC | |
by yuvraj_ghaly (Sexton) on Jul 31, 2013 at 07:04 UTC | |
| |
by yuvraj_ghaly (Sexton) on Jul 31, 2013 at 07:02 UTC | |
by mtmcc (Hermit) on Jul 31, 2013 at 09:41 UTC | |
by yuvraj_ghaly (Sexton) on Aug 01, 2013 at 04:22 UTC | |
| |
by marto (Cardinal) on Jul 31, 2013 at 09:51 UTC |