Renoise, Academia, & Perl


(kickofighto) #1

This summer I have to earn money for next year rather than taking a lab placement. This may or may not put me at a competitive disadvantage regarding my postgraduate research.

I have decided then to learn Perl, an interpreted programming language used by biologists (especially in genetics) that is now considered a vital laboratory skill.

Perl is particularly good at manipulating and comparing text strings. The genetic code and any organism’s genome can be represented as a string of four letters.
What else?
Renoise device chains, patterns etc…!!! :w00t:

So this summer I will be using perl as a conduit for both my learning of genetics and my mastering of renoise!

Here’s my question:
Who else has used Perl to manipulate xml, and how did they find it?

One of my aims is to make a Perl program that can take a sequence of DNA or amino acids and generate a pattern from it.


Renoise, Academia, & Perl
(Suva) #2

Yes, you can use perl to manipulate XML just fine, but this is not the strong point of perl, it’s good with working plain text data… Or so they say. I usually just want to shoot myself in the head when seeing perl code.


(kickofighto) #3

Good job you’re not a genetecist then! :P
Yeah, I have limited knowledge of other languages, but some elements did look a little unnecessary or obtuse.

From my experience of it, the ease with which you can substract and replace specific elements conditionally would be good for editing device chain xml parameters.

I might build some hashes to start out eg. note to frequency and the like.


(BYTE-Smasher) #4

PERL!


(vV) #5

good ol’e Perl… the last time i used it was back in 1997 for my aunt’s webshop…
I would just use PHP instead though…
Much more powerful.


(BYTE-Smasher) #6

PHP isn’t always more powerful than perl. Perl’s strengths lay in its loose structure, which allows for quick coding, and its strongly embeded regex support. In comparison to Perl, PHP makes it a pain to use regex.


(kickofighto) #7

Good or bad, it would seem that perl and python are the biology and bioinformatics mainstays.
I think I came across someone making music with perl during the module earlier this year.

The loose structure is indeed what makes it amenable to us pseudo-programmer bio boys, but I imagine it can lead to problems later on in larger programs when you loose track of your train of thought.
Just extensive pseudocode and comments needed I guess.


(Suva) #8

Yes, I actually imagine there would be much better ways to work with DNA code than regexing long strings with perl. But then again, it’s probably the simplest way to hack around. In large scale, nobody will understand the crap you wrote later. :D

Python on other hand is much better syntax-wise, but not as fast for hacking.


(BYTE-Smasher) #9

To the contrary, if one knows perl well, one can read perl :P


(Suva) #10

People able to read perl is a myth made up to scare small children.


(gnute) #11

pretend I posted that 99 bottles of beer perl script.


(Pod) #12

Really? Wow. Big up perl in the genetics field.

Perl is a very madddening programming languages. The contextual nature of it takes a while to get used to. Also, it’s very very easy to write disgusting Perl you won’t ever be able to read again. But that’s half the fun of Perl.

XML is plain text! It’s also very regular. This makes munching it in Perl dead easy. But why bother? There’s already libraries to do it. Just google for “perl XML library” or “perl XML cpan” to see. I, like everyone else, recommend that you buy both o’reilly books on the subject. Learning Perl and Programming Perl


(sgh) #13

A good one from Eric Raymond’s (rather old) Why Python? article:

I think Perl is great for one-liners that just get a job done and is famous for its huge library at CPAN but if your into scientific programming I would use Python. SciPy is a very good replacement for Matlab/Octave/whatever and it is very easy to manipulate XML files with the integrated xml.dom.minidom package. You can also use the IPython Python shell to interactively develop your code. If you’re not into highly efficient code and parallel threads (Mr Rossum, tear down that GIL!) Python is definitely a nice language to learn.

BTW: If you still want to learn Perl here is an article about livecoding in Perl for making music.


(Suva) #14

XML may be plain text, but it is used for structural data, which is much smarter to be parsed with XML parser. Doing this shit with regexes is bad idea. But perl XML libraries don’t do much anything that PHP or Python XML libraries can’t and thus it doesn’t really matter.

I myself have written some projects in perl, but >10 kloc projects are pain in the ass. I wouldn’t recommend it.


(BYTE-Smasher) #15

+1


(kickofighto) #16

I think what happened was that perl established itself very early on. It’s what most bioinformaticists turn to first and there is an extensive open source library of “BioTools” aswell as BioPerl for biologists which is a huge collection of modules relating to all sorts of biological and statistical data.
With regards to people understanding what you wrote later, I don’t think it matters much to biologists aslong as it does what it says on the tin. If you’re program performs a particular task well as a module and hasn’t been done before it is added to BioPerl or shared between labs etc…I could be wrong.

Not that I had any programming experience before taking the class, it did seem like we were spending alot of time trying to debug defective programs.

Here’s an example of a typical application of perl in bioinformatics; here visually mapping predicted gene interactions from the human genome (a so called interactome)

Going on what all of you are saying, I think I may have enough (even too much) on my plate just learning BioPerl this summer. So I partially retract that initial statement.
Perl cookbook and perl for bioinformatics for me.

Aside: Here’s the page I got that image from; some interesting stuff on there if you like science and visual analysis. Enjoy? :)


(Corticyte) #17

dude i’m doing a biology degree. it sucks… I’m only doing it in case I can’t get a job in music.

but DNA-to-Renoise-Pattern sounds awesome! evolving music anyone?

good luck with your perl ventures, rather you than me!


(kickofighto) #18

Heh. I’d wondered before, because of your name ( I also found another called Isochore).
Well I love biology, I just hate having to work <_<

Nerdy, but a while ago I was trying to remember the functional groups on the intermediates in glycolysis. I made a set of instruments corresponding to CH2, O, Pi etc… then I equated pitch to carbon number and put them together.

Sounded horrible- and nothing was learned that day.


(DudeGal69) #19

Perl is really powerful. XML is very easy in perl.