How to find the end position of a read?
3
0
Entering edit mode
Frocha ▴ 20
@frocha-12039
Last seen 6.6 years ago

I have a .sam file (for single-end reads) and I wish to find the end position of each read. I noticed that I can do that using Rsamtools if the file is a .bam file. However, I wish to do it directly on .sam file. How should I do? (using cigar value?)

Thanks!

 

rsamtools alignment cigar • 2.6k views
ADD COMMENT
1
Entering edit mode
@martin-morgan-1513
Last seen 4 months ago
United States

You could read the start and cigar from the SAM file using standard R or other (e.g., readr) facilities (probably important to read only the relevant columns, for performance) then use GenomicAlignments::cigarWidthAlongReferenceSpace() and similar.

ADD COMMENT
0
Entering edit mode

One more question: what the use of N.regions.removed argument in the function GenomicAlignments::cigarWidthAlongReferenceSpace() ?  

 

ADD REPLY
0
Entering edit mode
@james-w-macdonald-5106
Last seen 9 hours ago
United States

If  you want to parse a text file, you are probably better off just using perl or awk. You could do this in R, but it's not really designed for fast parsing of text files.

ADD COMMENT
0
Entering edit mode
Frocha ▴ 20
@frocha-12039
Last seen 6.6 years ago

Thanks for both answers!

ADD COMMENT

Login before adding your answer.

Traffic: 547 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6