R语言生物医学常用操作

library(tidyverse)
class1 <- tribble(
  ~'名次',~'姓名',
  '第一名','张三',
  '第二名','李四',
  '第三名','王二',
)
class2 <- tribble(
  ~'名次',~'姓名',
  '第一名','麻子',
  '第二名','傻子',
  '第四名','憨子',
)
inner_join(class1,class2,by='名次')
left_join(class1,class2,by='名次')
right_join(class1,class2,by='名次')
library(BiocManager)
setwd('TCGA-LUAD')
setwd('TCGAdata')
#BiocManager::install("BioinformaticsFMRP/TCGAbiolinksGUI.data")
#BiocManager::install("remotes")
#BiocManager::install("ExperimentHub")
BiocManager::install("BioinformaticsFMRP/TCGAbiolinks")
library(TCGAbiolinks)
cancer_type = "TCGA-LUAD"
expquery <- GDCquery(project = cancer_type,
                     data.category = "Transcriptome Profiling",
                     data.type = "Gene Expression Quantification",
                     workflow.type = "STAR - Counts")
GDCdownload(expquery,directory = "GDCdata")
expquery2 <-GDCprepare(expquery,directory = "GDCdata",summarizedExperiment = T)
save(expquery2,file = "luad.gdc_2022.rda")
setwd('TCGA-LUAD')
setwd("TCGAdata")
library(tidyverse)
load("luad.gdc_2022.rda")
load("gene_annotation_2022.rda")
table(gene_annotation_2022$type)
counts <- expquery2@assays@data@listData[["unstranded"]]
library(utils)
reforge <- "http://r-forge.r-project.org"
install.packages("estimate",repos = reforge,dependencies = TRUE)
library(estimate)
library(tidyverse)
library(BiocManager)
BiocManager::install('DESeq2')
library(DESeq2)
#创建数据
surv$group <- ifelse(surv$ImmuneScore > median(surv$ImmuneScore,"high","low"))
surv$group <- factor(surv$group,levels = c("high","low"))
condition = data.frame(sample = colnames(counts_01a),
                       group=factor(ifelse(estimate[x,]>med,"high","low")))
#差异分析代码
dds <- DESeqDataSetFromMatrix(
  countData = counts_01a,
  colData = conditions,
  design = ~ group
)
###femxo###
#开始差异分析
dds <- DESeq(dds)
resultsNames(dds)
#提取结果
res <- results(dds)
save(res,file="")
BiocManager::install('clusterProfiler')
BiocManager::install('org.Hs.eg.db')
library(ggnewscale)
BiocManager::install('survival')
BiocManager::install('forestplot')

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值