Description Usage Arguments Author(s) See Also Examples
The function extractRanges
takes an opened and indexed
bamReader object, a data.frame
containg range data, and an ouptut
filename.
From the opened BAM file, aligns in the depicted ranges are transfered
into a temporary BAM-file.
The new file will be sorted. The sorted file will be indexed.
1 | extractRanges(object,ranges,filename,complex=FALSE,header,idxname)
|
object |
bamReader. Must be opened. Index must be initialized. |
ranges |
data.frame. Must contain columns 'seqid','start','end'. Each line represents a range on the reference genome for which aligns are extracted. |
filename |
Character. Name of output BAM-file. The filename will be modified. The modified filename will have suffix '.bam'. |
complex |
(default=FALSE) Logical. When TRUE, only aligns with nCigar > 1 are copied. When FALSE, all aligns in the depicted ranges are copied. |
header |
(Optional) bamHeader. It's possible to provide a
|
idxname |
(Default='filename'.bai) character. The name for the index file. |
Wolfgang Kaisers
bamReader
1 2 3 4 5 6 7 8 9 | bam<-system.file("extdata","accepted_hits.bam",package="rbamtools")
reader<-bamReader(bam,idx=TRUE)
# Extract data for HLHL17 gene:
seqid<-"chr1"
start<-895967
end<-901099
gene_name<-"HLHL17" # (optional)
ranges<-data.frame(seqid=seqid,start=start,end=end,gene_name=gene_name)
extractRanges(reader,ranges=ranges,filename="new_file.bam")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.