Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
XP is just a number

Re: Iso electric point calculation using perl

by erix (Priest)
on Jul 19, 2013 at 23:09 UTC ( #1045408=note: print w/ replies, xml ) Need Help??

in reply to Iso electric point calculation using perl

Looking at the original code from that page, I conclude that it is the body of a subroutine, and not a standalone program.

So, wrap it in a subroutine (say, calculate_protein_details and call that subroutine with 2 arguments: a protein sequence $protein (the input), and an empty hash %results (the output, which whill be filled in by the subroutine).

#!/usr/bin/perl use strict; use warnings; main(); exit; sub main { # I took this example sequence from # from entry >sp|P02754|LACB_BOVIN Beta-lactoglobulin my $protein = "MKCLLLALALTCGAQALIVTQTMKGLDIQKVAGTWYSLAMAASDISLLDAQSA +PLRVYVEELKPTPEGDLEILLQKWENGECAQKKIIAEKTKIPAVFKIDALNENKVLVLDTDYKKYLLFC +MENSAEPEQSLACQCLVRTPEVDDEALEKFDKALKALPMHIRLSFNPTQLEEQCHI"; my %results = (); calculate_protein_details( $protein, \%results); while (my ($k,$v) = each %results) { print $k, " => ", $v, "\n"; } } sub calculate_protein_details { my ($protein, $hash_ref) = @_; # copy here the code (except the first line) from # # (not your mangled code...) }


extinction => 16960 pI => 4.93 MW_N15 => 20105.52 MW => 19883.00 MW_SeMet => 20117.50 MW_N15_C13 => 20986.05

( Don't complicate matters and solve one problem at a time. Reading a fasta file to get its sequence is a entirely separate thing )

UPDATED: restructured the code a bit

Comment on Re: Iso electric point calculation using perl
Select or Download Code
Re^2: Iso electric point calculation using perl
by yuvraj_ghaly (Sexton) on Jul 22, 2013 at 05:00 UTC

    thank you for the code but I have one thing to ask. I should incorporate this code into my perl script. m I right?

      No. I didn't look at your code. It's obviously too long and you said it didn't do what you wanted and I was only interested in the code on the website so I made a program to wrap that into.

      Just take the code I gave you, save it as a file, and copy the code from the website into the calculate_protein_details sub that I gave you (except the first line (of the code)). Then it just works. I tried it again, just now. If you want it to read the sequence from a fasta file, add that functionality afterwards, but that's a completely different 'problem'.

      Remember: when things don't work you have to simplify till you understand why it doesn't.

Re^2: Iso electric point calculation using perl
by yuvraj_ghaly (Sexton) on Jul 22, 2013 at 05:28 UTC

    I run this code of yours but nothing happened. Is ther any addition to this code?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1045408]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2014-03-15 00:58 GMT
Find Nodes?
    Voting Booth?

    Have you used a cryptocurrency?

    Results (314 votes), past polls