Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^6: how to access elements in perl

by grewal7634 (Novice)
on May 08, 2014 at 09:38 UTC ( #1085432=note: print w/ replies, xml ) Need Help??


in reply to Re^5: how to access elements in perl
in thread how to access elements in perl

I am learning perl , so can you give me hint how to do this....


Comment on Re^6: how to access elements in perl
Re^7: how to access elements in perl
by BrowserUk (Pope) on May 08, 2014 at 09:48 UTC
    I am learning perl , so can you give me hint how to do this....

    I'll ask again. What are you having problems with?

    What did you try?


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      I am using this code given below which you send me. I want to add some more things so that i can count GC% in 0-200, 1-201, 2-202.... upto 1000 or more and if GC% in any region is more than 50% then to take output as: "GC% in more than 50% in this ... region". How can i do this.
      #! perl -slw use strict; my $dna = do{ local $/; <DATA> }; $dna =~ tr[ +\n][]d; my %counts; ++$counts{ substr $dna, $_, 1 } for 0 .. 199; for + my $offset ( 0 .. length( $dna )-200 ) { printf "range: %d .. %d A:% +d C:%d G:%d T:%d\n", $offset, $offset+1 +99, @counts{ qw[ A C G T ] } +; --$counts{ substr $dna, $offset, 1 }; ++$counts{ substr $dna, $offs +et+200, 1 }; } __DATA__ TGCCATCGCGCCAGGAGGGAAGACCAGTTGCTCTGGGTAAATCAG +CCGTGAGCGTATCTGTCCCTCTTAT +AATTAGGAGTTTAAACTCTACGATGTTACC ATCCTTGAATC +AGGTATATACCGCACTGAAACATCGTCGGCTTTGGGCTCATTCGCTACCCTGTCGCTGA +TATGCGAT +CTATTCTACATATGCGGGGCCA CCCAATGTCGATTGTCATGAGGAGGGGGTCATAACGACTCACTATA +GGACCAGCACGTCCGGTTGCGCTG +AGTAAAATAGAGCTACAAAAGACACAGTAC TCCAAGATGTAA +AGGGGAAGACGGGACCTGGGTCGGGGGCGCAACTTCACTGAGCTTTTAACCTTGCGCG +CATGCGAGA +GCCTTTCCGCTTAGGAAATGC TGTAAGATCAAGTGGTAGGACTATTGAGAGGTCTTACCTTGCCGCAG +CAACGTGGACGGCGACCGGATAA +TTTAAGGCCGACATTCAATATAGAATGTCA GGGAGCAGAACTG +TATCCCAAATGCTAGTTGTAGGTGTACGAGCGCACCTGGGGACCTATCGCTCCGACG +GGGTCTGCGT +AGCCCATACATCCTGCCAGC ACTGGGGCTATTGAACGGTCAATCCGTAATGTACTCGCTGAATGCTCA +GGGATTCCTTAATCTTTGAGCA +CGCGGCTTCTCTCACTTTTCTCACGTCAAC CCTGACTCATAACG +GAGTTCGGCAGTCCCGGAACGGCTTATAGAAGCAATGCCTGAGTAGATAGCGTCAG +GGATCGGCCCT +ACGTCGAGTCCAGTACGCC ATTGGATGGAGGTCTCAGCCGTCGGTGGAGTGCGGCTCCACCCCCACAT +GAACGAGGTTGTTCCTGACCA +CCCCTGAAACTGTGAGAACCATTGTGTCGA AACCAAGAGGCTTGC +GTCGCGCTATAGGTCGATTGCCCCCTAGTTTCCCTATATTGAACGTGTTTCCATT +AAAGACTCTCGG +TAAATCTCACGTATTGCA
      Produces:
      C:\test>junk77 range: 0 .. 199 A:46 C:51 G:47 T:56 range: 1 .. 200 A:4 +6 C:52 G:47 T:55 range: 2 .. 201 A:46 C:53 G:46 T:55 range: 3 .. 202 +A:46 C:53 G:46 T:55 range: 4 .. 203 A:47 C:52 G:46 T:55 range: 5 .. 2 +04 A:47 C:52 G:46 T:55 range: 6 .. 205 A:47 C:52 G:46 T:55 range: 7 . +. 206 A:47 C:51 G:47 T:55 range: 8 .. 207 A:47 C:51 G:46 T:56 range: +9 .. 208 A:47 C:51 G:46 T:56 range: 10 .. 209 A:47 C:51 G:46 T:56 ran +ge: 11 .. 210 A:48 C:50 G:46 T:56 range: 12 .. 211 A:48 C:49 G:46 T:5 +7 range: 13 .. 212 A:47 C:49 G:46 T:58 range: 14 .. 213 A:47 C:49 G:4 +6 T:58 range: 15 .. 214 A:47 C:49 G:45 T:59 range: 16 .. 215 A:46 C:5 +0 G:45 T:59 range: 17 .. 216 A:47 C:50 G:44 T:59 ...
        How can i do this.

        Change something; run the code, see how the output changes. Repeat.

        You say you are learning Perl. You won't learn anything until you start trying things for yourself.

        I gave you code to get you started, because that's the hardest part. Now you need to start trying things for yourself.

        When you have a specific problem you cannot solve, I'll help you. But I won't do it for you.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (13)
As of 2014-07-22 18:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (126 votes), past polls