您好,登錄后才能下訂單哦!
本篇內容主要講解“怎么使用R語言的clusterProfiler對葡萄做GO富集”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“怎么使用R語言的clusterProfiler對葡萄做GO富集”吧!
stringtie -e -B -p 8 -G merged.combined.gtf -o ballgown/L01/L01.gtf output_bam/L01.sorted.bam
library(ballgown)
library(genefilter)
library(dplyr)
pheno_data<-read.csv("pheno_data.txt",header=T)
grape_expr <- ballgown(dataDir = "ballgown",
samplePattern = "L0",
pData = pheno_data)
這一步可以拿到gene_id還有gene_name ,FPKM的表達量,cov對用的應該是reads count吧。
接下來是差異表達分析
代碼是
grape_expr_filter<-subset(grape_expr,
"rowVars(texpr(grape_expr))>1",
genomesubset=T)
results_genes <- stattest(grape_expr_filter,
feature = "gene",
covariate = "time_point",
getFC = TRUE,
meas = "FPKM")
#results_genes <- arrange(results_genes,pval)
results_genes%>%
filter(abs(fc)>=2&pval<0.05) -> results_genes_diff
dim(results_genes_diff)
head(results_genes_diff)
現在有了基因id
接下來是使用clusterProfiler做go注釋
這里參考 https://guangchuangyu.github.io/cn/2017/07/clusterprofiler-maize/#disqus_thread
首先把這個基因id對應著轉換成 ENTREZID ,這里需要借助對應的gtf注釋文件
這里只關注蛋白編碼基因
grep 'gene_biotype "protein_coding"' 12X_genomic.gtf > 12X_protein_coding.gtf
#python
from gtfparse import read_gtf
known_proteincoding = read_gtf("12X_protein_coding.gtf")
known_proteincoding.to_csv("all_protein_coding.csv")
GO富集分析的R語言代碼
require(AnnotationHub)
hub<-AnnotationHub() #這一步對網路有要求
# aa<-query(hub,'zea')
# aa$title
# query(hub,'Malus domestica')
bb<-query(hub,"Vitis vinifera")
#bb$title
grape<-hub[['AH85815']]
# length(keys(grape))
# columns(grape)
protein_coding_all<-read.csv("all_protein_coding.csv",header=T)
df<-merge(results_genes_diff,grape_expr_filter@expr$trans,by.x="id",by.y="gene_id")
df1<-merge(df,protein_coding_all,by.x="gene_name",by.y="gene_id")
dim(df1)
gene_ids<-
df1$db_xref[!duplicated(df1$db_xref)]
gene_ids<-stringr::str_replace(gene_ids,"GeneID:","")
library(clusterProfiler)
bitr(keys(grape)[2],'ENTREZID',c("REFSEQ","GO",
"ONTOLOGY","GENENAME",
"SYMBOL"),grape)
res = enrichGO(gene_ids,
OrgDb=grape, pvalueCutoff=0.05, qvalueCutoff=0.05)
help(package="clusterProfiler")
dotplot(res)
最后的結果是
到此,相信大家對“怎么使用R語言的clusterProfiler對葡萄做GO富集”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。