Bioawk

Heng Li (author of bwa, samTools..) made a awk version supplemented with bioinoformatic centric functions.
https://github.com/lh3/bioawk
Some examples
Reverse Complement of FASTA

awk -c fastx '{print ">"$name;print revcomp($seq)}' sequence.fasta
Create FASTA from SAM
   samtools view aln.bam | \
awk -c sam '{s=$seq; if(and($flag, 16)) {s=revcomp($seq)} print ">"$qname"\n"s}'

Get the mean Phred quality score from FASTQ:

   awk -c fastx '{print ">"$name;print meanqual($qual)}' seq.fq.gz

Detailed documentation is here.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s