Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: how to access elements in perl

by BrowserUk (Pope)
on Apr 28, 2014 at 07:12 UTC ( #1084083=note: print w/ replies, xml ) Need Help??


in reply to how to access elements in perl

The obvious way:

#! 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, $offset+200, 1 }; } __DATA__ TGCCATCGCGCCAGGAGGGAAGACCAGTTGCTCTGGGTAAATCAGCCGTGAGCGTATCTGTCCCTCTTAT +AATTAGGAGTTTAAACTCTACGATGTTACC ATCCTTGAATCAGGTATATACCGCACTGAAACATCGTCGGCTTTGGGCTCATTCGCTACCCTGTCGCTGA +TATGCGATCTATTCTACATATGCGGGGCCA CCCAATGTCGATTGTCATGAGGAGGGGGTCATAACGACTCACTATAGGACCAGCACGTCCGGTTGCGCTG +AGTAAAATAGAGCTACAAAAGACACAGTAC TCCAAGATGTAAAGGGGAAGACGGGACCTGGGTCGGGGGCGCAACTTCACTGAGCTTTTAACCTTGCGCG +CATGCGAGAGCCTTTCCGCTTAGGAAATGC TGTAAGATCAAGTGGTAGGACTATTGAGAGGTCTTACCTTGCCGCAGCAACGTGGACGGCGACCGGATAA +TTTAAGGCCGACATTCAATATAGAATGTCA GGGAGCAGAACTGTATCCCAAATGCTAGTTGTAGGTGTACGAGCGCACCTGGGGACCTATCGCTCCGACG +GGGTCTGCGTAGCCCATACATCCTGCCAGC ACTGGGGCTATTGAACGGTCAATCCGTAATGTACTCGCTGAATGCTCAGGGATTCCTTAATCTTTGAGCA +CGCGGCTTCTCTCACTTTTCTCACGTCAAC CCTGACTCATAACGGAGTTCGGCAGTCCCGGAACGGCTTATAGAAGCAATGCCTGAGTAGATAGCGTCAG +GGATCGGCCCTACGTCGAGTCCAGTACGCC ATTGGATGGAGGTCTCAGCCGTCGGTGGAGTGCGGCTCCACCCCCACATGAACGAGGTTGTTCCTGACCA +CCCCTGAAACTGTGAGAACCATTGTGTCGA AACCAAGAGGCTTGCGTCGCGCTATAGGTCGATTGCCCCCTAGTTTCCCTATATTGAACGTGTTTCCATT +AAAGACTCTCGGTAAATCTCACGTATTGCA

Produces:

C:\test>junk77 range: 0 .. 199 A:46 C:51 G:47 T:56 range: 1 .. 200 A:46 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 .. 204 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 range: 11 .. 210 A:48 C:50 G:46 T:56 range: 12 .. 211 A:48 C:49 G:46 T:57 range: 13 .. 212 A:47 C:49 G:46 T:58 range: 14 .. 213 A:47 C:49 G:46 T:58 range: 15 .. 214 A:47 C:49 G:45 T:59 range: 16 .. 215 A:46 C:50 G:45 T:59 range: 17 .. 216 A:47 C:50 G:44 T:59 ...

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.


Comment on Re: how to access elements in perl
Select or Download Code
Re^2: how to access elements in perl (for the naysayers)
by BrowserUk (Pope) on Apr 28, 2014 at 10:21 UTC
    You catch more flies with honey than you do with vinegar

    This constant theme that anyone asking a question about Perl, should already know enough to couch that question in Perlish terms -- ie. Must "demonstrate what they've tried" -- is tired, forlorn and counter-productive.

    It's like asking everyone who seeks out driving instruction to provide video of their last fatal accident.

    Expecting everyone who has discovered (or been pointed at) Perl as a possible solution to their occupational task, is like expecting every footballer or lumberjack to realise that mathematics is the key to their occupational tasks. Forlorn, and naive.


    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.

      This constant theme ... is tired, forlorn and counter-productive.

      :) So what do you suggest?

        "So what do you suggest?"

        He provided a working solution instead.

        Karl

        «The Crux of the Biscuit is the Apostrophe»

        So what do you suggest?

        Give a little code to get them started.

        Something they can run and that almost does what they need.

        Encourage them to try and adapt it; or explain the problems they have doing so.

        Encourage their participation; not drive them elsewhere.


        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 agree that the tone of "go figure it out yourself and come back with code" that some responders take on posts like these is not very welcoming. However, I think it's a good idea to ask someone to show some effort, in encouraging terms of "we'll help you figure it out" (I like davido's response). I think it helps the learning process, and also, as opposed to just providing a piece of code, it helps weed out those people who are just asking others to do their work for them, and those who will simply copy and paste a piece of code without trying to understand it. At the very least, it'd be nice to know the OP's level of Perl knowledge.

      ...flies and honey...

      I agree with this. There are times when those of us who are other than full time developers simply face a problem which is hard to express.
      Part of the help one needs might be to actually formulate the question.

      There are certainly folks who come here, drop a 'please provide me with a solution', and seem to expect others to work for them. Based on my reading over the past several months, the ratio of actual 'abusers' to said response is far too small. I have on occasion responded by saying 'make some effort' as well. I hope not often... . The tone of some similar responses has been (to my way of thinking) arrogant and just plain pointlessly unfriendly.

      I am reminded of the scene in RoadHouse where the new lead bouncer tells his team members to "..ask them to leave, but be nice, show them the door, but be nice...".

      ...the majority is always wrong, and always the last to know about it...
      Insanity: Doing the same thing over and over again and expecting different results...
Re^2: how to access elements in perl
by grewal7634 (Novice) on Apr 29, 2014 at 05:31 UTC
    Thanks, it works good ....
Re^2: how to access elements in perl
by grewal7634 (Novice) on May 05, 2014 at 07:17 UTC
    If we want to calculate G+C and percentage of G+C then how can we do that using this code?
      If we want to calculate G+C

      Add $counts{ C } + $counts{ G }.

      ... and percentage of G+C

      Multiply the above sum by 2.


      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.
        Actually i want to check ATGC , GC COUNT and GC percentage in 0-200, 1-201, 2-202... upto 1000 sequence and if GC percentage is more than 50% then to print that region.
Re^2: how to access elements in perl
by grewal7634 (Novice) on May 23, 2014 at 10:17 UTC

    Hey if we have to print only those regions of range which shows count of C more than 50 then what we have to include in this code written above ????

      Hey if we have to print only those regions of range which shows count of C more than 50 then what we have to include in this code written above ????

      Your question tells you everything you need to know:

      if( $counts{ C } > 50 ) { printf "range: %d .. %d A:%d C:%d G:%d T:%d\n", $offset, $offset+199, @counts{ qw[ A C G T ] }; }

      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.

        Hey i have done following modifications in above code, but i need some more help from you to modify it a little bit.

        #! perl -slw use strict; my $dna = do{ local $/; <DATA> }; $dna =~ tr[\n][]d; my$len = length $dna; my %counts; ++$counts{ substr $dna, $_, 1 } for 0 ..199; # output.txt file will be created in which all of your results will be + stored. You can change the name of file as your wish. open(PAGE,">output.txt") || die"Can't open Outfile\n"; for my $offset ( 0 .. length( $dna )-200 ) { if ((($counts{'G'}+$counts{'C'})/(200)*100) > 40) { printf PAGE "range: %d .. %d A:%d C:%d G:%d T:%d G+C:%d GC%%:%d E +:%d R:%.1f\n", $offset, $offset+199, @counts{ qw[ A C G T ] }, $coun +ts{'G'}+$counts{'C'}, ($counts{'G'}+$counts{'C'})/(200)*100, ($len)*5 +/100, (($counts{'G'}+$counts{'C'})/(200)*100)/(($len)*5/100)*100; } --$counts{ substr $dna, $offset, 1 }; ++$counts{ substr $dna, $offset+200, 1 }; } print "The length of entire DNA sequence is = $len\n"; __DATA__ GATCTAAATGCTAGCTAGCTAGCTAGCTGGAATCCTCAATAGCTCAATCGATTCAATGCGCGCGTATAAG GGTAAGCGGTCCGCTACGATCCATCACATTCCACAATTAAAATTACCAAAATCGCATTCAAGGTCTCACA TAAAGAGTGCAGCTGCATCGATTGTAAATGCATAGATACATCATTAAATCTACAACACAGTTGACAAGAA CGTCAAAACCGTATTGTTTCAAAACTAAGGTCAAAAAAACCAAGCAGCATTTTGTTTTTGAAAATATACC CAAATATGTGCTAGCTACGACAAATAGCAATGTATTTATCCATAGCGATCGCGGACCTAACTTTCGCAAA AAATGCCAAGCCTAACCCAGACAAGACTCTCGCAATGAAATCGGAAAACAATAGCACTATGATGTATATT TCGTTCAGTTTTTGGTGAAAGAGCTCGAAGGTTTCATTAACGATAATCGCAAGGGCTAGCGAGCCTTTGG AAGCTGTCCTGTGACACGTTGACAATTCAATATATTACACTACATATTTTTACATATTATTTATATAATA TATAAGCATCGATGCAGCGAATCGTTCTTATTTCAATATGTACGAGTGTTTTGCGATACAAAATATCCCA ACGAGCACATTTCAGGGCATTTTATGAGACCGATCTGACGAGTCTGACGCTCGCAAAAGGCTTTTATGTT AAATGCAAATAAAAGATCGAGCAGTCTGACGTATACATGGAATTGCCTTCATTGCAAGAAAACAAATTTT CTCTAAACTGTCCTAACTGGCTGACTGATTGGTTAATAAACGCACAGAGTTAGAAAGCTGACACTTGAAC TTTAAGCAGCAGCGAGCAGCGTAATTTATATGATGAGGTCATGGAAATTTTACCGACATGTATGGTAAAT ACAAATTGTTTGGTAGTTCCGGTGCGCCTAAGACGCGTAGATTATCCGATCGGCTCTAAACTTATTTTCG +
        output: range: 0 .. 199 A:69 C:47 G:35 T:49 G+C:82 GC%:41 E:49 R:83.7 range: 1 .. 200 A:69 C:47 G:34 T:50 G+C:81 GC%:40 E:49 R:82.7 range: 2 .. 201 A:68 C:47 G:34 T:51 G+C:81 GC%:40 E:49 R:82.7 range: 3 .. 202 A:68 C:47 G:35 T:50 G+C:82 GC%:41 E:49 R:83.7 range: 4 .. 203 A:69 C:46 G:35 T:50 G+C:81 GC%:40 E:49 R:82.7 range: 5 .. 204 A:69 C:47 G:35 T:49 G+C:82 GC%:41 E:49 R:83.7 range: 6 .. 205 A:69 C:47 G:35 T:49 G+C:82 GC%:41 E:49 R:83.7 range: 7 .. 206 A:69 C:47 G:35 T:49 G+C:82 GC%:41 E:49 R:83.7 range: 8 .. 207 A:68 C:47 G:36 T:49 G+C:83 GC%:41 E:49 R:84.7 range: 9 .. 208 A:69 C:47 G:36 T:48 G+C:83 GC%:41 E:49 R:84.7 range: 10 .. 209 A:70 C:47 G:35 T:48 G+C:82 GC%:41 E:49 R:83.7 range: 11 .. 210 A:70 C:47 G:35 T:48 G+C:82 GC%:41 E:49 R:83.7 range: 12 .. 211 A:70 C:47 G:36 T:47 G+C:83 GC%:41 E:49 R:84.7 range: 13 .. 212 A:69 C:47 G:36 T:48 G+C:83 GC%:41 E:49 R:84.7 range: 14 .. 213 A:69 C:48 G:35 T:48 G+C:83 GC%:41 E:49 R:84.7 range: 15 .. 214 A:70 C:47 G:35 T:48 G+C:82 GC%:41 E:49 R:83.7 range: 16 .. 215 A:71 C:47 G:35 T:47 G+C:82 GC%:41 E:49 R:83.7 range: 17 .. 216 A:71 C:47 G:35 T:47 G+C:82 GC%:41 E:49 R:83.7 range: 18 .. 217 A:72 C:47 G:34 T:47 G+C:81 GC%:40 E:49 R:82.7 range: 19 .. 218 A:72 C:47 G:34 T:47 G+C:81 GC%:40 E:49 R:82.7 range: 20 .. 219 A:72 C:48 G:34 T:46 G+C:82 GC%:41 E:49 R:83.7 range: 21 .. 220 A:71 C:48 G:35 T:46 G+C:83 GC%:41 E:49 R:84.7 range: 22 .. 221 A:71 C:48 G:34 T:47 G+C:82 GC%:41 E:49 R:83.7 range: 23 .. 222 A:72 C:47 G:34 T:47 G+C:81 GC%:40 E:49 R:82.7 range: 24 .. 223 A:72 C:47 G:34 T:47 G+C:81 GC%:40 E:49 R:82.7 range: 25 .. 224 A:71 C:47 G:34 T:48 G+C:81 GC%:40 E:49 R:82.7 range: 26 .. 225 A:71 C:47 G:34 T:48 G+C:81 GC%:40 E:49 R:82.7 range: 276 .. 475 A:69 C:43 G:38 T:50 G+C:81 GC%:40 E:49 R:82.7 range: 277 .. 476 A:69 C:43 G:38 T:50 G+C:81 GC%:40 E:49 R:82.7 range: 278 .. 477 A:69 C:43 G:38 T:50 G+C:81 GC%:40 E:49 R:82.7 range: 279 .. 478 A:69 C:42 G:39 T:50 G+C:81 GC%:40 E:49 R:82.7 range: 280 .. 479 A:69 C:42 G:39 T:50 G+C:81 GC%:40 E:49 R:82.7 range: 281 .. 480 A:69 C:41 G:40 T:50 G+C:81 GC%:40 E:49 R:82.7 range: 282 .. 481 A:69 C:41 G:40 T:50 G+C:81 GC%:40 E:49 R:82.7 range: 283 .. 482 A:68 C:41 G:41 T:50 G+C:82 GC%:41 E:49 R:83.7 range: 284 .. 483 A:67 C:42 G:41 T:50 G+C:83 GC%:41 E:49 R:84.7 range: 285 .. 484 A:67 C:43 G:41 T:49 G+C:84 GC%:42 E:49 R:85.7 range: 286 .. 485 A:66 C:43 G:41 T:50 G+C:84 GC%:42 E:49 R:85.7 range: 287 .. 486 A:66 C:43 G:41 T:50 G+C:84 GC%:42 E:49 R:85.7 range: 288 .. 487 A:66 C:43 G:40 T:51 G+C:83 GC%:41 E:49 R:84.7 range: 289 .. 488 A:66 C:43 G:41 T:50 G+C:84 GC%:42 E:49 R:85.7 range: 290 .. 489 A:66 C:43 G:41 T:50 G+C:84 GC%:42 E:49 R:85.7 range: 291 .. 490 A:67 C:42 G:41 T:50 G+C:83 GC%:41 E:49 R:84.7 range: 292 .. 491 A:68 C:42 G:41 T:49 G+C:83 GC%:41 E:49 R:84.7 range: 293 .. 492 A:67 C:42 G:42 T:49 G+C:84 GC%:42 E:49 R:85.7 range: 294 .. 493 A:67 C:43 G:41 T:49 G+C:84 GC%:42 E:49 R:85.7 range: 295 .. 494 A:67 C:42 G:41 T:50 G+C:83 GC%:41 E:49 R:84.7 range: 296 .. 495 A:67 C:42 G:42 T:49 G+C:84 GC%:42 E:49 R:85.7 range: 297 .. 496 A:66 C:42 G:42 T:50 G+C:84 GC%:42 E:49 R:85.7 range: 298 .. 497 A:66 C:42 G:42 T:50 G+C:84 GC%:42 E:49 R:85.7 range: 299 .. 498 A:66 C:43 G:41 T:50 G+C:84 GC%:42 E:49 R:85.7 range: 300 .. 499 A:65 C:43 G:41 T:51 G+C:84 GC%:42 E:49 R:85.7 range: 301 .. 500 A:65 C:42 G:42 T:51 G+C:84 GC%:42 E:49 R:85.7 range: 302 .. 501 A:64 C:42 G:42 T:52 G+C:84 GC%:42 E:49 R:85.7 range: 303 .. 502 A:63 C:42 G:43 T:52 G+C:85 GC%:42 E:49 R:86.7 range: 304 .. 503 A:63 C:42 G:43 T:52 G+C:85 GC%:42 E:49 R:86.7 range: 305 .. 504 A:63 C:43 G:43 T:51 G+C:86 GC%:43 E:49 R:87.8 range: 306 .. 505 A:63 C:43 G:43 T:51 G+C:86 GC%:43 E:49 R:87.8 range: 307 .. 506 A:63 C:44 G:42 T:51 G+C:86 GC%:43 E:49 R:87.8 range: 308 .. 507 A:63 C:43 G:43 T:51 G+C:86 GC%:43 E:49 R:87.8 range: 309 .. 508 A:62 C:43 G:43 T:52 G+C:86 GC%:43 E:49 R:87.8 range: 310 .. 509 A:61 C:43 G:43 T:53 G+C:86 GC%:43 E:49 R:87.8 range: 311 .. 510 A:61 C:43 G:44 T:52 G+C:87 GC%:43 E:49 R:88.8 range: 312 .. 511 A:62 C:43 G:43 T:52 G+C:86 GC%:43 E:49 R:87.8 range: 313 .. 512 A:62 C:44 G:43 T:51 G+C:87 GC%:43 E:49 R:88.8 range: 314 .. 513 A:62 C:44 G:43 T:51 G+C:87 GC%:43 E:49 R:88.8 range: 315 .. 514 A:63 C:44 G:43 T:50 G+C:87 GC%:43 E:49 R:88.8 range: 316 .. 515 A:63 C:44 G:43 T:50 G+C:87 GC%:43 E:49 R:88.8 range: 317 .. 516 A:63 C:44 G:43 T:50 G+C:87 GC%:43 E:49 R:88.8 range: 318 .. 517 A:62 C:45 G:43 T:50 G+C:88 GC%:44 E:49 R:89.8 range: 319 .. 518 A:63 C:45 G:43 T:49 G+C:88 GC%:44 E:49 R:89.8 range: 320 .. 519 A:64 C:44 G:43 T:49 G+C:87 GC%:43 E:49 R:88.8 range: 321 .. 520 A:64 C:43 G:43 T:50 G+C:86 GC%:43 E:49 R:87.8 range: 322 .. 521 A:64 C:43 G:43 T:50 G+C:86 GC%:43 E:49 R:87.8 range: 323 .. 522 A:64 C:43 G:43 T:50 G+C:86 GC%:43 E:49 R:87.8 range: 324 .. 523 A:64 C:43 G:43 T:50 G+C:86 GC%:43 E:49 R:87.8 range: 325 .. 524 A:64 C:43 G:42 T:51 G+C:85 GC%:42 E:49 R:86.7 range: 326 .. 525 A:64 C:42 G:42 T:52 G+C:84 GC%:42 E:49 R:85.7 range: 327 .. 526 A:65 C:42 G:41 T:52 G+C:83 GC%:41 E:49 R:84.7 range: 328 .. 527 A:64 C:43 G:41 T:52 G+C:84 GC%:42 E:49 R:85.7 range: 329 .. 528 A:65 C:43 G:41 T:51 G+C:84 GC%:42 E:49 R:85.7 range: 330 .. 529 A:65 C:43 G:41 T:51 G+C:84 GC%:42 E:49 R:85.7 range: 331 .. 530 A:65 C:43 G:40 T:52 G+C:83 GC%:41 E:49 R:84.7 range: 332 .. 531 A:66 C:42 G:40 T:52 G+C:82 GC%:41 E:49 R:83.7 range: 333 .. 532 A:66 C:43 G:39 T:52 G+C:82 GC%:41 E:49 R:83.7 range: 334 .. 533 A:67 C:43 G:38 T:52 G+C:81 GC%:40 E:49 R:82.7 range: 335 .. 534 A:66 C:43 G:38 T:53 G+C:81 GC%:40 E:49 R:82.7 range: 602 .. 801 A:63 C:40 G:41 T:56 G+C:81 GC%:40 E:49 R:82.7 range: 654 .. 853 A:67 C:39 G:42 T:52 G+C:81 GC%:40 E:49 R:82.7 range: 655 .. 854 A:68 C:39 G:42 T:51 G+C:81 GC%:40 E:49 R:82.7 range: 656 .. 855 A:68 C:39 G:42 T:51 G+C:81 GC%:40 E:49 R:82.7 range: 657 .. 856 A:67 C:40 G:42 T:51 G+C:82 GC%:41 E:49 R:83.7 range: 658 .. 857 A:68 C:40 G:41 T:51 G+C:81 GC%:40 E:49 R:82.7 range: 659 .. 858 A:67 C:40 G:42 T:51 G+C:82 GC%:41 E:49 R:83.7 range: 660 .. 859 A:67 C:40 G:42 T:51 G+C:82 GC%:41 E:49 R:83.7 range: 661 .. 860 A:67 C:39 G:43 T:51 G+C:82 GC%:41 E:49 R:83.7 range: 662 .. 861 A:67 C:39 G:42 T:52 G+C:81 GC%:40 E:49 R:82.7 range: 663 .. 862 A:67 C:39 G:42 T:52 G+C:81 GC%:40 E:49 R:82.7 range: 664 .. 863 A:68 C:39 G:42 T:51 G+C:81 GC%:40 E:49 R:82.7 range: 762 .. 961 A:61 C:36 G:45 T:58 G+C:81 GC%:40 E:49 R:82.7 range: 763 .. 962 A:61 C:35 G:46 T:58 G+C:81 GC%:40 E:49 R:82.7 range: 764 .. 963 A:60 C:36 G:46 T:58 G+C:82 GC%:41 E:49 R:83.7 range: 765 .. 964 A:59 C:36 G:46 T:59 G+C:82 GC%:41 E:49 R:83.7 range: 766 .. 965 A:58 C:37 G:46 T:59 G+C:83 GC%:41 E:49 R:84.7 range: 767 .. 966 A:58 C:37 G:46 T:59 G+C:83 GC%:41 E:49 R:84.7 range: 768 .. 967 A:59 C:37 G:46 T:58 G+C:83 GC%:41 E:49 R:84.7 range: 769 .. 968 A:60 C:37 G:46 T:57 G+C:83 GC%:41 E:49 R:84.7 range: 770 .. 969 A:61 C:37 G:46 T:56 G+C:83 GC%:41 E:49 R:84.7 range: 771 .. 970 A:61 C:37 G:46 T:56 G+C:83 GC%:41 E:49 R:84.7 range: 772 .. 971 A:61 C:37 G:46 T:56 G+C:83 GC%:41 E:49 R:84.7 range: 773 .. 972 A:61 C:36 G:46 T:57 G+C:82 GC%:41 E:49 R:83.7 range: 774 .. 973 A:62 C:36 G:46 T:56 G+C:82 GC%:41 E:49 R:83.7 range: 775 .. 974 A:61 C:36 G:46 T:57 G+C:82 GC%:41 E:49 R:83.7 range: 776 .. 975 A:60 C:36 G:46 T:58 G+C:82 GC%:41 E:49 R:83.7 range: 777 .. 976 A:59 C:36 G:46 T:59 G+C:82 GC%:41 E:49 R:83.7 range: 778 .. 977 A:59 C:35 G:46 T:60 G+C:81 GC%:40 E:49 R:82.7 range: 779 .. 978 A:59 C:36 G:46 T:59 G+C:82 GC%:41 E:49 R:83.7 range: 780 .. 979 A:59 C:36 G:46 T:59 G+C:82 GC%:41 E:49 R:83.7

        This code prints only those regions that have GC% more than 40%. i want to count GC only when there is G and C present together as GC or as CG, and not when G and C present randomly as CAGTGATC. After this i have to calculate GC%. Secondly i have to take my input from file, not to copy my input data in the script. Please help me to solve this.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2014-09-21 10:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (168 votes), past polls