0
resSig <- subset(res, res$padj < 0.05 )  

使用此代码,我创建了一个向量 resSig

head( resSig[ order( resSig$log2FoldChange ), ], 500)

我打印前 500 个基因

 baseMean log2FoldChange     lfcSE      stat       pvalue         padj
                 <numeric>      <numeric> <numeric> <numeric>    <numeric>    <numeric>
ENSG00000096006   1987.812       -14.1212  1.286311 -10.97807  4.87215e-28  5.77837e-25
ENSG00000170477 125694.012       -11.3416  0.519680 -21.82421 1.36677e-105 1.37784e-101
ENSG00000143536   7731.399       -11.2569  1.504429  -7.48249  7.29248e-14  7.90489e-12
ENSG00000016602   5531.968       -10.5545  0.417882 -25.25705 9.47707e-141 1.91077e-136
ENSG00000178690    151.547       -10.4074  1.255369  -8.29030  1.12959e-16  2.01547e-14
...                    ...            ...       ...       ...          ...          ...

现在,我正在尝试将此数据导出到 csv 文件

4

1 回答 1

0

您应该首先将数据存储到数据框中,然后调用 write.csv()

resSig <- subset(res, res$padj < 0.05 )
resSig<-resSig[ order( resSig$log2FoldChange ),]
resSig_top500<-resSig[1:500,]

write.csv(resSig_top500,"resSig_top500.csv")

干杯

于 2021-01-22T10:42:11.773 回答