Category Archives: Tools

Validate DNA FASTA file with a javascript function

gitlogoI couldn’t find a quick function that validates a single DNA FASTA file in javascript, so here a setup (it uses the same structure as this protein FASTA validator from the Oxford Protein Informatics Group).

function validateDNA (seq)	{
	//Based on:

	// immediately remove trailing spaces
	seq = seq.trim();

	// split on newlines... 
	var lines = seq.split('\n');

	// check for header
	if (seq[0] == '>') {
		// remove one line, starting at the first position	
		lines.splice(0, 1);

	// join the array back into a single string without newlines and 
	// trailing or leading spaces
	seq = lines.join('').trim();
	//Search for charaters that are not G, A, T or C.
	if ([^gatc\s]/i) != -1) {	
		//The seq string contains non-DNA characters
		return false;
		/// The next line can be used to return a cleaned version of the DNA
		/// return seq.replace(/[^gatcGATC]/g, "");
		//The seq string contains only GATC
		return true;

Have fun

Leave a Comment

Filed under Tools

Measuring light intensity with the TSL-235 and a Raspberry Pi

picThere are many ways to measure the light intensity using a Raspberry Pi and one of them (that doesn’t require an ADC) is the TSL-235. It is a photodiode connected to a small circuit that generates a pulse of which the frequency depends on the light intensity. This frequency can be directly read out using a Raspberry Pi as explained below.
Continue reading


Filed under Tools

Setting up Syncthing for Raspberry Pi

Nowadays everything is apparently in the cloud. However the cloud comes in many different sizes and shapes. In my case primarily¬†in the form of dropbox. However there are always downsides of “out sourcing” your data to an undefined cloud. Some popular¬†alternatives include BitTorrent Sync (not open source and your data is still touched by a third party), ownCloud (an open source dropbox clone, however the performance on a Raspberry Pi is not very smooth) and since December 2013 Syncthing. The last one is a kind of open source implementation of BitTorrent Sync, so in contrast to Dropbox your data is distributed over your own computers and not at a distant server. In my setup I use a headless Raspberry Pi that is tucked a way in a cupboard as a node in the network, so this client is always online. Continue reading


Filed under Tools

Git for Scientists in 2 minutes

gitlogoSince the introduction of Git the world of version control went through a revelation. Currently Github is the biggest player in the field, offering a free place to host and collaborate on your open-source code. However Git is also very useful for a scientist to keep track of in silico experiments and it does not require any sophisticated or complicated tools. In this post a small tutorial on how to set Git up for your experiments. Continue reading

Leave a Comment

Filed under Tools