Skip to content

Instantly share code, notes, and snippets.

@adomingues
Last active August 29, 2015 14:14
Show Gist options
  • Save adomingues/c5a7a9aec382ef9ceb23 to your computer and use it in GitHub Desktop.
Save adomingues/c5a7a9aec382ef9ceb23 to your computer and use it in GitHub Desktop.
A simple way of converting bam files to fasta for testing purposes.
bedtools bamtofastq -i $bam -fq temp.fq
awk '{if(NR%4==1) {printf(">%s\n",substr($0,2));} else if(NR%4==2) print;}' temp.fq > ${bam/.bam/.fa}
rm temp.fp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment