Ettema lab blog

Multithreading with BLAST

The NCBI BLAST+ suite has built in multithreading, which is nice. However, this multithreading is not always utilising all threads available to it. A nifty way around this is to split your input query into several smaller files (equal to the number of threads you have available) and blast them separately using a single thread

Continue reading and comment →

Simple command line data manipulation

Recently I found a nice little tool called datamash. This allows for simple data wrangling, or should one say mashing, directly on the command line. I found this tool since I wanted to have a way of easily transposing tab separated files via the command line. One such example would be if you have a

Continue reading and comment →

Printing from commandline

When you have a lot of documents to print, perhaps a bunch of papers you want to read, it can be a bit annoying to print these one by one. A nice solution can instead by to do this from the commandline. The ‘lp’ tool is quite nice and can be modified to do a

Continue reading and comment →

Defensive BASH

Ran across this interesting blog post talking about defensive BASH scripting. There might be some things one might not agree with, but it do contain a lot of tips for good practices. The idea behind the name “defensive” is to write code that will run into as few of a problems as possible. I for

Continue reading and comment →

Using for loop vs Gnu parallel for BLAST

I recently ran across a issue when I had to run a lot of small blasts (1000+) of a bunch of files against a common database, and was thinking about how to do this efficiently. My first approach was to loop over all the files I wanted to blast and run them with the -num_threads

Continue reading and comment →

Inverse removing files from a directory

One thing I really like about bash is how certain problems can be solved in a multitude of ways. Recently I had the following problem. A directory contain a whole bunch of files like this:

In reality there were thousands of files, and also some non html files, but let’s just keep it simple

Continue reading and comment →

Reversing file permissions

Sometimes there is a need to temporary change the permissions of a bunch a files. And perhaps after that you’d want to restore them to their previous settings. A nice little tool for this is ACL. By first getting all the permissions files in a directory (including sub-directories) using the follwing snipper:

Then one

Continue reading and comment →

Categories