Hello everybody,
it is possible to get only the reads if the start coordinates is in a region.
When i run this: samtools view cigarN.bam X:68206675-68208264
I get this:
FCC0WRYACXX:1:1103:14931:24492 99 X 68204511 255 59M2530N30M = 68207133 2703 TGTTCTTATTATTATGGTATCATTTATTTGTAAAATTTATAATTGTAAAATACAAACTAGTAAGAACCCTATCAGTGTTGTTTTTGTTT HHJJJJJJJJJJJIJJJFHIJJJJJIJJJJJIJJJJJJJJJJJIJJJJJJJJJJJJJIJJIIIJGGIIIJJJJJJEHFHHHFFFFDEEE PG:Z:MarkDuplicates NH:i:1 HI:i:1 nM:i:1 AS:i:165
FCC0WRYACXX:1:1304:17536:3030 99 X 68206627 255 47M3479N42M = 68210195 3656 TTTCTCATACTGGCAATAGTATTTCACCCAGGATATTCCTAAAGCCCATTTCTCTTGTGTATAGAGATAGCCTTCAATAGTTGGCTGTC HHJJJJIJJJJJJJJIIIJHIJJJIJJJJIJIIJIJJIJJIJJIIIJJJJJJJJJJJGHIGGHIIIJHHGEHFFFDEFFECFCEEEDDD PG:Z:MarkDuplicates NH:i:1 HI:i:1 nM:i:0 AS:i:176
FCC0WRYACXX:1:1106:15737:96571 83 X 68206628 255 46M3479N43M = 68201680 -8516 TTCTCATACTGGCAATAGTATTTCACCCAGGATATTCCTAAAGCCCATTTCTCTTGTGTATAGAGATAGCCTTCAATAGTTGGCTGTCC CCCDDCCCDDDCCEDDEDCDEDB9GFFFFGGDGGIIGGEHFAAGFIGGCGDGFCHGIEGGIIHDBEEGIGIJGIIGIIJJGHIHGEFGH PG:Z:MarkDuplicates NH:i:1 HI:i:1 nM:i:0 AS:i:179
But I want only these reads if the fourth column (start position of the reads) in the region. It is possible to get a solution with samtools ?
in my example the start position of the read FCC0WRYACXX:1:1103:14931:24492 is not in the region X:68206675-68208264.
data: RNA-seq paired-end
No, it is not possible with samtools. You will need to write a script and work with the sam file for your purpose.
Given the enormous amount of tools available it's very likely that something exists for this quite specific problem, without the need of writing a custom script. (Although I agree it could be a solution - it's for sure not the easiest for everyone).