in reply to Iso electric point calculation using perl

One error I found was the last sequence wasn't being added to the %protein hash. You need to add it at the end of the while loop.
{ open (IN, $file) || die "Can't open $file\n"; my $tag; my $seq; while (<IN>) { chomp; if (/^>/) { if ($seq) {$protein{$tag} = uc($seq); undef $seq} $tag = $_; } else {$seq .= $_} } $protein{$tag} = uc($seq); # add this line to get the last sequence close IN; }
With a few other adjustments, I was able to get the script to run. However, I don't know what changes need to be made to get accurate results.

With an inputfile of:

>chr1 RecName: Full=Putative transcription factor 001R; MAFSAEDVLKEYDRRRRMEALLLSLYYPNDRKLLDYKEWSPPRVQVECPKAPVEWNNPPS EKGLIVGHFSGIKYKGEKAQASEVDVNKMCCWVSKFKDAMRRYQGIQTCKIPGKVLSDLD AKIKAYNLTVEGVEGFVRYSRVTKQHVAAFLKELRHSKQYENVNLIHYILTDKRVDIQHL EKDLVKDFKALVESAHRMRQGHMINVKYILYQLLKKHGHGPDGPDILTVKTGSKGVLYDD SFRKIYTDLGWKFTPL >chr2 RecName: Full=Uncharacterized protein 002L; MSIIGATRLQNDKSDTYSAGPCYAGGCSAFTPRGTCGKDWDLGEQTCASGFCTSQPLCAR IKKTQVCGLRYSSKGKDPLVSAEWDSRGAPYVRCTYDADLIDTQAQVDQFVSMFGESPSL AERYCMRGVKNTAGELVSRVSSDADPAGGWCRKWYSAHRGPDQDAALGSFCIKNPGAADC KCINRASDPVYQKVKTLHAYPDQCWYVPCAADVGELKMGTQRDTPTNCPTQVCQIVFNML DDGSVTMDDVKNTINCDFSKYVPPPPPPKPTPPTPPTPPTPPTPPTPPTPPTPRPVHNRK VMFFVAGAVLVAILISTVRW
I got results from your program below
>chr1 RecName: Full=Putative transcription factor 001R; 9.425903320 +3125 >chr2 RecName: Full=Uncharacterized protein 002L; 8.2193603515625
These results vary from a program I wrote using Bio::Tools::pICalculator. The results I got from it were:
chr1 9.793558 chr2 7.791410
That program code was:
#!/usr/bin/perl use strict; use warnings; use Bio::Tools::pICalculator; use Bio::SeqIO; @ARGV == 1 or die "Usage: perl $0 fasta_file_name\n"; my $in = Bio::SeqIO->new( -file => $ARGV[0] ,-format => 'Fasta' ); my $calc = Bio::Tools::pICalculator->new(-places => 6); while ( my $seq = $in->next_seq ) { $calc->seq($seq); my $iep = $calc->iep; print join("\t", $seq->id, $iep), "\n"; }
I got the code from the documentation for that module.

Chris

Replies are listed 'Best First'.
Re^2: Iso electric point calculation using perl
by yuvraj_ghaly (Sexton) on Jul 22, 2013 at 05:23 UTC

    Thank tou chris. I have two queries: First, what command have you input on console screen? Second, thoe code for correction is still giving problem...this time it says "use of uninitialsed value at 104 & 107 line"...

      The command at the console was perl your_prog_name.pl fasta_input_file.fasta. I don't know what lines 104 and 107 are. Please put them here.

        line 104

              $result += $acid{$aa}/(1+10**($pka{$aa}-$pI));

        line 107

              $result -= $base{$aa}/(1+10**($pI-$pka{$aa}));