1

我正在尝试制作用于分析 RNA-seq 数据的 ExpressionSet 文件。我只是有一个称为“exprs”的计数矩阵,一个称为“特征”的特征(基因)的数据框和一个称为“表型”的样本属性的数据框。这是我运行的将所有数据导入 R 并创建 Expressionset 的单个“对象”的代码。但它返回一个错误。

## DE object creation
### importing 3 data files to R first
### Count MATRIX

    dataDirectory <- system.file("extdata", package="Biobase")

    exprs <- as.matrix(read.table("counts.txt", sep = "\t", header = TRUE, row.names = 1, as.is = TRUE))
    class(exprs)
    head.matrix(exprs)
    str(exprs)
Output: 
 num [1:40220, 1:20] 12.39 6.37 11.18 10.72 10.65 ...
 - attr(*, "dimnames")=List of 2
  ..$ : chr [1:40220] "ENSG00000000003" "ENSG00000000005" "ENSG00000000419" "ENSG00000000457" ...
  ..$ : chr [1:20] "sample_1379_PNC" "sample_1360_PA_A" "sample_1412_PNB" "sample_1405_PA_A" ...

### Features data which contains gene names and symbols for each ensembl id (gene) -> DATAFRAME

    features <- read.csv("features.txt", sep = "\t")
    rownames(features) <- features$ID
    features$ID <- NULL
    str(features)
Output:
'data.frame':   40223 obs. of  2 variables:
 $ Symbol : chr  "TSPAN6" "TNMD" "DPM1" "SCYL3" ...
 $ Symbol2: chr  "TSPAN6" "TNMD" "DPM1" "SCYL3" ...
### Phenotype data which contains attributes for each sample -> DATAFRAME 

    phenotypes <- read.csv("phenotypes.txt", sep = "\t")
    rownames(phenotypes) <- phenotypes$X1
    phenotypes$X1 <- NULL
    str(phenotypes)
Output:
'data.frame':   20 obs. of  2 variables:
 $ condition: chr  "normal" "tumor" "normal" "tumor" ...
 $ type     : chr  "mono" "mono" "poly" "mono" ...
# Load package

    library(Biobase)


# Create ExpressionSet object

    eset <- ExpressionSet(assayData = exprs,
                          phenoData = annotatedDataFrameFrom(phenotypes),
                          featureData = annotatedDataFrameFrom(features))

Output: 

Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘annotatedDataFrameFrom’ for signature ‘&quot;character"’
4

0 回答 0