如何在最新版本的 R 中导入 GTF 文件

问题描述 投票:0回答:1

我正在尝试将 GTF 文件上传到 R 中,但似乎以前的所有方法都失效了。

import(file.gtf)
importgtf(file.gtf)
read.gtf(file.gtf)

每一个,当我尝试安装该功能的包时,我得到“包‘package’不适用于此版本的 R” GTF 文件有更新的方法吗?通常的 read.table() 也不起作用,因为 GTF 文件不是简单的 TSV。

重现性示例

.gtf
https://raw.githubusercontent.com/vsbuffalo/bds-files/master/chapter-09-working-with-range-data/mm_GRCm38.75_protein_coding_genes.gtf

r import bioinformatics
1个回答
3
投票

它对我有用

rtracklayer::readGFF()
:

library(rtracklayer)

g <- readGFF("https://raw.githubusercontent.com/vsbuffalo/bds-files/master/chapter-09-working-with-range-data/mm_GRCm38.75_protein_coding_genes.gtf")

head(g)
#>   seqid         source type   start     end score strand phase
#> 1     1 protein_coding gene 3205901 3671498    NA      -    NA
#> 2     1 protein_coding gene 4343507 4360314    NA      -    NA
#> 3     1 protein_coding gene 4490928 4496413    NA      -    NA
#> 4     1 protein_coding gene 4773206 4785739    NA      -    NA
#> 5     1 protein_coding gene 4807788 4886770    NA      +    NA
#> 6     1 protein_coding gene 4857814 4897909    NA      +    NA
#>              gene_id gene_name    gene_source   gene_biotype
#> 1 ENSMUSG00000051951      Xkr4 ensembl_havana protein_coding
#> 2 ENSMUSG00000025900       Rp1        ensembl protein_coding
#> 3 ENSMUSG00000025902     Sox17        ensembl protein_coding
#> 4 ENSMUSG00000033845    Mrpl15 ensembl_havana protein_coding
#> 5 ENSMUSG00000025903    Lypla1 ensembl_havana protein_coding
#> 6 ENSMUSG00000033813     Tcea1 ensembl_havana protein_coding

创建于 2022 年 11 月 1 日,使用 reprex v2.0.2

© www.soinside.com 2019 - 2024. All rights reserved.