Hi!
How can I extract positions, which are covered by a given read?
What I mean, is that If I use
samtools view "bamfile_name" "chr_name":"pos"-"pos"
, I can extract all reads, which cover position "pos".
But I need to the opposite - I need to get all positions, covered by a specified read, How can I do that?
From bam file I can extract left-most position of the aligned read, its length, specified in SEQ field and CIGAR string. Is it possible to say that covered positions for a given read are [let-most position:let-most position+SEQ-1]?
Thank you! But as far as I see, this will produce a too large tab-delimited file (approx Number of reads * average length of read), I would prefer to parse reads at once, updating every position in covers. For my purposes this can be faster. But I will use this to compare and verify my results, thank you
you can pipe the output: