Skip to content

Instantly share code, notes, and snippets.

@rec3141
Created April 6, 2018 00:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rec3141/e50b71c222466dd332de5cce1905f27c to your computer and use it in GitHub Desktop.
Save rec3141/e50b71c222466dd332de5cce1905f27c to your computer and use it in GitHub Desktop.
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`;
echo $hmm
ls -l $INDIR
for seqfile in $INDIR/*fastq.gz; do
basefile=`basename $seqfile .fastq.gz`;
basedir=`dirname $seqfile`
echo $basefile;
# ~/apps/bbmap/reformat.sh in=$seqfile out1=$basedir/$basefile.R1.fasta.gz out2=$basedir/$basefile.R2.fasta.gz fastawrap=0
if [ ! -e $basedir/$basefile.R1.faa.gz ]; then
~/apps/orfm/orfm $basedir/$basefile.R1.fasta.gz | gzip -c > $basedir/$basefile.R1.faa.gz
~/apps/orfm/orfm $basedir/$basefile.R2.fasta.gz | gzip -c > $basedir/$basefile.R2.faa.gz
fi;
~/apps/hmmer/binaries/hmmsearch -o txt/$hmm.$basefile.R1.txt --pfamtblout pfam/$hmm.$basefile.R1.pfam --max -A aln/$hmm.$basefile.R1.aln --tblout tsv/$hmm.$basefile.R1.tsv --notextw --cpu 3 -Z 1000000 -E 0.1 $hmmfile $basedir/$basefile.R1.faa.gz &
~/apps/hmmer/binaries/hmmsearch -o txt/$hmm.$basefile.R2.txt --pfamtblout pfam/$hmm.$basefile.R2.pfam --max -A aln/$hmm.$basefile.R2.aln --tblout tsv/$hmm.$basefile.R2.tsv --notextw --cpu 4 -Z 1000000 -E 0.1 $hmmfile $basedir/$basefile.R2.faa.gz &
wait
done;
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment