Category: Tools

Announcing scribl-rails

PfEMP1 domains drawn with scribl

Sometimes back I had mentioned about scribl javascript framework for drawing bioinformatics glyphs on HTML5 canvas. If you are a Rails developer you will be happy to know that I have written  scribl-rails, an asset helper for including scribl in your application asset pipeline.

Usage

Add the following to your gemfile:

gem 'scribl-rails' 

ran bundle install from the application directory

Add the following directive to your Javascript manifest file (application.js):

//= require scribl 

Enjoy using scribl-rails and creating cute bio-graphics! Many thanks to Chase Miller for the awesome library!

For more information and development check out the scribl-rails at github

Use Scribl to draw genomic glyphs on HTML5 canvas

The Scribl library by Chase Miller is an awesome and a promising Javascript library for visualizing biological sequence information and rendering it on the web. Scribl  generates biological charts of genomic regions, alignments, and assembly data. The library is under continuous development and I have been able to use it for some internal projects!

A very nice list of examples and introduction is available at the home page and the wiki provides an elaborate user guide!

Happy biology!

My general purpose bioinformatics toolbox

I spend most of my time writing code and using an range of bioinformatics analysis packages. Unlike in many other professions, sometimes  there are no best tools for accomplishing a bioinformatics task. The tools are continuously improved and the choice of tools is dependent on the research question and the biology of whatever you are investigating. However  I have come to rely on some general purpose resources that make me more productive. Let me introduce you to my general purpose spanner box.

Code Editing

Macvim

I have finally found nirvana in MacVim, which is the preferred version of  Vim for Mac OS. It allows screen splitting, window resizing and integrates with the console, such that you can run system commands right in the editor. You have to install the necessary scripts or plugins to support what you want to do.

It has increased my productivity, although it has a slightly steep learning curve.  This is a tool I recommend to any bioinformatician, if you are not already using it!

Cost: Free

Source Control

Git

Git Source control

I use git for source control. It is awesome and fits very well with my workflow. Git has powerful features and easy to use and work with. I like the idea of distributed source control and it makes it easier to work on different versions of the same project!

Cost: Free

Bibliography manager

Papers

Papers

I use Papers, which is a commercial tool but I would recommend it to anyone. It helps me sort,annotate and read research articles. I once used Mendeley, which is an awesome tool as well.

Cost: $42 (has academic discounts)

Terminal

terminal

terminal

One of the best tools which we may forget is a tool is the terminal! Since I use Mac OS, I enjoy the best of both worlds, a powerful Unix command line support, excellent graphics and support for proprietary software if need arises.

 

Pen

Pilot V Ball RT Pen

Pen

I don’t keep an electronic notebook since I prefer jotting down my notes and having a Notebook. I use a liquid ink Pilot V ball RT pen. The pen has a retractable cone-tip liquid ink rollerball, rubber grip and metal pocket clip. It is airplane-safe and writes a 0.4mm line. 

Cost: $5

NoteBook.

NoteBook

D66174 NoteBook

My preference for a notebook is an  A4  D66174 Notebook.  Each book has about 180 pages.  It comes with a protective handcover. This is an archive for my written thoughts, discussions and workflows.

Cost $90 for a pack of five books.

What is your general purpose  bioinformatics toolbox?

Converting sequence data from csv to fasta format

Many  times I find someone storing sequence data in excel Workbooks.(insert scream here) This is usually followed by a request which goes like this,

Someone: ” I will send you some sequences and then we can perform xyz analysis please?”

Me: “Are they in fasta format?”

Someone: “No, they are in Excel ”

Me: (supressing a laugh) “Ok, do you mind to convert them to Fasta and then we can do xyz?”

Someone:(with a wiggle on the face)  “How do I do that?, Is there a windows  program to do that?”

Me: (feeling superman-nish) “eeh we can create a quick script in perl or Ruby, I prefer Ruby … but you should lean some basic perl or Ruby…. and run away from windows. :)”

Me: “Save your data as CSV(File ->Save As-> csv),  then send me that file”

So here is a very simple script that reads a csv file and creates a fasta file using Ruby.

You need to specify the path to the input csv file and the output fasta file, the column number that contains the name of the sequence and the column number that contains the sequence data in the csv file.

require 'csv'
# read a csv file and create a fasta file
def csv_to_fasta(csv_file,output_file,name_col,seq_col)
  File.open(output_file,'w') do |file|
  count = 0
  CSV.foreach(csv_file) do |row|
   sequence_id = row[name_col]
   seq = row[seq_col]

  count = count+1
  puts sequence_id
  file.puts ">#{sequence_id} \n#{seq}"
 end
 puts "#{count} sequences processed"
end
csv_file    = "#{ENV['HOME']}/path_to_csv_file.csv"
fasta_file  = "#{ENV['HOME']}/path_to_fasta_file.fasta"

seq_name_col = 0 #assumes the first column contains the names
seq_data_col = 1 #second column contains the seq data

csv_to_fasta(csv_file,fasta_file,seq_name_col,seq_data_col)

Happy biology!