Skip to content

Instantly share code, notes, and snippets.

Avatar

R. Eric Collins rec3141

  • University of Alaska Fairbanks
View GitHub Profile
View gist:d3462ad653e3d9ca546a082e90656594
ps -axeo pid,etime,command | awk '$2~/^0[1234]-/ && $0~/COMMAND/ { print $1 }' | xargs kill
@rec3141
rec3141 / foamcount.sh
Created Apr 26, 2018
count hits from FOAM hmmsearch
View foamcount.sh
for FILE in *.tsv; do
LI=`grep -v '^#' $FILE | wc -l`;
SEQS=`gunzip -c ./../NPRB/$F1.faa.gz | grep -c '^>'`;
BP=`gunzip -c ./../NPRB/$F1.faa.gz | grep -v '^>' | wc -b`;
echo -e "$FILE\t$LI" >> target_hits.txt;
done
rm target_hits2.txt;
for FILE in *.tsv; do
@rec3141
rec3141 / get-kos.sh
Created Apr 24, 2018
extract specific HMMs from FOAM
View get-kos.sh
#!/bin/bash
Search=$1
grep -i $Search FOAM-onto_rel1.tsv > $Search.ont
grep -i $Search FOAM-onto_rel1.tsv | cut -f5 > $Search.ko
wc -l $Search.ko
rm $Search.acc
grep -A1 -f $Search.ko ./../FOAM/FOAM-hmm_rel1a_switch.hmm | grep NAME | tr -s ' ' | cut -f2 -d' ' | sort -u > $Search.acc
wc -l $Search.acc
View gist:4c2cadec8e62683636d32ab52146bd7f
head -n1000 18*R1.fastq | grep -v -e '==> 18' -e '^$' | paste - - - - | cut -f2 | sort | uniq -c | sort -rn | head -n1000 | catg > 18s-top1000f.fa
View srun-metaspades.sh
#!/bin/bash
NODE=bio
THREADS=7 #7 for bio, 24 for t1small
MEM=200 #128 max for t1small, 200+ for bio
mkdir -p spades-assembly
DIR='.'
#NPRB_meta_TBS.04.MEIO.R1.trimmed.fastq.gz
for PREFIX in `ls *.trimmed.fastq.gz | cut -f1-3 -d'.' | sort -u `; do
View run-hmmer.sh
#!/bin/sh
# run hmmer using hmm files
#INDIR=$1 #directory to search for .fastq.gz files
INDIR=~/work/NPRB
cd ~/work/hmm
for hmmfile in *.hmm; do
hmm=`basename $hmmfile .hmm`;
@rec3141
rec3141 / gist:24090e42b4487635e8ac9f5c566ff417
Created Feb 9, 2018
get a bibtext file from a text reference list
View gist:24090e42b4487635e8ac9f5c566ff417
while read line; do curl -s "https ://api.crossref.org/works?query=`echo $line | tr -sC '[^a-zA-Z]' '+'`" | tr "," "\n" | tr -d '"\' | grep ^DOI | cut -f2- -d':' | head -n1 | xargs -I{} curl -sLH "Accept: application/x-bibtex" https ://doi.org/{} | grep -v '^\s*[<"]'; done < file
@rec3141
rec3141 / gist:c6f318ae79e9695af6af14d04963f554
Created Feb 9, 2018
bash reference manager: get bibtext from DOIs
View gist:c6f318ae79e9695af6af14d04963f554
while read line; do curl -LH "Accept: application/x-bibtex" https://doi.org/$line | grep -v '^\s*[<"]'; done < dois.txt > dois.bib
@rec3141
rec3141 / gist:b2cc9d192d214687b575ab0cce02f5f8
Created Feb 9, 2018
bash reference manager: get DOI from titles
View gist:b2cc9d192d214687b575ab0cce02f5f8
while read line; do title=`echo $line | sed 's/ /+/g'`; curl -s https://api.crossref.org/works?query.title=$title&rows=1 | tr ',' '\n' | tr -d '"\' | grep ^DOI | cut -f2- -d':'; done < titles.txt > titles.bib