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

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

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

                                         Import, count, index, and other operations on ‘BAM’ (binary alignment) files.
                                         进口,数量,索引,咣当(二进制对齐)文件的其他业务。

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

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

Import binary "BAM" files into a list structure, with facilities for selecting what fields and which records are imported.
导入列表结构的二进制文件咣当,选择哪些领域,哪些记录是进口设备。


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



scanBam(file, index=file, ..., param=ScanBamParam(what=scanBamWhat()))

countBam(file, index=file, ..., param=ScanBamParam())

scanBamHeader(files, ...)
## S4 method for signature 'character'
scanBamHeader(files, ...)

asBam(file, destination, ...)
## S4 method for signature 'character'
asBam(file, destination, ...,
    overwrite=FALSE, indexDestination=TRUE)

filterBam(file, destination, index=file, ...)
## S4 method for signature 'character'
filterBam(file, destination, index=file, ...,
    indexDestination=TRUE, param=ScanBamParam(what=scanBamWhat()))
   
sortBam(file, destination, ...)
## S4 method for signature 'character'
sortBam(file, destination, ..., byQname=FALSE, maxMemory=512)

indexBam(files, ...)
## S4 method for signature 'character'
indexBam(files, ...)




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

参数:file
The character(1) file name of the "BAM" ('SAM' for asBam) file to be processed.
(1)字符文件名的咣当(萨姆asBam)文件进行处理。


参数:files
The character() file names of the "BAM" file to be processed.
咣当文件的文件名字符()处理。


参数:index
The character(1) name of the index file of the 'BAM' file being processed; this is given without the '.bai' extension.
字符(1)咣当正在处理的文件的索引文件的名称,这是没有的“白”。扩展。


参数:destination
The character(1) file name of the location where the sorted or filtered output file will be created. For asBam and sortBam this is without the “.bam” file suffix.
(1)字符文件名排序或过滤后的输出文件将被创建的位置。 asBam和sortBam这是没有“。咣”的文件后缀。


参数:...
Additional arguments, passed to methods.
额外的参数,传递给方法。


参数:overwrite
A logical(1) indicating whether the destination can be over-written if it already exists.
逻辑(1)目标是否可以超额书面如果它已经存在。


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


参数:byQname
A logical(1) indicating whether the sorted destination file should be sorted by Query-name (TRUE) or by mapping position (FALSE).
逻辑(1)指示是否应查询名称(TRUE)或映射位置(FALSE)排序排序的目标文件。


参数:maxMemory
A numerical(1) indicating the maximal amount of memory (in MB) that the function is allowed to use.
(1)显示功能,允许使用的最大内存量(MB)一个数值。


参数:param
An instance of ScanBamParam. This influences what fields and which records are imported.
ScanBamParam实例。这对哪些领域和记录都是进口的。


Details

详情----------Details----------

The scanBam function parses binary BAM files; text SAM files can be parsed using R's scan function, especially with arguments what to control the fields that are parsed.
scanBam函数解析二进制的BAM文件文本SAM文件可以使用R的scan功能,尤其是带参数的解析,what控制解析的领域。

countBam returns a count of records consistent with param.
countBam返回一个param记录的计数。

scanBamHeader visits the header information in a BAM file, returning for each file a list containing elements targets and text, as described below. The SAM / BAM specification does not require that the content of the header be consistent with the content of the file, e.g., more targets may be present that are represented by reads in the file.
scanBamHeader访问的BAM文件头信息,为每个文件返回一个列表,其中包含元素targets和text,如下所述。的SAM / BAM的规范并不要求与内容相一致的文件,如头的内容,可能会出现更多的目标,是由读取文件中的代表。

asBam converts 'SAM' files to 'BAM' files, equivalent to the samtools view -Sb file > destination. The 'BAM' file is sorted and an index created on the destination (with extension '.bai') when indexDestination=TRUE.
asBam信徒萨姆文件咣当文件,相当于samtools view -Sb file > destination。 咣当文件进行排序和索引创建目标(带有扩展名“。白族)indexDestination=TRUE。

filterBam parses records in file satisfying the bamWhich of param, writing each record satisfying the bamFlag and bamSimpleCigar criteria of param to file destination. An index file is created on the destination when indexDestination=TRUE.
filterBam分析中file满足bamWhich,写满足param和bamFlagbamSimpleCigar了标准,每个记录param的的记录文件destination。目的地上创建一个索引文件时indexDestination=TRUE。

sortBam sorts the BAM file given as its first argument, analogous to the “samtools sort” function.
sortBam各种各样的BAM文件作为其第一个参数,类似的的“samtools排序”功能。

indexBam creates an index for each BAM file specified, analogous to the "samtools index" function.
indexBam创建一个索引,每个BAM文件中指定的,类似于“samtools指数的功能。

Details of the ScanBamParam class are provide on its help page; several salient points are reiterated here. ScanBamParam can contain a field what, specifying the components of the BAM records to be returned. Valid values of what are available with scanBamWhat. ScanBamParam can contain an argument which that specifies a subset of reads to return. This requires that the BAM file be indexed, and that the file be named following samtools convention as <bam_filename>.bai. ScanBamParam can contain an argument tag to specify which tags will be extracted.
ScanBamParam类的细节上提供的帮助页面;几个要点在这里重申。 ScanBamParam可以包含一个字段what指定的BAM要返回记录的组成部分。 what有效值与scanBamWhat。 ScanBamParam可以包含一个参数which指定的一个子集,读取返回。这就要求,BAM文件索引,文件被命名为<bam_filename>.baisamtools公约。 ScanBamParam可以包含一个参数tag指定标签将被提取。


值----------Value----------

The scanBam,character-method returns a list of lists. The outer list groups results from each Ranges list of bamWhich(param); the outer list is of length one when bamWhich(param) has length 0. Each inner list contains elements named after scanBamWhat(); elements omitted from bamWhat(param) are removed. The content of non-null elements are as follows, taken from the description in the samtools API documentation:
scanBam,character-method返回一个列表。外部列表组结果从每个Ranges列表bamWhich(param);外部列表是一个长度的时候bamWhich(param)长度为0。每个内部列表包含后scanBamWhat();bamWhat(param)被删除省略的元素命名的元素。非空元素的含量,在samtools API文档的说明如下:

qname: This is the QNAME field in SAM Spec v1.4. The query name, i.e., identifier, associated with the read.
QNAME:这是在SAM规格V1.4的QName领域。查询的名称,即,标识,与读。

flag: This is the FLAG field in SAM Spec v1.4. A numeric value summarizing details of the read. See ScanBamParam and the flag argument, and scanBamFlag().
标志:这是在SAM规格V1.4的标志字段。一个数值,总结读的细节。看到ScanBamParamflag的说法,和scanBamFlag()。

rname: This is the RNAME field in SAM Spec v1.4. The name of the reference to which the read is aligned.
RNAME:这是在SAM规格V1.4 RNAME领域。读参考哪些名称是一致的。

strand: The strand to which the read is aligned.
钢绞线:对齐读的链。

pos: This is the POS field in SAM Spec v1.4. The genomic coordinate at the start of the alignment. Coordinates are "left-most", i.e., at the 3' end of a read on the '-' strand, and 1-based. The position excludes clipped nucleotides, even though soft-clipped nucleotides are included in seq.
POS:这是在SAM规格V1.4的POS领域。在基因组坐标对齐开始。坐标是“最左边的”,即在读上3结束 - 链,1。位置排除,即使裁剪核苷酸软裁剪核苷酸的是包含在seq。

qwidth: The width of the query, as calculated from the cigar encoding; normally equal to the width of the query returned in seq.
qwidth:查询的宽度,从cigar编码计算;查询的宽度通常等于seq返回。

mapq: This is the MAPQ field in SAM Spec v1.4. The MAPping Quality.
mapq:这是在SAM规格V1.4 MAPQ领域。测绘质量。

cigar: This is the CIGAR field in SAM Spec v1.4. The CIGAR string.
CIGAR:这是在SAM规格V1.4的CIGAR领域。CIGAR字符串。

mrnm: This is the RNEXT field in SAM Spec v1.4. The reference to which the mate (of a paired end or mate pair read) aligns.
mrnm:这是在SAM规格V1.4 RNEXT领域。队友(配对年底或配偶对读)对齐参考。

mpos: This is the PNEXT field in SAM Spec v1.4. The position to which the mate aligns.
业务总:这是在SAM规格V1.4 PNEXT领域。队友对齐位置。

isize: This is the TLEN field in SAM Spec v1.4. Inferred insert size for paired end alignments.
isize:这是在SAM规格V1.4 TLEN领域。推断插入片段大小为配对的结束路线。

seq: This is the SEQ field in SAM Spec v1.4. The query sequence, in the 5' to 3' orientation. If aligned to the minus strand, it is the reverse complement of the original sequence.
SEQ:这是在SAM规格V1.4的SEQ域。查询序列,在5到3方向。如果对齐的负链,它是原始序列的反向互补。

qual: This is the QUAL field in SAM Spec v1.4. Phred-encoded, phred-scaled base quality score, oriented as seq.
资格赛:这是在SAM规格V1.4 QUAL领域。编码PHRED,PHRED规模的碱基质量得分,面向seq。

scanBamHeader returns a list, with one element for each file named in files. The list contains two element. The targets element contains target (reference) sequence lengths. The text element is itself a list with each element a list corresponding to tags (e.g., "@SQ") found in the header, and the associated tag values.
scanBamHeader返回一个列表,在files命名每个文件的一个元素。该列表包含两个元素。 targets元素包含目标(参考)序列的长度。 text元素本身就是一个列表中每个元素列表中相应的标签(例如,@倚“)在头,以及相关的标记值。

asBam returns the file name of the BAM file.
asBam返回的BAM文件的文件名。

sortBam returns the file name of the sorted file.
sortBam返回的文件名排序文件。

indexBam returns the file name of the index file created.
indexBam返回的索引创建的文件的文件名。

filterBam returns the file name of the destination file created.
filterBam返回的创建目标文件的文件名。


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



Martin Morgan &lt;mtmorgan@fhcrc.org&gt;.  Thomas Unterhiner
&lt;thomas.unterthiner@students.jku.at&gt; (<code>sortBam</code>).




参考文献----------References----------



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

ScanBamParam, scanBamWhat, scanBamFlag
ScanBamParam,scanBamWhat,scanBamFlag


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



fl <- system.file("extdata", "ex1.bam", package="Rsamtools")

res0 &lt;- scanBam(fl)[[1]] # always list-of-lists[始终名单列表]
names(res0)
length(res0[["qname"]])
lapply(res0, head, 3)
table(width(res0[["seq"]])) # query widths[查询宽度]
table(res0[["qwidth"]], useNA="always") # query widths derived from cigar[从CIGAR的查询宽度]
table(res0[["cigar"]], useNA="always")
table(res0[["strand"]], useNA="always")
table(res0[["flag"]], useNA="always")

which <- RangesList(seq1=IRanges(1000, 2000),
                    seq2=IRanges(c(100, 1000), c(1000, 2000)))
p1 <- ScanBamParam(which=which, what=scanBamWhat())
res1 <- scanBam(fl, param=p1)
names(res1)
names(res1[[2]])

p2 <- ScanBamParam(what=c("rname", "strand", "pos", "qwidth"))
res2 <- scanBam(fl, param=p2)
               
p3 <- ScanBamParam(flag=scanBamFlag(isMinusStrand=FALSE))
length(scanBam(fl, param=p3)[[1]])

sorted <- sortBam(fl, tempfile())

## map values(which) to output, e.g., of countBam[映射值#()输出,例如,countBam]
gwhich <- as(which, "GRanges")[c(2, 1, 3)]
values(gwhich)[["OriginalOrder"]] <- 1:3
cnt <- countBam(fl, param=ScanBamParam(which=gwhich))
cntVals <- unlist(split(values(gwhich), seqnames(gwhich)))
cbind(cnt, as.data.frame(cntVals))


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


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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-1-25 03:53 , Processed in 0.028299 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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