This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Multiple Sequence Alignment In Javascript

I know it may seem kind of strange but I was wondering if anybody has ever seen some javascript code for the multiple sequence alignment problem. If not (as I suppose) also some easily portable code (i.e. I need no kitchen sink) will do. Keep in mind that I won't be aligning more than 4-5 sequences less than 100-200 symbols long.

Note: I know javascript is not really the best choice for this kind of things. Trust me, there are good reasons why I have to do it in javascript (if curious, see below in the comments).

(crossposted from stackoverflow)

multiple

Being in a situation that forces you to use the wrong tool for the job is not really "a good reason", in my experience.

I already explained (see below, in the comments) why it's not that bad of a choice. Also, I'm volunteering my time to this project: I have to stick with the solution that works, is easily maintenable and doesn't add further dependencies. Hopefully this can help understand why JS in this case is the right tool for the job.

I must say that I agree with Neil. Even after having read the comments below, I cannot see a good reason why you would need to run something in a web browser, yet not have access to use web services.

Because it's not a web browser. It's something built on top of the same platform (xulrunner) as Firefox but it's not a web browser. And, besides, the user base would probably be too big for anything less than a whole data center to handle. Now, if we could all go back to the question...

Also, keep in mind (as I already wrote below) I'm not talking about bioinformatics here: the sequences I need to align are not DNA/protein/codons sequences. They are generic sequences, and I'm almost sure that none of the servers you're talking about would 1) accept arbitrary sequences 2) allow me to use their computing power for something totally unrelated to bioninformatics.

Frankly, I am really surprised at the number of people commenting here being so judgmental about the idea of a multiple sequence alignment implemented in JavaScript. 2.2 years ago, maybe I can see it. But not really. There is so much you could do with a dynamic JavaScript implementation - zoom in/out; scroll; add/remove sequences from the alignment; highlight regions; adjust colors; mouseovers; etc. If I get an image from a web server, it's a static image. If I get the data from the web server, the UI can do anything.

5 answers

The Sequence Manipulation Suite might be your answer. It's the closest thing I know of to "BioJavaScript." It looks like a pairwise alignment but I'm sure you can modify it for a multiple sequence alignment.

http://www.bioinformatics.org/sms2/pairwise_align_dna.html

Thanks, that's a good starting point. I'll try it and see if I can hammer it into place.

I'm curious if you were able to do something with this? It might be a benefit for the community if you are turning it into something larger.

I think you should look at this project

They have compiled BioJava using GWT - so in theory you should be able to run multiple alignments in the browser. They have already implemented Needleman-Wunsch. I suppose the other algorithms may be implemented.

GWT allows writing of code in Java and then compilation into javascript. They have run their server on the google app engine - pretty neat!

You could also try to take a multiple sequence alignment algorithm implemented in another language, and try to compile it to JavaScript. For example, you might try JAligner and GWT.

I know you say there is a good reason why you have to do it in JavaScript, but have you considered using an AJAX solution instead? That would allow you to do the alignment server-side using any one of the many existing multiple alignment programs?

There's no server involved. This has to run in a stand-alone application built on xulrunner and I don't want to ship binary components for multiple platforms, so this leaves me with no choice, i.e. using javascript.

You might be creating something like an extension for firefox ? but as far as I know you can link some C++ components to your XUL application.

@Pierre, yes it's something like a Firefox extension. But as I said, I'd rather not have to build and ship binary components for all the supported platforms. Javascript, on the contrary, will run everywhere. Also, as I said in the question, I don't need a fully-fledged library capable of handling huge datasets... this will work on small inputs, so computational complexity should be of no concern.

I guess you are the first who have such a need, which means you have to implement by yourself. A standard progressive alignment is not that hard to implement, probably within several hundred lines of javascript source code. Take it as an exercise.

@lh3: I'll try Lee's suggestion, if it doesn't work well I'll probably try to implement some MSA unsing simulated annealing.

I don't understand why?

Why I need this or why am I using JS? I already explained the latter; the former is because I have multiple "noisy" input sequences and I need to find out which parts are "noise" and which part are legitimate data. And that's pretty much what MSA is for. Bear in mind that I'm not talking about bioinformatics here, I was just redirected here from stackoverflow.

This should have been posted as a comment and not an answer.

You have to admit that's a pretty good answer, anyway. It has 0 points, but it could have been -20.

Log in to answer this question.