Michael Grünstäudl (Gruenstaeudl), PhD

Researcher at the Freie Universität Berlin

Archiv der Kategorie 'one-liners'

One-liner: Interleaved to deinterleaved FASTA

Quick, de-interleave it! There are one-liners that never get old. This is one of them. $ perl -MBio::SeqIO -e ‚my $seqin = Bio::SeqIO-> new(-fh => \*STDIN, -format => ‚fasta‘); while (my $seq = $seqin-> next_seq) { print „>“, $seq-> id, „\n“, $seq-> seq, „\n“; }‘ < interleaved.fasta > deinterleaved.fasta

Weiter lesen...

Few-liner: Batch download of DNA sequences from NCBI

The wonders of entrez Today I found myself in need of a script to download dozens of DNA sequences submitted to NCBI Nucleotide. The sequences in questeion were stores in file input.txt. $ cat input.txt Liriope_muscari_USACult,JX080424 Dracaena_adamii_IVORYCOAST,JX080436 … Here is how I did it: $ INF=input.txt $ for line in $(cat $INF); do SEQNAME=$(echo „$line“ […]

Weiter lesen...

Bioinformatic spring cleaning – Part II

An improved few-liner to keep the data compressed If you wish to recusively loop through a folder and its nested subfolders and automatically gzip all files greater than 1 GB, the following few-liner is for you: for file in $(LANG=C find . -size +1G -type f -print); do if [[ ! $file == *.gzip ]]; […]

Weiter lesen...

Bioinformatic spring cleaning – Part I

A short one-liner to keep the data compressed One of the bash one-liners that I use after every successful project, yet never remember when needed, is for the simple task of looping through your folders, tar-zipping them and then removing the original folders. for i in $(ls -d */); do tar czf ${i%%/}.tar.gz $i && […]

Weiter lesen...

Alignment Phy2Nex few-liner

Alignment file format conversion for the efficient – Part II Today, I needed to convert a series of alignments, which were stored in the phylip format, into the common nexus format. The output DNA alignment hereby needed to be of sequential format (i.e., non-interleaved). In February 2017, I had already written a few-liner to conduct […]

Weiter lesen...

Trees Nex2Phy one-liner

Tree file format conversion for the efficient Today, I needed to convert a series of phylogenetic trees, which were stored in the common nexus format, into newick format. In order to do this efficiently, I wrote the following one-liner. Change into a directory containing your nexus-formatted tree files, then enter in your bash shell: R […]

Weiter lesen...