Added support for pre-defined column defn's (e.g., sam, bed, vcf) #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Heng,
I forked your nice -c addition to nawk and added support for pre-defined genomics formats. This allows one to use named columns in nawk without a header line. It changes the behavior of the -c option in that you must specify a "type" (e.g., bed, vcf, sam, etc.). If you just want to use a header line (your original behavior), you use "-c header".
examples:
awk -c header '$start > 11000' test.bed
awk -c bed '$start > 11000' test-noheader.bed
samtools view aln.bam | awk -c sam '$mapq > 60'
samtools view aln.bam | awk -c sam 'and($flag, 2) == 0'
awk -c vcf '$id != "."' test.vcf
Let me know what you think. One idea I had in doing this was that it would be really nice to support zlib compressed files and streams so that this might work with BAM, tabix, etc.