Description Usage Arguments Details Value Author(s) See Also Examples
Import alignment positions in a SAM file to a GenomicRanges object.
1 | sam2ranges(sam, minq = 10, restricted = NULL)
|
sam |
String containing the path to a SAM file. |
minq |
A numeric scalar specifying the minimum mapping quality score for an alignment. |
restricted |
A character vector containing reference sequences to restrict to. |
We use SAM files as Nanopore CIGAR strings are too long to be handled with the BAM format, and Rsamtools is yet to support CRAM files.
If minq
is set, all reads with a lower mapping quality score are considered to be unmapped.
These are preserved in the output (for consistency with the original FASTQ file) but are assigned reference locations of "*"
.
If restricted
is not NULL
, only alignments to reference sequences in restricted
will be considered as valid.
All other alignments will have their reference locations set to "*"
to indicate that they are to be ignored.
A GRanges is returned containing one entry per alignment record of interest. Each entry is named with the read name, and multiple entries may be present for a read if it aligns to multiple locations (due to multi-mapping or chimerism).
Florian Bieberich, with modifications from Aaron Lun
cigarWidthAlongReferenceSpace
for how the width of each alignment is computed.
1 2 3 4 5 6 7 8 | library(Rsamtools)
fl <- system.file("extdata", "ex1.bam", package="Rsamtools", mustWork=TRUE)
out <- asSam(fl, tempfile(fileext=""))
sam2ranges(out)
sam2ranges(out, restricted="seq1")
sam2ranges(out, minq=80)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.