Michael Grünstäudl (Gruenstaeudl), PhD

Researcher at the Freie Universität Berlin

Archiv der Kategorie 'one-liners'

Setting burn-in and combining posterior tree distributions using awk and sed

Efficiency on the UNIX shell I often find myself manually removing a set of phylogenetic trees from a posterior tree distribution in order to set a burn-in and then combining the post-burnin trees of the individual runs. This action can be done very efficiently using awk on a UNIX shell: inf1=Mrbayes_test.run1.t inf2=Mrbayes_test.run2.t tmpf1=${inf1%.t*}_postBurnin.tre tmpf2=${inf2%.t*}_postBurnin.tre outf=${inf1%.run1.t*}_combined_postBurnin.tre […]

Weiter lesen...

Quick info parsing from GenBank accessions

Taking the essence. Have you ever found yourself browsing through individual sequence records of the NCBI GenBank database and wishing that you could extract only the metadata information of a record (e.g., authors, publication status, taxonomy), but not the feature table of a record or the sequence itself? With the help of Entrez Direct and […]

Weiter lesen...

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   Update 28-Jan-2019: Over time, I […]

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...