edgeR中的彩色MDS图

时间:2017-02-15 19:37:15

标签: r plot bioinformatics pca

我有问题在edgeR中创建MDS图,以显示实验(白血病)和对照(健康捐献者)组的颜色。

我使用htseq文件作为edgeR的输入。每个文件由两列组成 - gene_ID和读取计数。 “A”代表白血病患者,“H”代表健康捐赠者。

这是我的代码:

创建一个表格:

samples <- matrix(c("A18.txt","experiment","blood_exp",
        "A19.txt","experiment","blood_exp",
        "A20.txt","experiment","blood_exp",
        "A23.txt","experiment","blood_exp",
        "A24.txt","experiment","blood_exp",
        "A26.txt","experiment","blood_exp",
        "A30.txt","experiment","blood_exp",
        "A37.txt","experiment","blood_exp",
        "H11.txt","control","blood_control",
        "H12.txt","control","blood_control",
        "H13.txt","control","blood_control",
        "H15.txt","control","blood_control",
        "H16.txt","control","blood_control",
        "H17.txt","control","blood_control",
        "H18.txt","control","blood_control",
        "H19.txt","control","blood_control"),
    nrow = 16, ncol = 3, byrow = TRUE, dimnames = list(c(1:16), c("library_name","condition","group_ALL_vs_control")))

samples <- as.data.frame (samples, row.names = NULL, optional = FALSE, stringAsFactors = default.stringAsFactors())

使用edgeR函数readDGE读取从htseq-count创建的READS COUNT个文件:

counts <- readDGE(samples$library_name, path = 'C:/Users/okbm4/Desktop/htseq_files', columns=c(1,2), group = samples$group_ALL_vs_control, header = FALSE)

colnames(counts) <- samples$library_name

过滤弱表达和非信息(即,可能的)特征:

noint <- rownames(counts) %in% c('__no_feature','__ambiguous','__too_low_aQual','__not_aligned','__alignment_not_unique')

cpms <- cpm(counts)
keep <- rowSums (cpms > 1) >= 4 & !noint
counts <- counts[keep,]

创建DGElist对象

counts <- DGEList(counts=counts,group = samples$group_ALL_vs_control)

估算归一化因子,这是库大小的标准化

counts <- calcNormFactors(counts)

使用MDS图检查样本之间的关系。

pdf(file = 'HCB_ALL.pdf', width = 9, height = 6)

plotMDS(counts, labels = c('A18.txt','A19.txt','A20.txt','A23.txt','A24.txt','A26.txt','A30.txt','A37.txt','H11.txt','H12.txt','H13.txt','H15.txt','H16.txt','H17.txt','H18.txt','H19.txt'), 

xlab = 'Dimension 1',
ylab = 'Dimension 2', 
asp = 6/9,
cex = 0.8,

main = 'Multidimentional scaling plot')
par(cex.axis =0.6, cex.lab = 0.6, cex.main = 1)

我附上了之前生成的文件。 enter image description here

我很高兴听到任何建议。

1 个答案:

答案 0 :(得分:2)

import pygame from pygame.locals import* pygame.init() height=650 width=650 screen=pygame.display.set_mode((height,width)) clock=pygame.time.Clock() gun=pygame.image.load("m2.png").convert_alpha() gun=pygame.transform.smoothscale(gun,(200,200)).convert_alpha() angle=0 angle_change=0 RED=(255,0,0) x=525 y=155 while True : screen.fill((150,150,150)) for event in pygame.event.get(): if event.type==QUIT: pygame.quit() quit() if event.type==KEYDOWN: if event.key==K_a: angle_change=+1 if event.key==K_d: angle_change=-1 elif event.type==KEYUP: angle_change=0 angle+=angle_change if angle>360: angle=0 if angle<0: angle=360 pygame.draw.rect(screen,RED,(x,y,64,64)) position = (height/2,width/2) gun_rotate=pygame.transform.rotate(gun,angle) rotate_rect = gun_rotate.get_rect() rotate_rect.center = position screen.blit(gun_rotate, rotate_rect) pygame.display.update() clock.tick(60) 生成一个可以传递给plotMDS()的对象 是, 这样您就可以选择自己的绘图符号和x和y轴 标签:

plot()

您可以向 mds <- plotMDS(yourdata) plot(mds) 添加任何参数,以选择绘制符号,颜色 等