One line of the input file:
m54071222/4194368/0_197 4 * 0 255 * * 0 0 AAGAGGAAGGGGGAGAGAGAGGAGGAGAGGGGGGAAGAGGTTGGGATGGAAAATAGGTGGTTAGAGGGAGAAAGG !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! np:i:1 qe:i:197 qs:i:0 rq:f:0 BS:Z:ATGGCCAATTGCAGAA BQ:Z:JJJKKKKKKKKLLLLL zm:i:4194368 RG:Z:1f1bf15c sc:A:L sz:A:N
I want to extract certain tag (BS and BQ in this example) in each read of sam file and pass it to a new file.
I can do that with pysam. But is it possible to do this job with one line linux command? Tool that accept stdin and stdout operating will be better.
There is build in method getTag
in bamtools, however, it is only for filtering reads.
The expect output:
@m54071222/4194368/0_197
ATGGCCAATTGCAGAA
+
JJJKKKKKKKKLLLLL
Wow, that is a powerful tool. Although it looks like a one-line python command that wrap pysam...
it wraps htsjdk
still not perfect... If the tag is not exist, the output will but "null".