Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [16:54:37] <mat747> i still have lab to do too, had been waiting for results
- [16:54:40] <jnicol> I'm going on a trip till next Wednesday, so I should do some labs now :)
- [16:54:56] <Eli-Fisker> :)
- [16:55:02] <jnicol> I asked Nando if he could take over for next weeks class
- [16:55:03] <mat747> eli - hehe
- [16:55:11] <Eli-Fisker> Mat :)
- [16:55:25] <Eli-Fisker> That would be cool too
- [16:55:29] <jnicol> Curious to see what he comes up with
- [16:55:48] <Eli-Fisker> hehe, yep. Molecules break apart around him
- [16:56:12] <Eli-Fisker> I mean, he always digs out weird stuff in Chimera and other tools
- [16:56:39] <firedrake969> Hi
- [16:57:05] <Eli-Fisker> hi Fire
- [16:57:39] <jnicol> hi fire
- [16:57:43] <mat747> Hi Fire
- [16:58:23] <firedrake969> anyone think they can pinpoint a computer issue I just had :L
- [16:58:49] <firedrake969> Someone used my computer, and they closed the lid. I think the computer restarted or something, because when I opened it back up, it was a black screen.
- [16:58:53] <firedrake969> It was on, though.
- [16:59:01] <firedrake969> I restarted it, and it said that Windows failed to start.
- [16:59:09] <firedrake969> I just continued with booting.
- [16:59:33] <firedrake969> And now, it says Windows successfully installed updates.
- [16:59:40] <firedrake969> I think the update broke my computer ;_;
- [16:59:56] <jnicol> windows update broke my computer yesterday :(
- [17:00:30] <jnicol> Hi everyone, Welcome to EteRNA Class Time!
- [17:00:36] <firedrake969> I postponed my update as long as I could.
- [17:00:42] <machinelves> yay! thank you jnicol!
- [17:00:45] <Eli-Fisker> Thx John!
- [17:00:45] <jnicol> If you missed the first class last week, don't worry, it is not required to be able to follow along now.
- [17:00:47] <firedrake969> So technically I should've updated around a week ago.
- [17:00:48] <firedrake969> Sweet.
- [17:01:04] <jnicol> In this class, I would like to continue with the objective of generating an Energy Chart.
- [17:01:16] <jnicol> We are focusing on generating the tetraloop energies, but we would like this code to be useful for generating energies of internal loops also.
- [17:01:32] <jnicol> Lets start by opening the scripting interface, http://eterna.cmu.edu/web/script/create/
- [17:01:49] <jnicol> and copy the following code into it:
- [17:01:50] <jnicol> var nextbase = getNextBase("A");
- [17:01:51] <jnicol> outln(nextbase);
- [17:01:51] <jnicol> function getNextBase(b) {
- [17:01:51] <jnicol> if (b == "A") return "U";
- [17:01:51] <jnicol> if (b == "U") return "G";
- [17:01:51] <jnicol> if (b == "G") return "C";
- [17:01:51] <jnicol> return "A";
- [17:01:52] <jnicol> }
- [17:01:52] <jnicol> return true;
- [17:02:06] <firedrake969> jnicol, how do you do that type of chat?
- [17:02:20] <firedrake969> (i.e. outside of the space between your name and the timestamp)
- [17:02:22] <jnicol> I copy into mIrc
- [17:02:27] <firedrake969> What?
- [17:02:39] <jnicol> irc chat program, mIRC
- [17:02:53] <jnicol> We see that the function getNextBase will return a U if we pass in an A
- [17:03:07] <jnicol> return a G when a U is passed in, return a C when a G is passed, return an A when a C is passed in
- [17:03:31] <firedrake969> So mIRC can connect to here?
- [17:03:31] <jnicol> Did everyone run the program?
- [17:03:40] <firedrake969> yeah
- [17:03:42] <hoglahoo> I ran it
- [17:03:47] <jnicol> yup, hog and nando use mirc also
- [17:03:47] <machinelves> yes
- [17:03:51] <Eli-Fisker> yes
- [17:03:56] <jnicol> so using 1 line to call a function is preferred over writing the 4 lines everywhere we want to get the next base.
- [17:04:01] <mat747> yes
- [17:04:13] <jnicol> This function will help us to get every combination of the tetraloop unpaired bases.
- [17:04:24] <hoglahoo> in the last script, we did run 4 lines didn't we
- [17:04:48] <jnicol> yes, I didnt want to try functions in the previous class
- [17:05:05] <jnicol> bringing everyone along slowly :)
- [17:05:14] <hoglahoo> yes please :)
- [17:05:18] <machinelves> *salutes the captain*
- [17:05:23] <firedrake969> Can we go over each line again, like last week?
- [17:05:35] <jnicol> Hope you still feel that way after this class :)
- [17:05:39] <jnicol> Lets introduce another function, getNextSequence, which uses getNextBase, and will generate the sequences we want to find the energies of.
- [17:05:43] <hoglahoo> if I fall behind I will cheat off machinelves
- [17:05:49] <firedrake969> lol
- [17:06:03] <Eli-Fisker> ;)
- [17:06:10] <jnicol> delete all previous code and copy the following lines into the scripting window:
- [17:06:13] <jnicol> locks = "xxxxxxoxxx";
- [17:06:13] <jnicol> sequence = "GCGAAAACGC";
- [17:06:13] <jnicol> outln(sequence);
- [17:06:13] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:06:13] <jnicol> outln(sequence);
- [17:06:13] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:06:13] <jnicol> outln(sequence);
- [17:06:13] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:06:13] <jnicol> outln(sequence);
- [17:06:14] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:06:15] <jnicol> outln(sequence);
- [17:06:16] <jnicol> function getNextSequence(sq, lk) {
- [17:06:16] <jnicol> i = lk.length;
- [17:06:17] <jnicol> while (--i > 0) {
- [17:06:18] <jnicol> if (lk.substr(i,1) == "o") {
- [17:06:18] <jnicol> base = sq.substr(i,1);
- [17:06:19] <jnicol> sq = sq.substr(0,i) + getNextBase(base)
- [17:06:20] <jnicol> + sq.substr(i+1,sq.length-i);
- [17:06:21] <jnicol> if (base != "C") { return sq; }
- [17:06:24] <jnicol> }
- [17:06:24] <jnicol> }
- [17:06:25] <jnicol> return "done";
- [17:06:26] <jnicol> }
- [17:06:26] <jnicol> function getNextBase(b) {
- [17:06:29] <jnicol> if (b == "A") return "U";
- [17:06:29] <jnicol> if (b == "U") return "G";
- [17:06:29] <jnicol> if (b == "G") return "C";
- [17:06:31] <jnicol> return "A";
- [17:06:31] <jnicol> }
- [17:06:33] <jnicol> return true;
- [17:06:47] <jnicol> THat took a while :)
- [17:06:52] <firedrake969> Ok, please walk through code? :3
- [17:06:59] <jnicol> Now this may look complex, but stay with me and I promise we can get through this :)
- [17:07:02] <firedrake969> Oh, sweet, I get it.
- [17:07:14] <hoglahoo> can someone post the link to the big chat window please
- [17:07:15] <jnicol> First, it is best to understand what this code is doing, so click Evaluate and take a look at the result.
- [17:07:26] <jnicol> http://eterna.cmu.edu/web/chat/
- [17:07:40] <hoglahoo> ty
- [17:07:53] <jnicol> were you able to grab the code?
- [17:07:54] <hoglahoo> meh.
- [17:07:58] <firedrake969> What does locks do?
- [17:08:06] <jnicol> Notice that every time getNextSequence is called, base #7 is 'incremented' to the next valid base.
- [17:08:20] <jnicol> The while loop is looking at every character in 'locks' (lines 15 and 16), starting at the last character of the string and moving toward the first character.
- [17:08:49] <jnicol> This is because I want to display the changing sequence as
- [17:08:51] <jnicol> AAAA
- [17:08:52] <jnicol> AAAU
- [17:08:52] <jnicol> AAAG
- [17:08:52] <jnicol> AAAC
- [17:08:52] <jnicol> AAUA
- [17:08:52] <jnicol> ...
- [17:09:37] <jnicol> Locks is like the structure, but it identifies the bases that we want to change
- [17:09:54] <jnicol> so we see base 7 is unlocked
- [17:10:04] <firedrake969> Ok, thanks
- [17:10:08] <firedrake969> And they can be any characters, right?
- [17:10:21] <Eli-Fisker> yes
- [17:10:22] <jnicol> which means we keep all other bases as is and only change base 7
- [17:10:24] <firedrake969> Ok
- [17:10:47] <Eli-Fisker> http://prntscr.com/2s8r5t
- [17:10:55] <jnicol> well, the gatNextBase, assumes A is the first base being used
- [17:11:10] <jnicol> thanks eli :)
- [17:11:15] <Eli-Fisker> np :)
- [17:11:23] <steven123505> hai
- [17:11:35] <jnicol> hai steven
- [17:11:35] <machinelves> hey! welcome to class! :)
- [17:11:36] <Eli-Fisker> hi Steven. John is giving a script lecture
- [17:11:46] <steven123505> hi john :D
- [17:11:49] <jnicol> When 'locks' has an 'o', we want to change that base (lines 16 and 17).
- [17:12:04] <jnicol> A new sequence using that changed base is saved (lines 18 and 19).
- [17:12:06] <Eli-Fisker> o= open?
- [17:12:25] <firedrake969> HI steven
- 03[17:12:25] * hoglahoo sets mode: +o Brourd
- [17:12:38] <firedrake969> What does the "sq.substr()" do?
- [17:12:47] <jnicol> yes, that is actually the same way eterna uses it when we lock bases in a puzzle
- [17:12:59] <jewfrosamurai42> hey guys, i wish i was adenine so i could be with u tomorrow
- [17:13:00] <Eli-Fisker> cool, John
- [17:13:04] <machinelves> ahh cool
- [17:13:30] <jnicol> substr() is taking 1 character at base 7
- [17:14:13] <firedrake969> Base 7 of the sq?
- [17:14:16] <jnicol> whenever you have a question about what the code is doing
- [17:14:31] <jnicol> you can put in an outln statement to see
- [17:14:43] <jnicol> like outln(sq.substr(i,1));
- [17:14:53] <jnicol> right after that line
- [17:14:57] <jnicol> in the code
- [17:15:12] <Eli-Fisker> That is handy
- [17:15:20] <jnicol> sq is a shortened name for sequence
- [17:15:49] <firedrake969> Yeah
- [17:15:59] <firedrake969> Ok, what I meant is the [obj].substr();
- [17:16:01] <jnicol> I unlocked 1 base to make the output result easy to see for now
- [17:16:03] <firedrake969> It takes it from the [obj] part.
- [17:16:18] <jnicol> correct fire
- [17:16:46] <jnicol> eventually we will unlock 4 bases to check all tetraloop combinations
- [17:17:00] <firedrake969> Ok, thanks, jnicol
- [17:17:08] <machinelves> sooper cool!
- [17:17:56] <jnicol> do my line numbers match up? I think I had a blank line in my original code
- [17:18:20] <jnicol> but when i copied it I doont see any blank lines
- [17:18:27] <firedrake969> Line numbers?
- [17:18:28] <machinelves> i did not get a blank line
- [17:19:04] <Eli-Fisker> http://prntscr.com/2s8u1i
- [17:19:08] <Eli-Fisker> This is what I got
- [17:19:12] <jnicol> is lines 16 and 17
- [17:19:15] <jnicol> while (--i > 0) {
- [17:19:16] <jnicol> if (lk.substr(i,1) == "o") {
- [17:19:31] <hoglahoo> mine agrees with Eli
- [17:19:33] <Eli-Fisker> no
- [17:19:38] <machinelves> 14 & 15 for me
- [17:19:48] <Eli-Fisker> Same as Machine
- [17:19:52] <jnicol> so sorry, I may be off a line or two when I reference line numbers'
- [17:19:57] <firedrake969> That's 13 and 14 for me
- [17:20:14] <firedrake969> but I'm editting the code right now to test somethign
- [17:20:19] <Eli-Fisker> np
- [17:20:20] <firedrake969> something*
- [17:20:26] <jnicol> well hopefullyh it is not too confusing :(
- [17:20:39] <firedrake969> jnicol
- [17:20:49] <firedrake969> Question.... why isn't this bit of code working?
- [17:20:52] <firedrake969> i = 0;while (i < 4){ sequence = getNextSequence(sequence, locks); outln(sequence); i++}
- [17:21:03] <firedrake969> Hopefully it's not too badly messed up
- [17:21:24] <machinelves> fyi eterna plugin just crashed for me so i lost transcript. someone recording may want to backup now
- [17:21:36] <jnicol> try it on separate lines
- [17:21:38] <Eli-Fisker> Thx for the warning machine
- [17:21:42] <firedrake969> Ok
- [17:21:45] <machinelves> np :)
- [17:21:53] <firedrake969> I'm getting the transcript
- [17:21:56] <firedrake969> but via /web/chat
- [17:22:02] <firedrake969> i = 0;
- [17:22:06] <firedrake969> while (i < 4){
- [17:22:09] <firedrake969> sequence = getNextSequence(sequence, locks);
- [17:22:10] <machinelves> ahh may i please have code repost
- [17:22:14] <firedrake969> outln(sequence);
- [17:22:20] <firedrake969> i++
- [17:22:24] <firedrake969> }
- [17:22:29] <firedrake969> @jnicol that's what i have
- [17:22:38] <jnicol> if you add a blank line before each function, our line numbers should match
- [17:22:46] <hoglahoo> doesn't i++ need a ;
- [17:23:01] <jnicol> yes it does hog, good eye
- [17:23:11] <DARKvLIGHT> you guys talking C++
- [17:23:17] <jnicol> javascript
- [17:23:24] <firedrake969> oh yeah thanks hog
- [17:23:38] <firedrake969> Still doesn't work?
- [17:24:15] <jnicol> A new sequence using that changed base is saved (lines 18 and 19).
- [17:24:16] <hoglahoo> machinelves do you still need the code
- 03[17:24:20] * Looking up machinelves__25772904525315 user info...
- [17:24:22] <machinelves> yes please!
- 03[17:24:24] * Looking up machinelves__25774297055846 user info...
- [17:24:37] <machinelves> thank you! & sorry :)
- [17:24:38] <hoglahoo> I hope that works...
- [17:24:45] <jnicol> i got it hog
- [17:24:47] <hoglahoo> oh ok
- [17:24:50] <jnicol> locks = "xxxxxxoxxx";
- [17:24:50] <jnicol> sequence = "GCGAAAACGC";
- [17:24:50] <jnicol> outln(sequence);
- [17:24:50] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:24:50] <jnicol> outln(sequence);
- [17:24:50] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:24:50] <jnicol> outln(sequence);
- [17:24:50] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:24:50] <jnicol> outln(sequence);
- [17:24:50] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:24:51] <jnicol> outln(sequence);
- [17:24:51] <jnicol> function getNextSequence(sq, lk) {
- [17:24:52] <jnicol> i = lk.length;
- [17:24:55] <hoglahoo> now she got it twice
- [17:24:55] <jnicol> while (--i > 0) {
- [17:24:55] <jnicol> if (lk.substr(i,1) == "o") {
- [17:24:56] <jnicol> base = sq.substr(i,1);
- [17:24:57] <jnicol> sq = sq.substr(0,i) + getNextBase(base)
- [17:24:58] <jnicol> + sq.substr(i+1,sq.length-i);
- [17:24:59] <jnicol> if (base != "C") { return sq; }
- [17:24:59] <jnicol> }
- [17:25:00] <jnicol> }
- [17:25:03] <jnicol> return "done";
- [17:25:03] <jnicol> }
- [17:25:04] <jnicol> function getNextBase(b) {
- [17:25:05] <jnicol> if (b == "A") return "U";
- [17:25:05] <jnicol> if (b == "U") return "G";
- [17:25:07] <jnicol> if (b == "G") return "C";
- [17:25:07] <jnicol> return "A";
- [17:25:08] <jnicol> }
- [17:25:11] <jnicol> return true;
- [17:25:42] <jnicol> lets try again, I will post in pieces
- [17:25:56] <jnicol> aftfer each piece add a blank line
- [17:26:03] <jnicol> locks = "xxxxxxoxxx";
- [17:26:03] <jnicol> sequence = "GCGAAAACGC";
- [17:26:03] <jnicol> outln(sequence);
- [17:26:03] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:26:03] <jnicol> outln(sequence);
- [17:26:04] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:26:04] <jnicol> outln(sequence);
- [17:26:04] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:26:04] <jnicol> outln(sequence);
- [17:26:04] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:26:04] <machinelves> i got it
- [17:26:04] <jnicol> outln(sequence);
- [17:26:14] <machinelves> thanks!
- [17:26:29] <jnicol> function getNextSequence(sq, lk) {
- [17:26:29] <jnicol> i = lk.length;
- [17:26:29] <jnicol> while (--i > 0) {
- [17:26:29] <jnicol> if (lk.substr(i,1) == "o") {
- [17:26:29] <jnicol> base = sq.substr(i,1);
- [17:26:29] <jnicol> sq = sq.substr(0,i) + getNextBase(base)
- [17:26:29] <jnicol> + sq.substr(i+1,sq.length-i);
- [17:26:29] <jnicol> if (base != "C") { return sq; }
- [17:26:29] <jnicol> }
- [17:26:29] <jnicol> }
- [17:26:30] <jnicol> return "done";
- [17:26:30] <jnicol> }
- [17:26:41] <jnicol> function getNextBase(b) {
- [17:26:41] <jnicol> if (b == "A") return "U";
- [17:26:41] <jnicol> if (b == "U") return "G";
- [17:26:41] <jnicol> if (b == "G") return "C";
- [17:26:41] <jnicol> return "A";
- [17:26:41] <jnicol> }
- [17:27:03] <jnicol> I need to get better with that :)
- [17:27:05] <hoglahoo> is that 3 blank lines at 12, 25, and 32 if done correctly?
- [17:27:16] <jnicol> correct
- [17:27:31] <hoglahoo> might try a comment instead of a blank line for pasting here
- [17:27:42] <firedrake969> jnicol, what about my faulty while loop?
- [17:27:42] <hoglahoo> actually no... hmm
- [17:28:01] <jnicol> idk fire, we can look at it after this class
- [17:28:33] <jnicol> reposted last statement
- [17:28:35] <jnicol> A new sequence using that changed base is saved (lines 18 and 19).
- [17:28:39] <firedrake969> Ok
- [17:28:50] <jnicol> When that base is not a C, then we have found the next sequence and can return (line 20).
- [17:29:01] <jnicol> When that base is a C, then we want to change it back to an A, and check to see if there is a lower base number that needs to be changed, which is done by checking the next base in the while loop.
- [17:29:10] <jnicol> When all the bases to be changed are set to C, then we are finished with all the sequences and can return "done" (line 23)
- [17:29:47] <jnicol> do line numbers sync now?
- [17:29:55] <machinelves> yes
- [17:30:00] <jnicol> good
- [17:30:13] <firedrake969> Yup
- [17:30:34] <Eli-Fisker> Yes
- [17:30:36] <jnicol> I'm going to try hogs suggestion of adding a comment for blank lines
- [17:30:45] <hoglahoo> I don't think the chat will like / though
- [17:30:51] <hoglahoo> mirc reserves it for commands
- [17:31:15] <Eli-Fisker> What I got now, if anyone is in doubt
- [17:31:16] <Eli-Fisker> http://prntscr.com/2s8y3f
- [17:31:41] <jnicol> any questions on the previous code?
- [17:31:48] <jnicol> is it sasfe to move forward?
- [17:31:54] <firedrake969> Yeah
- [17:32:06] <machinelves> ready
- [17:32:25] <jnicol> Now lets use 2 unlocked bases and watch what happens as the sequence runs through all the possible combinations.
- [17:32:26] <firedrake969> wait, one thing
- [17:32:41] <firedrake969> How do you create a new variable?
- [17:32:41] <jnicol> ok fire
- [17:32:57] <TomoeUzumaki> aah is today the class?
- [17:33:02] <jnicol> you can just use it
- [17:33:12] <Eli-Fisker> Tomoe, yep
- [17:33:12] <machinelves> yes tomoe, hi!
- [17:33:14] <firedrake969> Use it?
- [17:33:16] <jnicol> or formally, you should prefix it with var
- [17:33:20] <TomoeUzumaki> oops
- [17:33:21] <firedrake969> I've tried something with j but it doesn't work
- [17:33:27] <TomoeUzumaki> well, I was studying for an exam
- [17:33:38] <firedrake969> nvm, it works :3
- [17:33:43] <jnicol> for instance just put "myEnergy = 0;"
- [17:33:50] <jnicol> good
- [17:34:14] <jnicol> delete all previous code and copy the following lines into the scripting window:
- [17:34:16] <firedrake969> :D
- [17:34:17] <jnicol> locks = "xxxxxooxxx";
- [17:34:17] <jnicol> sequence = "GCGAAAACGC";
- [17:34:17] <jnicol> while (sequence != "done") {
- [17:34:17] <jnicol> outln(sequence);
- [17:34:17] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:34:17] <jnicol> }
- [17:34:18] <jnicol> function getNextSequence(sq, lk) {
- [17:34:18] <jnicol> i = lk.length;
- [17:34:18] <jnicol> while (--i > 0) {
- [17:34:18] <jnicol> if (lk.substr(i,1) == "o") {
- [17:34:19] <jnicol> base = sq.substr(i,1);
- [17:34:20] <jnicol> sq = sq.substr(0,i) + getNextBase(base)
- [17:34:20] <jnicol> + sq.substr(i+1,sq.length-i);
- [17:34:21] <jnicol> if (base != "C") { return sq; }
- [17:34:22] <jnicol> }
- [17:34:23] <jnicol> }
- [17:34:24] <jnicol> return "done";
- [17:34:25] <jnicol> }
- [17:34:26] <jnicol> function getNextBase(b) {
- [17:34:27] <jnicol> if (b == "A") return "U";
- [17:34:27] <jnicol> if (b == "U") return "G";
- [17:34:29] <jnicol> if (b == "G") return "C";
- [17:34:29] <firedrake969> or I could've done that :P
- [17:34:30] <jnicol> return "A";
- [17:34:31] <jnicol> }
- [17:34:32] <jnicol> return true;
- [17:34:37] <firedrake969> oops
- [17:34:40] <firedrake969> Disrupted it, sorry
- [17:34:50] <jnicol> :) didnt take the blank line comments
- [17:35:11] <Eli-Fisker> :)
- [17:35:12] <hoglahoo> right, there's an escape for it but will have to google :)
- [17:35:26] <machinelves> blank line numbers please?
- [17:35:27] <firedrake969> What i get: GCGAAAACGCGCGAAAUCGCGCGAAAGCGCGCGAAACCGCGCGAAUACGCGCGAAUUCGCGCGAAUGCGCGCGAAUCCGCGCGAAGACGCGCGAAGUCGCGCGAAGGCGCGCGAAGCCGCGCGAACACGCGCGAACUCGCGCGAACGCGCGCGAACCCGC
- [17:35:30] <TomoeUzumaki> guys, I emailed someone and asked him to call me
- [17:35:32] <firedrake969> with spaces in between...
- [17:35:37] <TomoeUzumaki> but I forgot to give him my number.
- [17:35:47] <jnicol> let me try to post it again
- [17:35:54] <jnicol> locks = "xxxxxooxxx";
- [17:35:54] <jnicol> sequence = "GCGAAAACGC";
- [17:35:54] <jnicol> out("");
- [17:35:54] <jnicol> while (sequence != "done") {
- [17:35:54] <jnicol> outln(sequence);
- [17:35:54] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:35:54] <jnicol> }
- [17:35:54] <jnicol> out("");
- [17:35:54] <jnicol> function getNextSequence(sq, lk) {
- [17:35:54] <jnicol> i = lk.length;
- [17:35:54] <jnicol> while (--i > 0) {
- [17:35:56] <jnicol> if (lk.substr(i,1) == "o") {
- [17:35:57] <jnicol> base = sq.substr(i,1);
- [17:35:57] <jnicol> sq = sq.substr(0,i) + getNextBase(base)
- [17:35:58] <jnicol> + sq.substr(i+1,sq.length-i);
- [17:36:01] <jnicol> if (base != "C") { return sq; }
- [17:36:02] <jnicol> }
- [17:36:03] <jnicol> }
- [17:36:03] <jnicol> return "done";
- [17:36:05] <jnicol> }
- [17:36:06] <jnicol> out("");
- [17:36:06] <jnicol> function getNextBase(b) {
- [17:36:07] <jnicol> if (b == "A") return "U";
- [17:36:08] <jnicol> if (b == "U") return "G";
- [17:36:09] <jnicol> if (b == "G") return "C";
- [17:36:10] <jnicol> return "A";
- [17:36:11] <jnicol> }
- [17:36:11] <jnicol> out("");
- [17:36:14] <jnicol> return true;
- [17:36:34] <jnicol> the out(""); is where I want the blank lines to be
- [17:36:53] <jnicol> but I think leaving in the out should not hurt anything
- [17:37:04] <hoglahoo> works fine with or without
- [17:37:12] <Eli-Fisker> http://prntscr.com/2s901r
- [17:37:16] <Eli-Fisker> Got it like this
- [17:37:42] <firedrake969> Can someone evaluate it?
- [17:37:46] <firedrake969> I have a really weird result.
- [17:38:12] <mat747> eli - http://prntscr.com/2s90a1
- [17:38:13] <Eli-Fisker> Now there are two bases unlocked
- [17:38:15] <firedrake969> 16 lines
- [17:38:26] <firedrake969> I get the same thing, mat.
- [17:38:30] <Eli-Fisker> I get what Mat has
- [17:38:30] <machinelves> output: http://prntscr.com/2s90et
- [17:38:33] <firedrake969> Ok, thanks
- [17:38:35] <jnicol> what result do you get fire?
- [17:38:36] <firedrake969> That explains it.
- [17:38:38] <firedrake969> Same as them
- [17:38:47] <firedrake969> Just didn't notice the two unlocked bases
- [17:38:55] <Eli-Fisker> This all the variants of two unlocked bases
- [17:39:04] <firedrake969> Yeah
- [17:39:08] <Eli-Fisker> All the possible combos
- [17:39:17] <jnicol> correct 2 unlocked bases :)
- [17:39:33] <jnicol> there will be more :)
- [17:39:44] <jnicol> I also changed the calling of getNextSequence to be in its own loop (line 4)
- [17:40:06] <jnicol> Now I would like to display only the unlocked bases and not the entire sequence
- [17:40:10] <hoglahoo> I didn't realize the evaluation is so slow
- [17:40:27] <firedrake969> So we could return sq.substr
- [17:40:27] <firedrake969> ?
- [17:40:42] <jnicol> did you get a timeout hog?
- [17:40:48] <hoglahoo> no it's good.
- [17:41:08] <jnicol> mine ran in .009 seconds
- [17:41:19] <hoglahoo> I ran all 4
- [17:41:24] <firedrake969> 0.012
- [17:41:47] <Eli-Fisker> Hogla, ah
- [17:42:00] <jnicol> delete all previous code and copy the following lines into the scripting window:
- [17:42:05] <jnicol> locks = "xxxxxooxxx";
- [17:42:05] <jnicol> sequence = "GCGAAAACGC";
- [17:42:05] <jnicol> out("");
- [17:42:05] <jnicol> while (sequence != "done") {
- [17:42:05] <jnicol> displayUnlockedBases(sequence, locks);
- [17:42:05] <jnicol> outln("energy = 0 kcal");
- [17:42:05] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:42:05] <jnicol> }
- [17:42:05] <jnicol> out("");
- [17:42:05] <jnicol> function displayUnlockedBases(sq, lk) {
- [17:42:06] <firedrake969> Oh, yeah
- [17:42:06] <jnicol> for (i=0; i<lk.length; i++) {
- [17:42:07] <jnicol> if (lk.substr(i,1) == "o") {
- [17:42:08] <jnicol> out(sq.substr(i,1));
- [17:42:09] <jnicol> }
- [17:42:10] <jnicol> }
- [17:42:11] <jnicol> out(", ");
- [17:42:12] <jnicol> }
- [17:42:13] <jnicol> out("");
- [17:42:14] <jnicol> function getNextSequence(sq, lk) {
- [17:42:15] <jnicol> i = lk.length;
- [17:42:16] <jnicol> while (--i > 0) {
- [17:42:17] <jnicol> if (lk.substr(i,1) == "o") {
- [17:42:17] <firedrake969> *facepalm* sorry
- [17:42:18] <jnicol> base = sq.substr(i,1);
- [17:42:19] <jnicol> sq = sq.substr(0,i) + getNextBase(base)
- [17:42:19] <jnicol> + sq.substr(i+1,sq.length-i);
- [17:42:21] <jnicol> if (base != "C") { return sq; }
- [17:42:22] <jnicol> }
- [17:42:23] <jnicol> }
- [17:42:24] <jnicol> return "done";
- [17:42:25] <jnicol> }
- [17:42:26] <jnicol> out("");
- [17:42:27] <jnicol> function getNextBase(b) {
- [17:42:28] <jnicol> if (b == "A") return "U";
- [17:42:29] <jnicol> if (b == "U") return "G";
- [17:42:30] <jnicol> if (b == "G") return "C";
- [17:42:30] <jnicol> looks like it got cut
- [17:42:30] <jnicol> return "A";
- [17:42:33] <jnicol> }
- [17:42:33] <jnicol> out("");
- [17:42:34] <jnicol> return true;
- [17:42:49] <jnicol> hello?
- [17:42:59] <hoglahoo> uh oh.
- [17:43:12] <machinelves> cut off at: for (i=0; i
- [17:43:14] <hoglahoo> i< doesn't work
- [17:43:18] <jnicol> did anyone else lose chat?
- [17:43:28] <hoglahoo> the < buggers the chat, john
- [17:43:44] <firedrake969> Chat broke
- [17:43:47] <hoglahoo> eterna is looking for code
- [17:43:56] <firedrake969> chat broke for me, yayz
- [17:44:00] <jnicol> I cant type in chat anymore
- [17:44:07] <firedrake969> chat broke for me
- [17:44:08] <JohnDoe1> Linkbot, activate self destruct code 1A-2B-3.
- [17:44:08] <hoglahoo> refresh the page I guess
- [17:44:10] <firedrake969> ...
- [17:44:24] <firedrake969> chat broke
- [17:44:29] <firedrake969> can anybody see this?
- [17:44:43] <hoglahoo> we need to clear out the 20-line history, then refresh will work
- [17:44:53] <hoglahoo> need about 7 more I think
- [17:44:54] <hoglahoo> 6
- [17:44:54] <hoglahoo> 5
- [17:44:54] <hoglahoo> 4
- [17:44:55] <hoglahoo> 3
- [17:44:56] <hoglahoo> 2
- [17:44:56] <hoglahoo> 1
- [17:45:03] <hoglahoo> test
- [17:45:11] <hoglahoo> test
- [17:45:12] <hoglahoo> tes
- [17:45:13] <hoglahoo> test
- [17:45:14] <firedrake969> If somebody can read this, comment on the latest player puzzle :L
- [17:45:19] <Eli-Fisker> Did chat break?
- [17:45:20] <hoglahoo> there
- [17:45:21] <firedrake969> The chat's completely broken for me
- [17:45:29] <hoglahoo> should be fine now if folks refresh
- [17:45:39] <JohnDoe1> Linkbot, activate self-destruct code: 1A-2B-3
- [17:45:55] <jnicol> I'm back
- [17:46:03] <machinelves> *poof*
- [17:46:13] <jnicol> should we try that again?
- [17:46:19] <machinelves> yes please!
- [17:46:19] <firedrake969> chat fixed
- [17:46:20] <hoglahoo> no
- [17:46:24] <jnicol> in pieces?
- [17:46:25] <firedrake969> yay
- [17:46:29] <hoglahoo> the left arrow needs to be escaped
- [17:46:35] <firedrake969> I had to completely clear all eterna cookies
- [17:46:36] <hoglahoo> less than symbol
- [17:46:44] <hoglahoo> if you paste from client anyway
- [17:47:00] <jnicol> whats the escape key?
- [17:47:21] <firedrake969> Can you rewrite the script?
- [17:47:37] <hoglahoo> one sec <
- [17:47:38] <JohnDoe1> upper left hand corner
- [17:47:47] <jnicol> I can prefix the left arrow
- [17:48:05] <hoglahoo> <
- [17:48:27] <firedrake969> <
- [17:48:28] <firedrake969> ?
- [17:48:38] <JohnDoe1> Unplug and plug back in!
- [17:48:40] <hoglahoo> hopefully John will see it
- [17:49:06] <hoglahoo> come back John :)
- [17:49:10] <hoglahoo> lol
- [17:49:15] <jnicol> hello
- [17:49:25] <firedrake969> Hi
- [17:49:29] <hoglahoo> use the ascii <
- [17:49:35] <JohnDoe1> Who, me?
- [17:49:50] <JohnDoe1> 1011001011010100101101
- [17:49:51] <firedrake969> jnicol
- [17:50:03] <jnicol> I'm replacing the arrows now, hold on
- [17:50:55] <firedrake969> Ok
- [17:52:14] <JohnDoe1> ←↑→↓
- [17:52:36] <machinelves> hey, i have to go, jnicol thank you so much! i look forward to seeing the rest of this class later, and i really like your patient teaching style! hope you all have a good day :)
- [17:52:44] <hoglahoo> machinelves: see you later
- [17:52:55] <Eli-Fisker> Bye Machine, see you
- [17:52:58] <machinelves> bye! :D
- [17:52:59] <jnicol> ok, I'm going to try to copy this again, cross your fingers
- [17:53:03] <firedrake969> Ok
- [17:53:05] <mat747> bye machine
- [17:53:08] <hoglahoo> wait a moment
- [17:53:09] <jnicol> bye machine
- [17:53:11] <firedrake969> ?
- [17:53:19] <hoglahoo> if chat stalls for you folks, just wait about 20 seconds and reload the page
- [17:53:19] <jnicol> waiting
- [17:53:23] <hoglahoo> ok continue :)
- [17:53:33] <JohnDoe1> ↑↑↓↓↔↔BA Enter
- [17:53:40] <jnicol> locks = "xxxxxooxxx";
- [17:53:41] <jnicol> sequence = "GCGAAAACGC";
- [17:53:41] <jnicol> out("");
- [17:53:41] <jnicol> while (sequence != "done") {
- [17:53:41] <jnicol> displayUnlockedBases(sequence, locks);
- [17:53:41] <jnicol> outln("energy = 0 kcal");
- [17:53:41] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:53:41] <jnicol> }
- [17:53:41] <jnicol> out("");
- [17:53:41] <jnicol> function displayUnlockedBases(sq, lk) {
- [17:53:41] <jnicol> for (i=0; i<lk.length; i++) {
- [17:53:42] <jnicol> if (lk.substr(i,1) == "o") {
- [17:53:43] <jnicol> out(sq.substr(i,1));
- [17:53:44] <jnicol> }
- [17:53:45] <jnicol> }
- [17:53:46] <jnicol> out(", ");
- [17:53:46] <jnicol> }
- [17:53:47] <jnicol> out("");
- [17:53:48] <jnicol> function getNextSequence(sq, lk) {
- [17:53:49] <jnicol> i = lk.length;
- [17:53:51] <jnicol> while (--i > 0) {
- [17:53:51] <firedrake969> stalled again
- [17:53:52] <jnicol> if (lk.substr(i,1) == "o") {
- [17:53:52] <jnicol> base = sq.substr(i,1);
- [17:53:55] <jnicol> sq = sq.substr(0,i) + getNextBase(base)
- [17:53:55] <jnicol> + sq.substr(i+1,sq.length-i);
- [17:53:56] <jnicol> if (base != "C") { return sq; }
- [17:53:57] <jnicol> }
- [17:53:57] <jnicol> }
- [17:53:58] <jnicol> return "done";
- [17:53:59] <jnicol> }
- [17:54:01] <hoglahoo> you pasted the arrow again
- [17:54:02] <jnicol> out("");
- [17:54:02] <jnicol> function getNextBase(b) {
- [17:54:03] <jnicol> if (b == "A") return "U";
- [17:54:04] <jnicol> if (b == "U") return "G";
- [17:54:05] <jnicol> if (b == "G") return "C";
- [17:54:05] <jnicol> return "A";
- [17:54:06] <jnicol> }
- [17:54:07] <jnicol> out("");
- [17:54:08] <jnicol> return true;
- [17:55:04] <JohnDoe1> We need Linkbot for this job.
- [17:55:12] <jnicol> hello
- [17:55:19] <Eli-Fisker> hi
- [17:55:26] <firedrake969> back
- [17:55:29] <TomoeUzumaki> hello
- [17:55:59] <jnicol> locks = "xxxxxooxxx";
- [17:56:00] <jnicol> sequence = "GCGAAAACGC";
- [17:56:00] <jnicol> out("");
- [17:56:00] <jnicol> while (sequence != "done") {
- [17:56:00] <jnicol> displayUnlockedBases(sequence, locks);
- [17:56:01] <jnicol> outln("energy = 0 kcal");
- [17:56:01] <jnicol> sequence = getNextSequence(sequence, locks);
- [17:56:01] <jnicol> }
- [17:56:01] <jnicol> out("");
- [17:56:01] <jnicol> function displayUnlockedBases(sq, lk) {
- [17:56:01] <jnicol> for (i=0; i<lk.length; i++) {
- [17:56:01] <jnicol> if (lk.substr(i,1) == "o") {
- [17:56:02] <jnicol> out(sq.substr(i,1));
- [17:56:03] <jnicol> }
- [17:56:03] <jnicol> }
- [17:56:05] <jnicol> out(", ");
- [17:56:06] <jnicol> }
- [17:56:06] <jnicol> out("");
- [17:56:08] <jnicol> function getNextSequence(sq, lk) {
- [17:56:08] <jnicol> i = lk.length;
- [17:56:09] <jnicol> while (--i > 0) {
- [17:56:10] <jnicol> if (lk.substr(i,1) == "o") {
- [17:56:11] <jnicol> base = sq.substr(i,1);
- [17:56:13] <jnicol> sq = sq.substr(0,i) + getNextBase(base)
- [17:56:13] <jnicol> + sq.substr(i+1,sq.length-i);
- [17:56:14] <jnicol> if (base != "C") { return sq; }
- [17:56:17] <jnicol> }
- [17:56:17] <jnicol> }
- [17:56:18] <jnicol> return "done";
- [17:56:18] <jnicol> }
- [17:56:19] <jnicol> out("");
- [17:56:21] <jnicol> function getNextBase(b) {
- [17:56:22] <jnicol> if (b == "A") return "U";
- [17:56:23] <jnicol> if (b == "U") return "G";
- [17:56:24] <jnicol> if (b == "G") return "C";
- [17:56:25] <jnicol> return "A";
- [17:56:26] <jnicol> }
- [17:56:27] <jnicol> out("");
- [17:56:28] <jnicol> return true;
- [17:56:42] <jnicol> wow, that was painful
- [17:56:55] <hoglahoo> yay
- [17:58:04] <jnicol> everyone get that?
- [17:58:04] <Eli-Fisker> http://prntscr.com/2s96l8
- [17:58:08] <Eli-Fisker> Got output
- [17:58:22] <JohnDoe1> while (--i > 0) { if (lk.substr(i,1) == "o") { base = sq.substr(i,1); sq = sq.substr(0,i) + getNextBase(base) + sq.substr(i+1,sq.length-i); if (base != "C") { return sq; } } } return "done"; } out(""); function getNextBase(b) { if (b == "A") return "U"; if (b == "U") return "G"; if (b == "G") return "C"; return "A"; } out(""); return true;
- [17:58:29] <jnicol> thats what you should get eli :)
- [17:58:34] <Eli-Fisker> :)
- [17:58:38] <Eli-Fisker> Two bases
- [17:58:39] <Eli-Fisker> shown
- [17:58:45] <JohnDoe1> :D
- [17:58:52] <Eli-Fisker> In all combos
- [17:59:00] <jnicol> Notice that in displayUnlockedBases, we are checking each base the same way we did in getNextSequence.
- [17:59:12] <jnicol> We now only display a base if it is unlocked (lines 12 and 13)
- [17:59:13] <firedrake969> That was quite painful.
- [17:59:19] <JohnDoe1> What's going on?
- [17:59:26] <jnicol> Also, in line 6, I added a placeholder for where we eventually want to calculate the energy of the sequence.
- [17:59:39] <jnicol> John, javascript class
- [18:00:03] <jnicol> But first, I am a little concerned that the sequence I chose will not fold properly for all the combinations we need to test.
- [18:00:13] <JohnDoe1> WHAT is going on?!
- [18:00:32] <jnicol> this is a class to learn about javascript
- [18:00:42] <jnicol> Fortunately the developers have provided a library function, fold, that will tell us if the sequence folds properly.
- [18:00:45] <JohnDoe1> in the chat?
- [18:00:56] <jnicol> yup
- [18:01:00] <Eli-Fisker> Yes
- [18:01:13] <jnicol> Lib.fold(sequence) takes the sequence as an input and returns the natural fold structure.
- [18:01:23] <jnicol> Then we compare this natural fold to what we want as the target fold, and hopefully they match!
- [18:01:26] <firedrake969> So would we compare it
- [18:01:29] <firedrake969> oh you typed faster :P
- [18:01:41] <jnicol> delete all previous code and copy the following lines into the scripting window:
- [18:01:51] <biggestlegoheroicafanever> Hello people of Planet EteRNA
- [18:01:56] <firedrake969> shh
- [18:02:00] <JohnDoe1> {Ask question }
- [18:02:02] <firedrake969> or it'll freeze again
- [18:02:25] <jnicol> locks = "xxxxxooxxx";
- [18:02:25] <jnicol> sequence = "GCGAAAACGC";
- [18:02:25] <jnicol> structure = "(((....)))";
- [18:02:25] <jnicol> out("");
- [18:02:25] <jnicol> while (sequence != "done") {
- [18:02:25] <jnicol> displayUnlockedBases(sequence, locks);
- [18:02:25] <jnicol> if (Lib.fold(sequence) != structure) {
- [18:02:25] <jnicol> outln("misfold :(");
- [18:02:25] <jnicol> } else {
- [18:02:25] <jnicol> outln("energy = 0 kcal");
- [18:02:25] <jnicol> }
- [18:02:27] <jnicol> sequence = getNextSequence(sequence, locks);
- [18:02:27] <jnicol> }
- [18:02:30] <jnicol> out("");
- [18:02:30] <jnicol> function displayUnlockedBases(sq, lk) {
- [18:02:31] <jnicol> for (i=0; i<lk.length; i++) {
- [18:02:32] <jnicol> if (lk.substr(i,1) == "o") {
- [18:02:33] <jnicol> out(sq.substr(i,1));
- [18:02:34] <jnicol> }
- [18:02:35] <jnicol> }
- [18:02:36] <jnicol> out(", ");
- [18:02:37] <jnicol> }
- [18:02:38] <jnicol> out("");
- [18:02:39] <jnicol> function getNextSequence(sq, lk) {
- [18:02:40] <jnicol> i = lk.length;
- [18:02:41] <jnicol> while (--i > 0) {
- [18:02:42] <jnicol> if (lk.substr(i,1) == "o") {
- [18:02:43] <jnicol> base = sq.substr(i,1);
- [18:02:43] <jnicol> sq = sq.substr(0,i) + getNextBase(base)
- [18:02:44] <jnicol> + sq.substr(i+1,sq.length-i);
- [18:02:46] <jnicol> if (base != "C") { return sq; }
- [18:02:47] <jnicol> }
- [18:02:48] <jnicol> }
- [18:02:49] <jnicol> return "done";
- [18:02:50] <jnicol> }
- [18:02:51] <jnicol> out("");
- [18:02:52] <jnicol> function getNextBase(b) {
- [18:02:53] <jnicol> if (b == "A") return "U";
- [18:02:54] <jnicol> if (b == "U") return "G";
- [18:02:55] <jnicol> if (b == "G") return "C";
- [18:02:56] <jnicol> return "A";
- [18:02:57] <jnicol> }
- [18:02:58] <jnicol> out("");
- [18:02:59] <jnicol> return true;
- [18:03:12] <jnicol> Notice that line 7 compares the natural fold to our desired target fold.
- [18:03:14] <firedrake969> Is it done?
- [18:03:26] <jnicol> yes
- [18:03:26] <hoglahoo> I got a sadface output
- [18:03:42] <Eli-Fisker> haha. me too
- [18:03:43] <firedrake969> because it's a misfold
- [18:03:55] <Eli-Fisker> It is intended
- [18:03:58] <JohnDoe1> what are you coding?
- [18:03:59] <Eli-Fisker> :)
- [18:04:07] <Eli-Fisker> Nice detail, John
- [18:04:20] <jnicol> for AG and GG there are misfolds :(
- [18:04:31] <firedrake969> and CG
- [18:04:35] <JohnDoe1> where is this?
- [18:04:43] <jnicol> Unfortunately, not all of the sequences folds as we would like.
- [18:05:04] <jnicol> John, you can go to http://eterna.cmu.edu/web/script/create/
- [18:05:14] <firedrake969> yayz
- [18:05:17] <jnicol> and copy the code into the scripting window
- [18:05:23] <firedrake969> out(Lib.energyOfStruct(sequence,structure));
- [18:05:34] <firedrake969> Add that right below outln("energy = )";
- [18:05:39] <firedrake969> and remove the 0 kcal
- [18:05:41] <jnicol> So, an easy way to fix this is to select a sequence with a longer stem to prevent misfolds.
- [18:05:56] <jnicol> and lets also test all 256 combinations in the tetraloop
- [18:06:38] <jnicol> delete all previous code and copy the following lines into the scripting window:
- [18:06:45] <JohnDoe1> how do I load in what youre working on?
- [18:06:54] <jnicol> outln("GC closing tetraloops");
- [18:06:55] <jnicol> sequence = "CGCUGAAAACAGCG";
- [18:06:55] <jnicol> structure = "(((((....)))))";
- [18:06:55] <jnicol> locks = "xxxxxooooxxxxx";
- [18:06:55] <jnicol> out("");
- [18:06:55] <jnicol> while (sequence != "done") {
- [18:06:55] <jnicol> displayUnlockedBases(sequence, locks);
- [18:06:55] <jnicol> if (Lib.fold(sequence) != structure) {
- [18:06:55] <jnicol> outln("misfold :(");
- [18:06:55] <jnicol> } else {
- [18:06:55] <jnicol> outln("energy = 0 kcal");
- [18:06:56] <jnicol> }
- [18:06:57] <jnicol> sequence = getNextSequence(sequence, locks);
- [18:06:58] <jnicol> }
- [18:06:58] <jnicol> out("");
- [18:07:00] <jnicol> function displayUnlockedBases(sq, lk) {
- [18:07:01] <jnicol> for (i=0; i<lk.length; i++) {
- [18:07:02] <jnicol> if (lk.substr(i,1) == "o") {
- [18:07:03] <jnicol> out(sq.substr(i,1));
- [18:07:04] <jnicol> }
- [18:07:05] <jnicol> }
- [18:07:05] <jnicol> out(", ");
- [18:07:08] <jnicol> }
- [18:07:08] <jnicol> out("");
- [18:07:09] <jnicol> function getNextSequence(sq, lk) {
- [18:07:10] <jnicol> i = lk.length;
- [18:07:11] <jnicol> while (--i > 0) {
- [18:07:12] <jnicol> if (lk.substr(i,1) == "o") {
- [18:07:13] <jnicol> base = sq.substr(i,1);
- [18:07:14] <jnicol> sq = sq.substr(0,i) + getNextBase(base)
- [18:07:15] <jnicol> + sq.substr(i+1,sq.length-i);
- [18:07:16] <jnicol> if (base != "C") { return sq; }
- [18:07:17] <jnicol> }
- [18:07:18] <jnicol> }
- [18:07:19] <jnicol> return "done";
- [18:07:20] <jnicol> }
- [18:07:20] <jnicol> out("");
- [18:07:22] <jnicol> function getNextBase(b) {
- [18:07:23] <jnicol> if (b == "A") return "U";
- [18:07:24] <jnicol> if (b == "U") return "G";
- [18:07:25] <jnicol> if (b == "G") return "C";
- [18:07:25] <jnicol> return "A";
- [18:07:27] <jnicol> }
- [18:07:28] <jnicol> out("");
- [18:07:29] <jnicol> return true;
- [18:07:35] <jnicol> ok
- [18:08:09] <jnicol> John, are you able to copy this code into the scripting window?
- [18:08:31] <jnicol> did everyone run the code?
- [18:08:36] <Eli-Fisker> yes
- [18:08:37] <hoglahoo> I got a sadface army
- [18:08:37] <firedrake969> it's running
- [18:08:47] <jnicol> really hog??
- [18:08:55] <hoglahoo> yeah
- [18:09:00] <firedrake969> I got none
- [18:09:03] <Eli-Fisker> I got a ton of 0 KCal output
- [18:09:05] <hoglahoo> hmm
- [18:09:09] <hoglahoo> maybe I miscopied.
- [18:09:13] <firedrake969> same
- [18:09:15] <firedrake969> well that's hardcoded
- [18:09:20] <jnicol> 0 kcal yes, but should be no sad faces
- [18:09:43] <Eli-Fisker> http://prntscr.com/2s9aal
- [18:09:53] <jnicol> sad face only displays if there is a misfold
- [18:10:16] <jnicol> that is the correct output eli
- [18:10:17] <hoglahoo> recopied and pasted into a blank script, same result
- [18:10:37] <hoglahoo> maybe will try IE.
- [18:10:42] <JohnDoe1> copied
- [18:10:46] <firedrake969> Internet Exploder?
- [18:10:56] <jnicol> didnt you have a problem with the library call last time also hog?
- [18:10:57] <Eli-Fisker> lol, Fire
- [18:10:58] <hoglahoo> yeah my script failed in FF before for some reason
- [18:10:59] <hoglahoo> yes I did
- [18:11:30] <hoglahoo> works a treat in IE
- [18:11:41] <jnicol> Good, looks like this is a good sequence to prevent misfolds for all GC closing tetraloops!
- [18:11:41] <hoglahoo> oh, object doesn't suppor tthis property or method. weird
- [18:11:49] <hoglahoo> hehe
- [18:11:54] <jnicol> :)
- [18:12:03] <jnicol> Did anyone hit a timeout after clicking Evaluate?
- [18:12:07] <firedrake969> in javascript, how do you attack strings to each other?
- [18:12:16] <jnicol> Since this code is getting longer, the timeout should be set to higher value.
- [18:12:21] <firedrake969> me by like .057 sec
- [18:12:26] <jnicol> Setting the timeout to 60 should be good for the rest of this class.
- [18:12:40] <jnicol> Now its time to actually calculate the energy for each tetraloop.
- [18:12:51] <jnicol> The library call energyOfStruct returns the total energy of the sequence.
- [18:13:24] <jnicol> which we used in the preious class
- [18:13:24] <firedrake969> Ok
- [18:13:24] <jnicol> Lets display the total energy first, then later we will change this to display only the energy of the loop.
- [18:13:29] <hoglahoo> ah
- [18:13:29] <firedrake969> Can I see if I know a way to?
- [18:14:01] <JohnDoe1> GC closing tetraloopsAAAA, energy = 0 kcalAAAU, energy = 0 kcalAAAG, energy = 0 kcalAAAC, energy = 0 kcalAAUA, energy = 0 kcalAAUU, energy = 0 kcalAAUG, energy = 0 kcalAAUC, energy = 0 kcalAAGA, energy = 0 kcalAAGU, energy = 0 kcalAAGG, energy = 0 kcalAAGC, energy = 0 kcalAACA, energy = 0 kcalAACU, energy = 0 kcalAACG, energy = 0 kcalAACC, energy = 0 kcalAUAA, energy =
- [18:14:12] <jnicol> delete all previous code and copy the following lines into the scripting window:
- [18:14:19] <jnicol> outln("GC closing tetraloops");
- [18:14:19] <jnicol> sequence = "CGCUGAAAACAGCG";
- [18:14:19] <jnicol> structure = "(((((....)))))";
- [18:14:19] <jnicol> locks = "xxxxxooooxxxxx";
- [18:14:19] <jnicol> out("");
- [18:14:19] <jnicol> while (sequence != "done") {
- [18:14:19] <jnicol> displayUnlockedBases(sequence, locks);
- [18:14:19] <jnicol> if (Lib.fold(sequence) != structure) {
- [18:14:19] <jnicol> outln("misfold :(");
- [18:14:19] <jnicol> } else {
- [18:14:21] <jnicol> energy = Lib.energyOfStruct(sequence, structure);
- [18:14:22] <jnicol> out("total energy = ");
- [18:14:22] <jnicol> outln(energy.toFixed(2));
- [18:14:23] <jnicol> }
- [18:14:24] <jnicol> sequence = getNextSequence(sequence, locks);
- [18:14:25] <jnicol> }
- [18:14:26] <jnicol> out("");
- [18:14:27] <jnicol> function displayUnlockedBases(sq, lk) {
- [18:14:28] <jnicol> for (i=0; i<lk.length; i++) {
- [18:14:29] <jnicol> if (lk.substr(i,1) == "o") {
- [18:14:30] <jnicol> out(sq.substr(i,1));
- [18:14:31] <jnicol> }
- [18:14:32] <jnicol> }
- [18:14:33] <jnicol> out(", ");
- [18:14:34] <jnicol> }
- [18:14:35] <jnicol> out("");
- [18:14:36] <jnicol> function getNextSequence(sq, lk) {
- [18:14:37] <jnicol> i = lk.length;
- [18:14:38] <jnicol> while (--i > 0) {
- [18:14:39] <jnicol> if (lk.substr(i,1) == "o") {
- [18:14:40] <jnicol> base = sq.substr(i,1);
- [18:14:41] <jnicol> sq = sq.substr(0,i) + getNextBase(base)
- [18:14:42] <jnicol> + sq.substr(i+1,sq.length-i);
- [18:14:43] <jnicol> if (base != "C") { return sq; }
- [18:14:44] <jnicol> }
- [18:14:44] <jnicol> }
- [18:14:45] <jnicol> return "done";
- [18:14:47] <jnicol> }
- [18:14:48] <jnicol> out("");
- [18:14:49] <jnicol> function getNextBase(b) {
- [18:14:50] <jnicol> if (b == "A") return "U";
- [18:14:51] <jnicol> if (b == "U") return "G";
- [18:14:52] <jnicol> if (b == "G") return "C";
- [18:14:53] <jnicol> return "A";
- [18:14:54] <jnicol> }
- [18:14:55] <jnicol> out("");
- [18:14:56] <jnicol> return true;
- [18:14:59] <jnicol> ok
- [18:15:15] <jnicol> Good! Notice that line 11 has been added to get the energy of the sequence.
- [18:15:27] <firedrake969> So what does it do?
- [18:15:53] <firedrake969> the toFixed
- [18:16:01] <jnicol> that is the mfe, (energy) that each sequence folds to
- [18:16:17] <jnicol> if you go to puzzlemaker and put in each sequence
- [18:16:18] <firedrake969> So what does energy.toFixed(2) do to the energy?
- [18:16:31] <jnicol> that is the energy that will display in the energy box
- [18:17:00] <jnicol> javascript is bad at rounding floating point numbers
- [18:17:04] <hoglahoo> seems to work when I'm logged in as opposed to not logged in, with IE
- [18:17:04] <firedrake969> So it rounds to the hundredth
- [18:17:05] <firedrake969> ?
- [18:17:09] <jnicol> so toFixed rounds it to 2 decimals
- [18:17:16] <firedrake969> And I have a suggestion
- [18:17:28] <firedrake969> You set a task, we work on it for ~5 minutes, and then you show the code
- [18:17:54] <jnicol> thats a good class for next time, thanks!
- [18:18:17] <jnicol> The method I used to calculate each loop energy was to find the loop energy when all unlocked bases are set to A.
- [18:18:24] <jnicol> and use that loop energy as a starting point reference to calculate all other tetraloop energies.
- [18:18:27] <firedrake969> So that we can try what we've learned
- [18:18:33] <jnicol> So for a GC closing pair with all tetraloop bases set to A, the loop energy is 4.5 kcal.
- [18:19:05] <hoglahoo> did that last one take anyone else 161 seconds to evaluate :P
- [18:19:15] <firedrake969> No :P
- [18:19:19] <firedrake969> Like I said, Internet Exploder :3
- [18:19:39] <jnicol> 6 seconds for me
- [18:19:55] <Eli-Fisker> Around 10 for me
- [18:20:00] <hoglahoo> lawl.
- [18:20:03] <firedrake969> 15 for me\
- [18:20:08] <firedrake969> Cool
- [18:20:22] <hoglahoo> oh well, at least it ran. or walked, as the case may have been
- [18:20:25] <firedrake969> I found a way to compare the energies from all As to the various ones
- [18:20:30] <firedrake969> firstEnergy = Lib.energyOfStruct(sequence,structure);
- [18:20:35] <firedrake969> energy = (Lib.energyOfStruct(sequence, structure)) - firstEnergy;
- [18:20:50] <firedrake969> Add the first one below line 4, and the second one at line 12.
- [18:21:06] <firedrake969> The first is an addition, the second a replacement
- [18:21:18] <jnicol> thats exactly what we are going to do next fire!
- [18:21:24] <firedrake969> lol
- [18:21:24] <hoglahoo> oo clap clap
- [18:21:28] <firedrake969> thanks
- [18:21:44] <jnicol> delete all previous code and copy the following lines into the scripting window:
- [18:22:00] <jnicol> outln("GC closing tetraloops");
- [18:22:01] <jnicol> sequence = "CGCUGAAAACAGCG";
- [18:22:01] <jnicol> structure = "(((((....)))))";
- [18:22:01] <jnicol> locks = "xxxxxooooxxxxx";
- [18:22:01] <jnicol> loopenergy = 4.5;
- [18:22:01] <jnicol> out("");
- [18:22:01] <jnicol> ref_energy = Lib.energyOfStruct(sequence, structure) - loopenergy;
- [18:22:01] <jnicol> while (sequence != "done") {
- [18:22:01] <jnicol> displayUnlockedBases(sequence, locks);
- [18:22:01] <jnicol> if (Lib.fold(sequence) != structure) {
- [18:22:01] <jnicol> outln("misfold :(");
- [18:22:02] <jnicol> } else {
- [18:22:03] <jnicol> energy = Lib.energyOfStruct(sequence, structure) - ref_energy;
- [18:22:04] <jnicol> out("loop energy = ");
- [18:22:05] <jnicol> outln(energy.toFixed(2));
- [18:22:06] <jnicol> }
- [18:22:07] <jnicol> sequence = getNextSequence(sequence, locks);
- [18:22:08] <jnicol> }
- [18:22:09] <jnicol> out("");
- [18:22:10] <jnicol> function displayUnlockedBases(sq, lk) {
- [18:22:11] <jnicol> for (i=0; i<lk.length; i++) {
- [18:22:12] <jnicol> if (lk.substr(i,1) == "o") {
- [18:22:13] <jnicol> out(sq.substr(i,1));
- [18:22:14] <jnicol> }
- [18:22:15] <jnicol> }
- [18:22:15] <jnicol> out(", ");
- [18:22:18] <jnicol> }
- [18:22:18] <jnicol> out("");
- [18:22:19] <jnicol> function getNextSequence(sq, lk) {
- [18:22:20] <jnicol> i = lk.length;
- [18:22:21] <jnicol> while (--i > 0) {
- [18:22:22] <jnicol> if (lk.substr(i,1) == "o") {
- [18:22:23] <jnicol> base = sq.substr(i,1);
- [18:22:24] <jnicol> sq = sq.substr(0,i) + getNextBase(base)
- [18:22:25] <jnicol> + sq.substr(i+1,sq.length-i);
- [18:22:26] <jnicol> if (base != "C") { return sq; }
- [18:22:27] <jnicol> }
- [18:22:28] <jnicol> }
- [18:22:29] <jnicol> return "done";
- [18:22:30] <jnicol> }
- [18:22:31] <jnicol> out("");
- [18:22:32] <jnicol> function getNextBase(b) {
- [18:22:32] <jnicol> if (b == "A") return "U";
- [18:22:33] <jnicol> if (b == "U") return "G";
- [18:22:36] <jnicol> if (b == "G") return "C";
- [18:22:36] <jnicol> return "A";
- [18:22:37] <jnicol> }
- [18:22:38] <jnicol> out("");
- [18:22:39] <jnicol> return true;
- [18:22:44] <jnicol> ok
- [18:23:24] <jnicol> just like fire said, we are calculting a reference enrgy and using that to subtract from the total energy to get each loop energy
- [18:24:00] <jnicol> Line 7 calculates the reference energy, which is just the energy of the stem pairs.
- [18:24:00] <jnicol> In line 13, we subtract out the stem pair energy and are left with the energy of the loop.
- [18:24:00] <JohnDoe1> how do yuo use this?
- [18:24:17] <jnicol> copy the code into the scripting window, John :)
- [18:24:18] <firedrake969> I just added an easier, text-based way to see whether energy raised, lowered, or didn't change
- [18:24:53] <jnicol> This is finally what we want to see, each combination of the tetraloop, and the energy of that loop!
- [18:24:56] <firedrake969> It's a three-way if/else if/else check
- [18:25:04] <jnicol> did it work for everyone?
- [18:25:10] <firedrake969> if (energy < 0) { outln("Energy is lower!"); } else if (energy > 0) { outln("Energy is higher!"); } else { outln("Energy didn't change!"); }
- [18:25:12] <Eli-Fisker> yes, here
- [18:25:14] <hoglahoo> still evaluating.
- [18:25:27] <firedrake969> If you copy/paste that, it's cool :3
- [18:25:27] <jnicol> we'll wait for you :)
- [18:25:28] <mat747> yes
- [18:25:41] <firedrake969> It tells you via text whether energy raised, lowered, or didn't change
- [18:25:47] <hoglahoo> done
- [18:26:10] <jnicol> thats a goodexercise fire, helps to understand the code and functions better
- [18:26:14] <hoglahoo> so, everything lower than 4.5 is a boost sequence, and everything higher is a what
- [18:26:17] <Eli-Fisker> Fire where do you add it?
- [18:26:24] <jnicol> bust?
- [18:26:28] <hoglahoo> nice
- [18:26:40] <jnicol> I would like to make one more update to the code to show how it can be used for also displaying internal loops.
- [18:26:50] <jnicol> delete all previous code and copy the following lines into the scripting window:
- [18:27:15] <firedrake969> @Eli inside the else, right under outln(energy.toFixed(2));
- [18:27:22] <Eli-Fisker> Thx Fire
- [18:27:26] <JohnDoe1> I'm gonna do [Unsolvable] Possibly unsolvable series 3 - HgcG RNA . 0 solved 1200reward 28 Feb 2011 jeehyung
- [18:27:41] <firedrake969> It's impossible, John.
- [18:27:45] <firedrake969> np, Eli
- [18:28:02] <jnicol> sorry, needed to remove some comments, so it didnt break chat
- [18:28:29] <jnicol> here we go
- [18:28:32] <jnicol> outln("GC closing tetraloops");
- [18:28:32] <jnicol> sequence = "CGCUGAAAACAGCG";
- [18:28:32] <jnicol> structure = "(((((....)))))";
- [18:28:32] <jnicol> locks = "xxxxxooooxxxxx";
- [18:28:32] <jnicol> loopenergy = 4.5;
- [18:28:32] <jnicol> displayEnergy(sequence, structure, locks, loopenergy);
- [18:28:32] <jnicol> out("");
- [18:28:32] <jnicol> outln("AU closing tetraloops");
- [18:28:32] <jnicol> sequence = "CGCUAAAAAUAGCG";
- [18:28:32] <jnicol> structure = "(((((....)))))";
- [18:28:32] <jnicol> locks = "xxxxxooooxxxxx";
- [18:28:32] <JohnDoe1> who cares about impossibility, RNASSD did it
- [18:28:35] <jnicol> loopenergy = 5.3;
- [18:28:35] <jnicol> displayEnergy(sequence, structure, locks, loopenergy);
- [18:28:36] <jnicol> out("");
- [18:28:37] <jnicol> outln("AU-AU closing for 1-1 loops");
- [18:28:38] <jnicol> sequence = "GCAAAGCGAAAGCUAUGC";
- [18:28:39] <jnicol> structure = "(((.(((....))).)))";
- [18:28:40] <jnicol> locks = "xxxoxxxxxxxxxxoxxx";
- [18:28:40] <jnicol> loopenergy = 1.7;
- [18:28:41] <jnicol> displayEnergy(sequence, structure, locks, loopenergy);
- [18:28:42] <jnicol> out("");
- [18:28:43] <jnicol> function displayEnergy(seq, struc, lck, eng) {
- [18:28:45] <jnicol> ref_energy = Lib.energyOfStruct(seq, struc) - eng;
- [18:28:46] <jnicol> while (seq != "done") {
- [18:28:47] <jnicol> displayUnlockedBases(seq, lck);
- [18:28:48] <jnicol> if (Lib.fold(seq) != struc) {
- [18:28:49] <jnicol> outln("misfold :(");
- [18:28:50] <jnicol> } else {
- [18:28:51] <jnicol> eng = Lib.energyOfStruct(seq, struc) - ref_energy;
- [18:28:52] <jnicol> outln(eng.toFixed(2));
- [18:28:53] <jnicol> }
- [18:28:54] <jnicol> seq = getNextSequence(seq, lck);
- [18:28:55] <jnicol> }
- [18:28:56] <jnicol> }
- [18:28:57] <jnicol> out("");
- [18:28:58] <jnicol> function displayUnlockedBases(sq, lk) {
- [18:28:59] <jnicol> for (i=0; i<lk.length; i++) {
- [18:29:00] <jnicol> if (lk.substr(i,1) == "o") {
- [18:29:01] <jnicol> out(sq.substr(i,1));
- [18:29:02] <jnicol> }
- [18:29:03] <jnicol> }
- [18:29:04] <jnicol> out(", ");
- [18:29:05] <jnicol> }
- [18:29:05] <jnicol> out("");
- [18:29:08] <jnicol> function getNextSequence(sq, lk) {
- [18:29:08] <jnicol> i = lk.length;
- [18:29:09] <jnicol> while (--i > 0) {
- [18:29:10] <jnicol> if (lk.substr(i,1) == "o") {
- [18:29:11] <jnicol> base = sq.substr(i,1);
- [18:29:11] <jnicol> sq = sq.substr(0,i) + getNextBase(base)
- [18:29:13] <jnicol> + sq.substr(i+1,sq.length-i);
- [18:29:13] <jnicol> if (base != "C") { return sq; }
- [18:29:15] <jnicol> }
- [18:29:17] <jnicol> }
- [18:29:18] <jnicol> return "done";
- [18:29:19] <jnicol> }
- [18:29:20] <jnicol> out("");
- [18:29:21] <jnicol> function getNextBase(b) {
- [18:29:22] <jnicol> if (b == "A") return "U";
- [18:29:22] <jnicol> if (b == "U") return "G";
- [18:29:23] <jnicol> if (b == "G") return "C";
- [18:29:23] <jnicol> return "A";
- [18:29:25] <jnicol> }
- [18:29:26] <jnicol> out("");
- [18:29:26] <jnicol> return true;
- [18:29:38] <firedrake969> the bots don't always follow rules.
- [18:29:40] <jnicol> ok, copy but dont runit
- [18:29:47] <hoglahoo> JohnDoe1: RNASSD didn't stabilize it, it tricked eterna into accepting its sequence as a solve using a method the game doesn't provide for us
- [18:29:53] <mat747> what about a google doc
- [18:30:10] <mat747> that we could copy from
- [18:30:23] <firedrake969> that would be awesome
- [18:30:42] <jnicol> first remove line 12
- [18:30:56] <Eli-Fisker> Or perhaps a pastebin link
- [18:30:59] <JohnDoe1> http://eterna.cmu.edu/sites/default/files/chat_screens/129002_1392337857.png
- [18:31:00] <jnicol> JohnDoe line
- [18:31:26] <JohnDoe1> does linkbot do tricks?
- [18:31:31] <jnicol> comment out lines 6 and 13
- [18:31:34] <hoglahoo> not really
- [18:31:51] <jnicol> by putting 2 slashes before the displayEnergy
- [18:31:55] <hoglahoo> // comment out like this?
- [18:32:01] <jnicol> correct
- [18:32:17] <firedrake969> So what does the code do?
- [18:32:37] <jnicol> In this last version of the code, I have put the while loop that displays the energy into its own function, displayEnergy
- [18:32:46] <jnicol> This way, we are able to make one call from the main program to display the energy of all combinations for any type of loop; hairpins, 1-1, 1-2, 2-2
- [18:32:52] <hoglahoo> say when, for eval
- [18:33:05] <jnicol> Lines 6 and 13 have been commented out, but can easily be uncommented to show the tetraloop energies of all GC and AU closing pairs.
- [18:33:14] <jnicol> not yet :)
- [18:33:43] <jnicol> Line 15 through 20 demonstrate the energies of a 1-1 loop.
- [18:34:00] <jnicol> ok click evealuate
- [18:34:11] <jnicol> or however its spelled
- [18:34:34] <hoglahoo> that went a little more quickly, yay.
- [18:35:21] <jnicol> Notice that some results show misfolds, but looking deeper, we see that the misfolds are caused by valid pairs across from each other.
- [18:35:33] <jnicol> in the 1-1 loop
- [18:36:00] <firedrake969> Yeah
- [18:36:24] <Eli-Fisker> Ah
- [18:36:32] <TomoeUzumaki> hello
- [18:36:37] <jnicol> uncomment the other lines to see the GC closing pair and AU closing pair energies for all those tetraloops
- [18:36:59] <Eli-Fisker> http://prntscr.com/2s9i7k
- [18:37:06] <jnicol> that is how you can you scripting to generate energy charts
- [18:37:20] <LFP6> Hey everyone
- [18:37:35] <firedrake969> hi LF
- [18:37:42] <hoglahoo> thanks jnicol
- [18:37:42] <Eli-Fisker> John, how do I uncomment the other lines?
- [18:37:45] <jnicol> thank you eli, thats the correct results for the 1-1 loops that are closed by AU pairs
- [18:38:02] <jnicol> delete the 2 slahes before them
- [18:38:21] <jnicol> I know this class was a little more intense, but I thank everyone that followed along, and I hope you are now confident enough to try to generate other loop energies!
- [18:38:27] <firedrake969> How long is it supposed to take? :P
- [18:38:53] <jnicol> well i commented the code so that just 1 at a time should be run
- [18:39:15] <jnicol> running all 3 will take around 30 seconds
- [18:39:24] <jnicol> for hog, 5 minutes
- [18:39:24] <LFP6> Hi Drake, Eli, Hog, Jnicol
- [18:39:30] <LFP6> :)
- [18:39:32] <firedrake969> hi LF
- [18:39:32] <Eli-Fisker> Hi LFP
- [18:39:33] <jnicol> hi LFP6
- [18:39:39] <LFP6> How long until class is over?
- [18:39:44] <firedrake969> I thinnk it's done
- [18:39:45] <jnicol> Congratulations to all that have graduated the Energy Chart class :) We should have badges made for this.
- [18:39:51] <jnicol> done!
- [18:39:53] <firedrake969> Did anyone save a transcript?
- [18:39:54] <Eli-Fisker> :)
- [18:40:00] <firedrake969> That'd be hog's job :P
- [18:40:12] <mat747> John - thanks
- [18:40:27] <Eli-Fisker> Thx for the class
- [18:40:27] <firedrake969> Thanks, jnicol!
- [18:40:27] <LFP6> Hey Mat
- [18:40:28] <hoglahoo> I have one if nobody else does, but the format is goofy
- [18:40:32] <jnicol> thanks to all for helping me with the technical problems :)
- [18:40:52] <Eli-Fisker> I have one too
- [18:40:59] <LFP6> Question: What is the next step for EternaU now that we got the devs' green light?
- [18:41:41] <firedrake969> have someone get a dev package and try implementing it
- [18:41:47] <mat747> Hi LFP
- [18:41:59] <firedrake969> @Eli--could you upload it to Google Docs and give me a link?
- [18:42:33] <Eli-Fisker> I need to edit it a bit down first
- [18:42:37] <firedrake969> Sure
- [18:42:44] <mat747> lfp - what green light
- [18:42:46] <firedrake969> Can you do the raw chatlog first?
- [18:43:15] <Eli-Fisker> I will upload it in the WIKI when I got it stiched together
- [18:43:19] <firedrake969> Ok
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement