22 April 2011

Playing with the HTML5 File API: translating a Fasta file.

In the current post, I'm using the new HTML5 File Api. This new API can read the content of a file on the client side without needing a remote server. Let me repeat this:

YOU DO NOT NEED A SERVER
YOU DO NOT NEED TO COPY AND PASTE THE CONTENT OF THE FILE IN A TEXTAREA
.
As an example, the following code reads a whole DNA fasta file stored on your computer and translate each DNA sequence to a protein. When the user selects a new file, a FileReader object is created and a callback function translating the DNA is invoked when the fasta file has been loaded.

Test (your browser must support HTML5)

:

Source code



That's it,

Pierre

1 comment:

Daniel Standage said...

Awesome! I did a lot of web programming in a former life, but I haven't kept up with the latest developments. It will be interesting to see how new web technologies impact bioinformatics!