找回密码
 注册
查看: 984|回复: 0

R语言 Rsamtools包 BamFile()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-26 13:27:59 | 显示全部楼层 |阅读模式
BamFile(Rsamtools)
BamFile()所属R语言包:Rsamtools

                                        Maintain SAM and BAM files
                                         维护SAM和BAM的文件

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Use BamFile() to create a reference to a BAM file (and optionally its index). The reference remains open across calls to methods, avoiding costly index re-loading.
使用BamFile()创建的BAM文件(和可选的指数)的参考。参考仍然在呼吁开放的方法,避免了昂贵的指数重新加载。

BamFileList() provides a convenient way of managing a list of BamFile instances.
BamFileList()BamFile实例列表管理提供了一个方便的方式。


用法----------Usage----------



## Constructors

BamFile(file, index=file)
BamFileList(...)

## Opening / closing

## S3 method for class 'BamFile'
open(con, ...)
## S3 method for class 'BamFile'
close(con, ...)

## accessors; also path(), index()

## S4 method for signature 'BamFile'
isOpen(con, rw="")

## actions

## S4 method for signature 'BamFile'
scanBamHeader(files, ...)
## S4 method for signature 'BamFile'
seqinfo(x)
## S4 method for signature 'BamFile'
scanBam(file, index=file, ..., param=ScanBamParam(what=scanBamWhat()))
## S4 method for signature 'BamFile'
countBam(file, index=file, ..., param=ScanBamParam())
## S4 method for signature 'BamFileList'
countBam(file, index=file, ..., param=ScanBamParam())
## S4 method for signature 'BamFile'
filterBam(file, destination, index=file, ...,
    indexDestination=TRUE, param=ScanBamParam(what=scanBamWhat()))
## S4 method for signature 'BamFile'
indexBam(files, ...)
## S4 method for signature 'BamFile'
sortBam(file, destination, ..., byQname=FALSE, maxMemory=512)
## S4 method for signature 'BamFile'
readBamGappedAlignments(file, index=file, use.names=FALSE, param=NULL)
## S4 method for signature 'BamFile'
readBamGappedReads(file, index=file, use.names=FALSE, param=NULL)

## counting
## S4 method for signature 'GRanges,BamFileList'
summarizeOverlaps(
    features, reads, mode, ignore.strand = FALSE, ..., param = ScanBamParam())



参数----------Arguments----------

参数:...
Additional arguments. For BamFileList, this can either be a single character vector of paths to BAM files, or several instances of BamFile objects.
额外的参数。 BamFileList,这可以是单个字符的路径向量BAM文件,或BamFile对象的多个实例。


参数:con
An instance of BamFile.
BamFile实例。


参数:x, file, files
A character vector of BAM file paths (for BamFile) or a BamFile instance (for other methods).
BAM的文件路径的一个特征向量(对于BamFile)BamFile实例(其他方法)。


参数:index
A character vector of indices (for BamFile); ignored for all other methods on this page.
一个特征向量指数(BamFile);忽略此页面上的所有其他方法。


参数:destination
character(1) file path to write filtered reads to.
字符(1)写过滤的文件路径读取。


参数:indexDestination
logical(1) indicating whether the destination file should also be indexed.
逻辑(1)表示目标文件是否也应该被索引。


参数:byQname, maxMemory
See sortBam.
看到sortBam。


参数:param
An optional ScanBamParam instance to further influence scanning, counting, or filtering.
可选ScanBamParam实例,进一步影响扫描,计数,或过滤。


参数:use.names
Construct the names of the returned object from the query template names (QNAME field)? If not (the default), then the returned object has no names.
构建查询模板名称(QNAME领域)返回的对象的名称是什么? (默认),如果没有,则返回的对象没有名称。


参数:rw
Mode of file; ignored.
文件模式;忽略。


参数:reads
A BamFileList that represents the data to be counted by summarizeOverlaps.  
一个BamFileList表示被由summarizeOverlaps计算的数据。


参数:features
A GRanges or a GRangesList object of genomic regions of  interest. When a GRanges is supplied, each row is considered a  feature. When a GRangesList is supplied, each higher list-level is considered a feature. This distinction is important when defining an overlap between a read and a feature. See examples for details.   
一个农庄或GRangesList对象的基因组区域的利益。当格朗提供,每一行被认为是一种功能。当GRangesList提供,每一个更高的列表级别被认为是一种功能。定义读和功能之间的重叠时,这个区别很重要。有关详细信息,请参阅例子。


参数:mode
A function that defines the method to be used when a read overlaps more than one feature. Pre-defined options are "Union", "IntersectionStrict", or "IntersectionNotEmpty" and are designed after the counting modes available in the HTSeq package by Simon Anders (see references).   
一个函数定义要使用的方法时读多个功能重叠。预先定义的选项是“联盟”,“IntersectionStrict”,或“IntersectionNotEmpty”的设计后,由西蒙·安德斯HTSeq包(参见参考资料)中的计数模式。

"Union" : (Default) Reads that overlap any portion of exactly one  feature are counted. Reads that overlap multiple features are  discarded.   
“联盟”:(默认)读取重叠的部分计算任何一个功能。读取该重叠多种功能都将被丢弃。

"IntersectionStrict" : A read must fall completely "within" the feature to be counted. If a read overlaps multiple features but falls "within" only one, the read is counted for that feature. If the read is "within" multiple features, the read is discarded.   
“IntersectionStrict”:“读”必须完全属于“内”的计算功能。如果读的多种功能重叠,但属于“内的”只有一个,读计数该功能。如果读的是“内”多种功能,读取被丢弃。

"IntersectionNotEmpty" : A read must fall in a unique disjoint region of a feature to be counted. When a read overlaps multiple features, the features are partitioned into disjoint intervals.  Regions that are shared between the features are discarded leaving only the unique disjoint regions. If the read overlaps one of  these remaining regions, it is assigned to the feature the unique disjoint region came from.  
“IntersectionNotEmpty”:一个只读必须属于一个以计数的功能独特的相交区域。当读重叠多种功能,功能划分为不相交的时间间隔。功能之间共享的区域将被丢弃,只留下了独特的不相交的区域。如果读的重叠,这些剩余的区域之一,它被分配的功能来自独特的相交区域。


参数:ignore.strand
A logical value indicating if strand should be considered when matching.  
匹配时,应被视为一个逻辑值,指出如果链。


类的对象----------Objects from the Class----------

Objects are created by calls of the form BamFile().
对象的创建形式BamFile()检测。


领域----------Fields----------

The BamFile class inherits fields from the RsamtoolsFile class.
BamFile类继承RsamtoolsFile类的字段。


函数和方法----------Functions and methods----------

BamFileList inherits methods from RsamtoolsFileList and SimpleList.
BamFileList继承RsamtoolsFileList和SimpleList的方法。

Opening / closing:
打开/关闭:




open.BamFile Opens the (local or remote) path and index (if bamIndex is not character(0)),
open.BamFile打开(本地或远程)path和index(bamIndex不character(0))




close.BamFile Closes the BamFile con; returning (invisibly) the updated BamFile. The instance may be
close.BamFile关闭BamFilecon;返回(不可见)更新BamFile。实例可能

Accessors:
存取:




path Returns a character(1) vector of BAM path names.
路径返回一个字符的BAM路径名(1)向量。




index Returns a character(1) vector of BAM index path
索引返回字符的BAM的索引路径(1)向量

Methods:
方法:




scanBamHeader Visit the path in path(file), returning the information contained in the file header; see
scanBamHeaderpath(file),返回在文件头中包含的信息的访问路径;




seqinfo Visit the path in path(file), returning a Seqinfo instance containing information on
path(file)seqinfo访问路径,返回一个Seqinfo实例,其中包含的信息




scanBam Visit the path in path(file), returning the
scanBam访问的路径,在path(file)返回




countBam Visit the path(s) in path(file), returning the result of countBam applied to the specified
countBam访问,返回的结果path(file)应用到指定的路径(S)countBam




filterBam Visit the path in path(file), returning the result of filterBam applied to the specified
filterBam访问路径path(file),filterBam应用到指定的返回结果




indexBam Visit the path in path(file), returning the result of indexBam applied to the specified
indexBam访问路径path(file),indexBam应用到指定的返回结果




sortBam Visit the path in path(file), returning the
sortBam访问的路径,在path(file)返回




readBamGappedAlignments, readBamGappedReads Visit the path in path(file), returning the result of readBamGappedAlignments or readBamGappedReads applied to the specified path.
readBamGappedAlignments,参观readBamGappedReadspath(file)路径返回readBamGappedAlignments或readBamGappedReads应用到指定的路径的结果。




show Compactly display the object.
显示紧显示对象。


作者(S)----------Author(s)----------


Martin Morgan and Marc Carlson



参见----------See Also----------

The GenomicRanges package is where the summarizeOverlaps method originates.
GenomicRanges包summarizeOverlaps方法的起源。


举例----------Examples----------



fl <- system.file("extdata", "ex1.bam", package="Rsamtools")
bf &lt;- open(BamFile(fl))        # implicit index[隐式指数]
bf
identical(scanBam(bf), scanBam(fl))

rng <- GRanges(c("seq1", "seq2"), IRanges(1, c(1575, 1584)))

## repeatedly visit 'bf'[#多次访问“BF”]
sapply(seq_len(length(rng)), function(i, bamFile, rng) {
    param <- ScanBamParam(which=rng[i], what="seq")
    bam <- scanBam(bamFile, param=param)[[1]]
    alphabetFrequency(bam[["seq"]], baseOnly=TRUE, collapse=TRUE)
}, bf, rng)


##---------------------------------------------------------------------------##[#------------------------------------------------- --------------------------#]
## How to use summarizeOverlaps with a BamFileList object.[#如何使用与BamFileList对象summarizeOverlaps。]
fls = list.files(system.file("extdata",package="GenomicRanges"),
                 recursive=TRUE, pattern="*bam$", full=TRUE)
bfs <- BamFileList(fls)

## "features" will be the argument for an "annotations" object (GRanges[#“功能”将是一个“注释”的对象(农庄参数]
## or GRangesList object.[#或GRangesList的对象。]
group_id <- c("A", "B", "C", "C", "D", "D", "E", "F", "G", "H", "H")
features <- GRanges(
    seqnames = Rle(c("chr2L", "chr2R", "chr2L", "chr2R", "chr2L", "chr2R",
        "chr2L", "chr2R", "chr2R", "chr3L", "chr3L")),
    strand = strand(rep("+", length(group_id))),
    ranges = IRanges(
        start=c(1000, 2000, 3000, 3600, 7000, 7500, 4000, 4000, 3000, 5000, 5400),
        width=c(500, 900, 500, 300, 600, 300, 500, 900, 500, 500, 500)),
   DataFrame(group_id)
)
## Then call the method:[#然后调用该方法:]
summarizeOverlaps(features, bfs, mode = Union, ignore.strand=TRUE)



转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-25 03:43 , Processed in 0.022658 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表