Skip to content

Instantly share code, notes, and snippets.

View laxeye's full-sized avatar
🐢
Moving forward

Aleksei Korzhenkov laxeye

🐢
Moving forward
View GitHub Profile
@laxeye
laxeye / multiprodigal.sh
Created November 21, 2023 11:14
Use find and xargs to predict ORFs with Prodigal on multiple threads
#!/bin/bash
# Prodigal multiprocessing using find and xargs, good for thousand of files.
# Auto-create folder "../prodigal" with mkdir.
# Find all files between 200 Kb and 20 Mb with "fna" extension in current folder.
# Xargs creates 64 Prodigal tasks at once.
# Prodigal will place output files to folder "../prodigal".
mkdir -p ../prodigal
find . -size +200k -size -20M -name '*.fna' | xargs -P 64 -t -I bin \
prodigal -q -i bin -f gff -a ../prodigal/bin.faa -d ../prodigal/bin.fasta -o ../prodigal/bin.gff
@laxeye
laxeye / fix-paste.sh
Created October 1, 2021 13:45
Fix multiline paste in python
# The recipe was taken from https://github.com/Homebrew/homebrew-core/issues/68193#issuecomment-753628592
#
# From time to time I face the next problem:
# When I paste several lines to Python's interactive interpreter
# they hadn't been executed one by one an throw an error:
# multiple statements found while compiling a single statement
# There is a fast solution, run it and restart the terminal.
echo "set enable-bracketed-paste off" >> ~/.inputrc
perl -pne '@a=$_=~/(\d+\.\d+)/g; foreach my $i(@a){$k=100-$i;$_=~s/$i/$k/}' matrix > matrix.2
@laxeye
laxeye / 16s-retreive.sh
Last active February 1, 2022 12:19
16S extraction from genomes
# Requires Infernal and esl-sfetch from Easel (part of HMMER and Infernal)
# https://github.com/EddyRivasLab/easel
# With little change of article:
# https://cryptogenomicon.org/2011/05/03/extracting-hmmer-results-to-sequence-files-easel-miniapplications/
# Don't forget to change the path to your covariance model!
CM_PATH="/somewhere/RF00177.cm"
for i in *fna; do esl-sfetch --index $i; \
cmsearch -o /dev/null --tblout /dev/stdout -E 1e-10 "$CM_PATH" "$i" | \
grep -v "^#" | awk '{print "'"${i/.fna/}"'""_"$1"_16S",$8,$9,$1}' | head -1 | \