Home > Methods > Short Simple Tips and Techniques for use in Bioinformatics

Short Simple Tips and Techniques for use in Bioinformatics

Here I am compiling some of the short simple tips and tricks for use to ease out some of Bioinformatics work, I would also be thankful if you can contribute to it, if you can come across some. Write them as comment and I will update them.

##################################################

Fetch FASTA sequences using identifier from a file.

CODE:

grep -A1 -f list mainfile > fastaofidsfromlist

Explanation:

To fetch selected fasta sequence from huge file. Keep your identifiers or fasta headers in ‘list’ (i.e. like Rv ids). ‘mainfile’ is the original file from where you have to fetch the fasta. ‘fastaofidsfromlist’ is the your file with fasta sequences of the ids you gave as list. Issue the following command.

CAUTION: For this to work properly, your mainfile should have sequences in one line only, without line breaks. Check output file before use.

##################################################

Convert FASTQ to FASTA:

Code:

sed -n ‘ 1~4s/^@/>/p; 2~4p ‘ file.fastq > file.fasta

sed ‘s/\ /\_/g’ seqfile > seqfile_ed (to make unique ids in flash assembled sequences)

##################################################

Schedule one job after another

Run one script after another in such a way that second script starts after finishing first one. Without using Pipe | or ampercent && i.e. the first process is already running and you want second one to start after the first one finishes. And this can be done in different folder in case the output of second script will affect the output of first script. So run this on any folder you wish to.

Code:

while ps -p $PID; do sleep 1; done; script2

Explanation and Example:

while ps -p 4437; do sleep 1; done; echo “It Works”

Where $PID is the process id of the already running job (add PID number)

script2 is your script you wish to run after first script ends

sleep 1 is sleep for one second (SUFFIX may be ‘s’ for seconds (the default), ‘m’ for minutes, ‘h’ for hours or ‘d’ for days, read man sleep)

##################################################

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: