教小高改bug

  博客园 :: 首页 :: 博问 :: 闪存 :: :: 联系 :: :: 管理 ::

0. 准备

setwd("D:/R/CHOL")
rm(list = ls())  
load(file = "step1output.Rdata")
library(stringr)

 1. group_list(实验分组)

第一类,现成的某一列或在某列中包含(少见)

group_list = pd$title

第二类,自己生成(样本少,排列整齐)(较少见)

group_list = c(rep("control",times=3),rep("treat",times=3))
group_list

第三类,ifelse(样本多,排列不整齐)(常见)

library(stringr)
group_list = ifelse(str_detect(pd$title,"Control"),"control","treat")
    #table(group_list)

2. “Control”注意大小写,与数据框中相同。若是根据其他字符分类,注意灵活变通。(需修改)

3. 查看是否有误。或对照原数据或网页上对该数据集的介绍。

设置参考水平,对照在前,处理在后

group_list = factor(group_list,
                    levels = c("control","treat"))

若不指定level,则level以首字母进行排序。


2. ids(芯片注释)

方法1,BioconductorR包(推荐)

gpl 
if(!require(hugene10sttranscriptcluster.db))BiocManager::install("hugene10sttranscriptcluster.db")
library(hugene10sttranscriptcluster.db)
ls("package:hugene10sttranscriptcluster.db")
ids <- toTable(hugene10sttranscriptclusterSYMBOL)
head(ids)
  #ids = ids[!duplicated(ids$symbol),]

1. 得到GPL编号后,在网站 http://www.bio-info-trainee.com/1399.html 中查找GPL对应的BioconductorR包。

2. 判断式安装R包(前缀 + .db)。在RStudio中修改代码时最好使用"Ctrl + F"查找并全部替换。(需修改)

3. 加载该R包

4. 查看R包里有哪些函数/数据。

5. 使用“toTable”函数提取R包中的SYMBOL数据。

6. 查看ids:探针id和基因symbol的对应关系。

7. 若有多个探针对应一个基因的情况,则按照基因去重复(随机保留/求最大值/求平均值)。一般只保留第一次出现的基因。

  (!duplicated(ids$symbol):第二次出现的基因返回的结果为FALSE。)后续处理数据时会进行去重复操作,这里只展示去重复思想。

对于一个探针对应多个基因(非特异性探针)的情况,注释文件中已去除,不需要管。

ids可能会比exp少,因为有些探针目前无法匹配到基因。

方法2,读取gpl页面的soft文件,按列取子集

使用IDM

方法3,官网下载
方法4,自主注释


3. 保存数据

save(exp,group_list,ids,file = "step2output.Rdata")

  http://www.bio-info-trainee.com/1399.html  用R获取芯片探针与基因的对应关系三部曲-bioconductor

GPL对应的BioconductorR包:(摘自上述网站)

      gpl           organism                  bioc_package

1     GPL32       Mus musculus                        mgu74a
2     GPL33       Mus musculus                        mgu74b
3     GPL34       Mus musculus                        mgu74c
6     GPL74       Homo sapiens                        hcg110
7     GPL75       Mus musculus                     mu11ksuba
8     GPL76       Mus musculus                     mu11ksubb
9     GPL77       Mus musculus                     mu19ksuba
10    GPL78       Mus musculus                     mu19ksubb
11    GPL79       Mus musculus                     mu19ksubc
12    GPL80       Homo sapiens                        hu6800
13    GPL81       Mus musculus                      mgu74av2
14    GPL82       Mus musculus                      mgu74bv2
15    GPL83       Mus musculus                      mgu74cv2
16    GPL85  Rattus norvegicus                        rgu34a
17    GPL86  Rattus norvegicus                        rgu34b
18    GPL87  Rattus norvegicus                        rgu34c
19    GPL88  Rattus norvegicus                         rnu34
20    GPL89  Rattus norvegicus                         rtu34
22    GPL91       Homo sapiens                      hgu95av2
23    GPL92       Homo sapiens                        hgu95b
24    GPL93       Homo sapiens                        hgu95c
25    GPL94       Homo sapiens                        hgu95d
26    GPL95       Homo sapiens                        hgu95e
27    GPL96       Homo sapiens                       hgu133a
28    GPL97       Homo sapiens                       hgu133b
29    GPL98       Homo sapiens                     hu35ksuba
30    GPL99       Homo sapiens                     hu35ksubb
31   GPL100       Homo sapiens                     hu35ksubc
32   GPL101       Homo sapiens                     hu35ksubd
36   GPL201       Homo sapiens                       hgfocus
37   GPL339       Mus musculus                       moe430a
38   GPL340       Mus musculus                     mouse4302
39   GPL341  Rattus norvegicus                       rae230a
40   GPL342  Rattus norvegicus                       rae230b
41   GPL570       Homo sapiens                   hgu133plus2
42   GPL571       Homo sapiens                      hgu133a2
43   GPL886       Homo sapiens                     hgug4111a
44   GPL887       Homo sapiens                     hgug4110b
45  GPL1261       Mus musculus                    mouse430a2
49  GPL1352       Homo sapiens                       u133x3p
50  GPL1355  Rattus norvegicus                       rat2302
51  GPL1708       Homo sapiens                     hgug4112a
54  GPL2891       Homo sapiens                       h20kcod
55  GPL2898  Rattus norvegicus                     adme16cod
60  GPL3921       Homo sapiens                     hthgu133a
63  GPL4191       Homo sapiens                       h10kcod
64  GPL5689       Homo sapiens                     hgug4100a
65  GPL6097       Homo sapiens               illuminaHumanv1
66  GPL6102       Homo sapiens               illuminaHumanv2
67  GPL6244       Homo sapiens   hugene10sttranscriptcluster
68  GPL6947       Homo sapiens               illuminaHumanv3
69  GPL8300       Homo sapiens                      hgu95av2
70  GPL8490       Homo sapiens   IlluminaHumanMethylation27k
71 GPL10558       Homo sapiens               illuminaHumanv4
72 GPL11532       Homo sapiens   hugene11sttranscriptcluster
73 GPL13497       Homo sapiens         HsAgilentDesign026652
74 GPL13534       Homo sapiens  IlluminaHumanMethylation450k
75 GPL13667       Homo sapiens                        hgu219
76 GPL15380       Homo sapiens      GGHumanMethCancerPanelv1
77 GPL15396       Homo sapiens                     hthgu133b
78 GPL17897       Homo sapiens                     hthgu133a
posted on 2022-09-15 12:25  小高不高  阅读(1133)  评论(0编辑  收藏  举报