Author Topic: Programming task (DNA editor)  (Read 13205 times)

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Programming task (DNA editor)
« on: May 13, 2014, 04:24:05 PM »
I have a more-or-less stand alone project, if any coders are interested.

I'm starting to work on the GUI side of DB3.  I'd like a more-or-less full featured code editor for DNA.  There's a pretty slick code editor around that we can probably leverage: ScintillaNET.

The task is to take that as a starting point and create an IDE for DNA.  Something that I could integrate in to DB3 itself, but also run as a stand alone program.

If anyone's interested in tackling this as a summer programming project let me know and I'll help get you started.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Programming task (DNA editor)
« Reply #1 on: May 13, 2014, 04:39:12 PM »
Don't know If I'll have time to help with all the other stuff going on. But some comments:

Open source code editor = cool

Quote
Something that I could integrate in to DB3 itself, but also run as a stand alone program.

That means it will have to be written in C#. And be completely object oriented.
« Last Edit: May 13, 2014, 04:47:29 PM by Botsareus »

Offline Panda

  • Global Moderator
  • Bot Destroyer
  • *****
  • Posts: 476
  • Computer Science Undergraduate (nerd)
    • View Profile
Re: Programming task (DNA editor)
« Reply #2 on: May 17, 2014, 08:13:57 AM »
As I'm approaching the summer, and I don't think I'll have a lot of work to do (other than reading up about genetic algorithms for my final year project, which I am psyched for), I'm looking to work on something. I could at least contribute a base for it.

I have had some practice with tokenisation, etc, but I don't know how well I could do this, it's always worth a shot, though.
« Last Edit: May 17, 2014, 08:16:04 AM by Panda »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Programming task (DNA editor)
« Reply #3 on: May 17, 2014, 02:10:22 PM »
I'm doing a pass on the DNA code right now around the parsing and giving "compile errors".  You'd need to figure out syntax highlighting and saving/loading and anything else that makes sense.

Also it would be nice if most of it was set up as a control instead of a form so I could embed it in the program irksome in like the options window.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Programming task (DNA editor)
« Reply #4 on: May 17, 2014, 04:01:22 PM »
How do you write a standalone control in .NET? I thought it had no component object model.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Programming task (DNA editor)
« Reply #5 on: May 17, 2014, 06:27:03 PM »
Found it.

Quote
The control we will create will contain a text box for your name and a button that will fire an event. To begin, open Visual Studio .NET and begin a new C#  Windows Control Library. You may name it whatever you like, for this sample the project name will be SubmitButton.

 May be useful for noobs. here

Then you just add it to your ".NET components" and it computes the control.
« Last Edit: May 17, 2014, 06:30:59 PM by Botsareus »

Offline Panda

  • Global Moderator
  • Bot Destroyer
  • *****
  • Posts: 476
  • Computer Science Undergraduate (nerd)
    • View Profile
Re: Programming task (DNA editor)
« Reply #6 on: May 18, 2014, 06:15:14 AM »
Right, I'll bear this in mind and I'll get back to you in a week and a half (after exams and after-exam alcohol).

EDIT: I forgot to say that I do not know anything about the syntax that we're going to use for DB3. Anything to help me with that?
« Last Edit: May 18, 2014, 08:08:28 AM by Panda »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Programming task (DNA editor)
« Reply #7 on: May 18, 2014, 04:37:13 PM »
I'm redoing a lot of it anyway. By the time you'll decide if you want to play with it I'll have a language spec written out I think.

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Programming task (DNA editor)
« Reply #8 on: May 20, 2014, 04:15:20 PM »
Numsgil, how exactly will codules and chromosomes work when they need to be crossed over?
Will it search for codules under a specific chromosome and add them to resulting robot? In that case will it remove duplicate codules? Also, what happens in situations if both robots have only 1 chromosome?

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Programming task (DNA editor)
« Reply #9 on: May 21, 2014, 04:34:06 PM »
I haven't gotten that far, but probably codules will get appended one after another to form a single long basepair sequence.  Then, I'll determine chromosome matches by finding pairs with the largest common subsequence.  Paired chromosomes will be crossed over, and the pair split between daughter cells.  Unmatched chromosomes will be randomly assigned to one of the two daughter cells.  Though I might want to do something else to handle cases where a haploid cell tries to sexually divide.

Offline Panda

  • Global Moderator
  • Bot Destroyer
  • *****
  • Posts: 476
  • Computer Science Undergraduate (nerd)
    • View Profile
Re: Programming task (DNA editor)
« Reply #10 on: June 27, 2014, 10:42:02 AM »
Riiiiiiighhhhht. I'm back now and I'm still willing to do this. :)

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Re: Programming task (DNA editor)
« Reply #11 on: June 28, 2014, 07:33:54 PM »
Okay!  I've basically got the DNA in a good state.  First step is you'll need to get the code and make sure it actually compiles on your machine.  I've updated the Darwinbots3 page on the wiki.

Assuming you can open and build Sunweaver.sln (the solution file for the DNA), you just need to call Sunweaver.Parsing.Parser.ParseDNA to turn text in to DNA.  Importantly there's an overload that returns a list of CompilationMessages.  These messages have things like line and column numbers for syntax errors in DNA, and a short message describing what's wrong.  So first step is to get Scintilla to send text through that ParseDNA method, and provide red squiggly lines for syntax errors.  The parsing should be fast enough that you can run it on a background thread whenever there's a pause in typing (similar to what Visual Studio does).

After that, syntax highlighting would be good.  You can get a list of known sysvars and commands in Sunweaver.DNASystem.Sysvars and Sunweaver.DNASystem.Commands.  Anything else is stored in the Sunweaver.Chromosome you get back after you parse DNA.

After that, stuff to let you "go to definition" for codules would be neat.  But I'm not sure how that'll work.  At some point you might need to dig in to the code for parsing DNA and get your hands dirty.  Hopefully it makes sense.  And of course, the unit tests are good for figuring out how something is supposed to work.

Once you have a simple prototype working I'll help you get the code in to the repository in a way that makes sense.

Offline Panda

  • Global Moderator
  • Bot Destroyer
  • *****
  • Posts: 476
  • Computer Science Undergraduate (nerd)
    • View Profile
Re: Programming task (DNA editor)
« Reply #12 on: June 28, 2014, 09:16:25 PM »
I will get back to you on Monday about whether I've got everything working on this machine but I don't think it will be a problem. I know I have licensed version of VS2013 Ultimate on this machine so that definitely won't be a problem.

What extent of Unit Tests will you expect from me?

Just to condense it:
  • syntax errors
  • syntax hilighting
  • "go to definition"

I'm pretty sure I have SVN rights but I cannot remember what my credentials are? I know I can still download the source anyway so that's not a problem.

Anything else that I'm missing?

Offline Botsareus

  • Society makes it all backwards - there is a good reason for that
  • Bot God
  • *****
  • Posts: 4483
    • View Profile
Re: Programming task (DNA editor)
« Reply #13 on: June 29, 2014, 12:22:14 PM »
This is a related repo. question:

When me and Panda where working on chloroplasts in DB2 together, every time another person made change in the repo. you had to create a fresh local copy. Very inefficient imo. I am guessing there is improvement on that in the DB3 repo. as you say " I'll help you get the code in to the repository in a way that makes sense." How does that work?

Offline Panda

  • Global Moderator
  • Bot Destroyer
  • *****
  • Posts: 476
  • Computer Science Undergraduate (nerd)
    • View Profile
Re: Programming task (DNA editor)
« Reply #14 on: June 29, 2014, 01:59:56 PM »
I can't remember having to make a fresh local copy whenever there was a change in the repo. :s Maybe we did but that was a while ago.

I guess what he means by that is we just find a logical place for it to go in the repo later rather than trying to sort it out now.