Skip to content

Instantly share code, notes, and snippets.

@cyklee
Created April 12, 2018 05:35
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 cyklee/72f183f645ade533037204d54220ad13 to your computer and use it in GitHub Desktop.
Save cyklee/72f183f645ade533037204d54220ad13 to your computer and use it in GitHub Desktop.
Converts GFF file from Prokka to GTF for htseq-count
#!/bin/bash
infile=$1
if [ "$infile" == "" ] ; then
echo "Usage: prokkagff2gtf.sh <PROKKA gff file>"
exit 0
fi
grep -v "#" $infile | grep "ID=" | cut -f1 -d ';' | sed 's/ID=//g' | cut -f1,4,5,7,9 | awk -v OFS='\t' '{print $1,"PROKKA","CDS",$2,$3,".",$4,".","gene_id " $5}'
# Use indexed & sorted bam file from anvi-init-bam (or default outut from samtools sort)
# htseq-count -r pos -t CDS -f bam Sample01_indexed.bam test.gtf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment