Substantial progress on the Perl model of USS evolution.
First the undergrad and I added the code that tallies up the scores of every sliding-window position in the genome. It didn't take us long to get it running (a few stray semicolons, etc.) However after now Keith's comment on yesterday's post I think there are more efficient ways to do what we've done.
Then we created code that does the recombination a completely different way, so each of the fragments being tested has its own chance to recombine (probability of recombination depends on its score). The code wasn't tricky, but getting it running took ages of tracking down stray curly brackets and discovering that I can't nest two 'while' loops (I changed one of them to an internal 'if' test).
I still need to add in the feature I came up with yesterday, that writes out the genome sequence and the tally of scores only at specified intervals, but now I have to dash off to a 'visioning education' meeting imposed on us by the administration.
- Home
- Angry by Choice
- Catalogue of Organisms
- Chinleana
- Doc Madhattan
- Games with Words
- Genomics, Medicine, and Pseudoscience
- History of Geology
- Moss Plants and More
- Pleiotropy
- Plektix
- RRResearch
- Skeptic Wonder
- The Culture of Chemistry
- The Curious Wavefunction
- The Phytophactor
- The View from a Microbiologist
- Variety of Life
Field of Science
-
-
-
Political pollsters are pretending they know what's happening. They don't.5 weeks ago in Genomics, Medicine, and Pseudoscience
-
-
Course Corrections6 months ago in Angry by Choice
-
-
The Site is Dead, Long Live the Site2 years ago in Catalogue of Organisms
-
The Site is Dead, Long Live the Site2 years ago in Variety of Life
-
Does mathematics carry human biases?4 years ago in PLEKTIX
-
-
-
-
A New Placodont from the Late Triassic of China5 years ago in Chinleana
-
Posted: July 22, 2018 at 03:03PM6 years ago in Field Notes
-
Bryophyte Herbarium Survey7 years ago in Moss Plants and More
-
Harnessing innate immunity to cure HIV8 years ago in Rule of 6ix
-
WE MOVED!8 years ago in Games with Words
-
-
-
-
post doc job opportunity on ribosome biochemistry!9 years ago in Protein Evolution and Other Musings
-
Growing the kidney: re-blogged from Science Bitez9 years ago in The View from a Microbiologist
-
Blogging Microbes- Communicating Microbiology to Netizens10 years ago in Memoirs of a Defective Brain
-
-
-
The Lure of the Obscure? Guest Post by Frank Stahl12 years ago in Sex, Genes & Evolution
-
-
Lab Rat Moving House13 years ago in Life of a Lab Rat
-
Goodbye FoS, thanks for all the laughs13 years ago in Disease Prone
-
-
Slideshow of NASA's Stardust-NExT Mission Comet Tempel 1 Flyby13 years ago in The Large Picture Blog
-
in The Biology Files
Not your typical science blog, but an 'open science' research blog. Watch me fumbling my way towards understanding how and why bacteria take up DNA, and getting distracted by other cool questions.
2 comments:
Markup Key:
- <b>bold</b> = bold
- <i>italic</i> = italic
- <a href="http://www.fieldofscience.com/">FoS</a> = FoS
Subscribe to:
Post Comments (Atom)
It's hard to diagnose the code without seeing it but in principle, nothing prevents nested while() loops. A couple of common "gotchas":
ReplyDelete1. Infinite loops. This often happens when using while() to find a regex and forgetting the 'g' switch. For example to find all occurences of 'ATCG' in string $seq:
while($seq =~/ATCG/g)
This would run forever if you forgot the 'g'.
2. As soon as one while() test is no longer true, the loop will exit to the next (one higher) level of the nest. If the first while() test in the nest is not true, none of the inner while() loops will run. In other words, it's good to know what you expect from each while() test.
On the curly brackets problem: it really helps if you use an editor that highlights and validates Perl (or any other language). For example there's an emacs perl mode: if you position the cursor next to a bracket, it will highlight that bracket and its partner. I'm sure there are many Mac editors with the same function.
When writing loops it's good to type all of the opening + closing brackets when you start, before the loop contents. Also align matching opening/closing pairs so as they are below each other in the same column - makes it easier to see which belong with which.
Yes, Neil's right; nested while loops are allowed in Perl, but typos, pastos, or thinkos can break any code.
ReplyDeleteShort (valid) sample:
---
#!/usr/bin/perl -w
use strict;
my $a=0;
while ($a<15) {
$a++;
print "Outer a: $a\n";
while ($a<10) {
$a++;
print "Inner a: $a\n";
}
}