seqinfo()基本操作

seqinfo()是GenomeInfoDb程序的一个函数,用于获取基因组序列的基本信息,这个函数在运行时需要调用fetchExtendedChromInfoFromUCSC(),因此,需要保持网络连接。基本用法是

1
Seqinfo(genome="")

以获取hg38的基因组信息为例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
> x <- Seqinfo(genome="hg38")
> x
Seqinfo object with 455 sequences (1 circular) from hg38 genome:
seqnames seqlengths isCircular genome
chr1 248956422 FALSE hg38
chr2 242193529 FALSE hg38
chr3 198295559 FALSE hg38
chr4 190214555 FALSE hg38
chr5 181538259 FALSE hg38
... ... ... ...
chrUn_KI270753v1 62944 FALSE hg38
chrUn_KI270754v1 40191 FALSE hg38
chrUn_KI270755v1 36723 FALSE hg38
chrUn_KI270756v1 79590 FALSE hg38
chrUn_KI270757v1 71251 FALSE hg38

> summary(x)
[1] "455 sequences (1 circular) from hg38 genome"

> length(x)
[1] 455

另外,还有如下Accessors可以调用

1
2
3
4
5
6
seqnames(x)
names(x)
seqlevels(x)
seqlengths(x)
isCircular(x)
genome(x)

比如:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
> head(seqnames(x))
[1] "chr1" "chr2" "chr3" "chr4" "chr5" "chr6"
> head(names(x))
[1] "chr1" "chr2" "chr3" "chr4" "chr5" "chr6"
> head(seqlevels(x))
[1] "chr1" "chr2" "chr3" "chr4" "chr5" "chr6"
> head(seqlengths(x))
chr1 chr2 chr3 chr4 chr5 chr6
248956422 242193529 198295559 190214555 181538259 170805979
> head(isCircular(x))
chr1 chr2 chr3 chr4 chr5 chr6
FALSE FALSE FALSE FALSE FALSE FALSE
> head(genome(x))
chr1 chr2 chr3 chr4 chr5 chr6
"hg38" "hg38" "hg38" "hg38" "hg38" "hg38"

也可以直接抽取其中的序列,比如:

1
2
3
4
5
6
> x[c("chrY", "chr3", "chr1")]
Seqinfo object with 3 sequences from hg38 genome:
seqnames seqlengths isCircular genome
chrY 57227415 FALSE hg38
chr3 198295559 FALSE hg38
chr1 248956422 FALSE hg38

或者,甚至可以自己定义:

1
2
3
4
5
6
7
8
9
10
11
> y <- Seqinfo(seqnames=c("chr1", "chr2", "chr3", "chrM"),
seqlengths=c(100, 200, NA, 15),
isCircular=c(NA, FALSE, FALSE, TRUE),
genome="toy")
> y
Seqinfo object with 4 sequences (1 circular) from toy genome:
seqnames seqlengths isCircular genome
chr1 100 NA toy
chr2 200 FALSE toy
chr3 NA FALSE toy
chrM 15 TRUE toy
  • 本文作者:括囊无誉
  • 本文链接: CHIPSEQ/seqinfo/
  • 版权声明: 本博客所有文章均为原创作品,转载请注明出处!
------ 本文结束 ------
坚持原创文章分享,您的支持将鼓励我继续创作!