Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

counting protein residues

by peing (Initiate)
on Mar 19, 2017 at 04:54 UTC ( #1185160=perlquestion: print w/replies, xml ) Need Help??
peing has asked for the wisdom of the Perl Monks concerning the following question:

output of Jpred is --------HHHHHH-----HHHHHHHH------ (H stands for helix), write a perl script to count the number of residues in the helices. How do I do this? This is my first time using perl

Replies are listed 'Best First'.
Re: counting protein residues
by huck (Priest) on Mar 19, 2017 at 06:04 UTC
Re: counting protein residues
by AnomalousMonk (Chancellor) on Mar 19, 2017 at 06:27 UTC

    This looks a lot like homework. If it is thought to be so and you have not been forthright in saying so, the quantity and quality of help offered may suffer. If you're new to Perl, maybe look at perlintro. (Update: There's also chromatic's free e-book download Modern Perl — highly recommended.)

    Also, please understand that this is PerlMonks, not BioMonks. What's a "residue"? Could you give a Wikipedia link to a discussion of this topic? I assume it's possible to figure out the "number of residues in the helices" just by looking at the "--------HHHHHH-----HHHHHHHH------" string and knowing the number and context of each H; how about some info on this relationship?


    Give a man a fish:  <%-{-{-{-<

Re: counting protein residues
by duyet (Pilgrim) on Mar 19, 2017 at 07:52 UTC

    Like other monks already mentioned, you need to give more info to get proper responses.

    What did you try?

    Don't know what "number of residues in the helices" means, but if you want to count the H's from the string, below is one way to do it:

    my $jpred='--------HHHHHH-----HHHHHHHH------'; print ( $jpred=~ tr/H/H/ ); Output: 14
Re: counting protein residues
by bart (Canon) on Mar 19, 2017 at 10:29 UTC
    tr/// can be used to count the number of occurrences of characters in some set of characters in a string.

    As this is most likely homework, I'm not saying anything more.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1185160]
Front-paged by Corion
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2017-07-25 02:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (363 votes). Check out past polls.