## ----样式,echo = false,结果='asis'--------------------------------------------------------------------------- BiocStyle :: Markdown(css.files = C('Custom.css'))## -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------#if(!sireseenamespace(“ Biocmanager)“,悄悄= true))#install.packages(“ biocmanager”)###biocmanager :: install(c(“ epitxdb”,“ epitxdb”,“ epitxdb.hs.hg38”))## ----结果=“ hide”,include = true,messages = false,警告= false -------------------库(EpitXDB)库(Epitxdb.hs.hg38)## ----------------------------------------------------------------------------------------------------------------------------------------------- etdb <- EpiTxDb.Hs.hg38.snoRNAdb() etdb ## ---------------------------------------------------------------------------------------------------------------键形(ETDB)列(ETDB)head(键(etdb,“ modid”))select(etdb,keys =“ 1”,列= c(“ modname”,“ modtype”,“ modtype”,“”modstart“,“ modstrand”,“ snname”,“ rxGeneName”,“ spectype”,“ specgenName”),keytype =“ modid”)## -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------物种(ETDB)生物(ETDB)SEQlevels(ETDB)## -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- modifications(etdb, columns = c("mod_id","mod_type","mod_name”,“ rx_geneName”,“ spec_geneName”,“ ref_type”,“ ref”),filter = list(mod_id = 1:3))## -------------------------------------------------------------------------------------------------------------------------------------------------------------#按序列名称拆分,通常是transcipt标识符修改(etdb,by =“ seqnames”)#split修改type oftificationby by(etdb,by by =“ modtype”)## ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- echo = FALSE------------------------------------------------------------ suppressPackageStartupMessages({ library(TxDb.Hsapiens.UCSC.hg38.knownGene) library(BSgenome.Hsapiens.UCSC.hg38) }) ## ---- eval = FALSE------------------------------------------------------------ # library(TxDb.Hsapiens.UCSC.hg38.knownGene) # library(BSgenome.Hsapiens.UCSC.hg38) ## ----------------------------------------------------------------------------- txdb <- TxDb.Hsapiens.UCSC.hg38.knownGene seqlevels(txdb) <- "chr1" bs <- BSgenome.Hsapiens.UCSC.hg38 etdb <- EpiTxDb.Hs.hg38.RMBase() tx <- exonsBy(txdb) mod <- modifications(etdb, filter = list(sn_name = "chr1")) length(mod) ## ----------------------------------------------------------------------------- mod_tx <- shiftGenomicToTranscript(mod, tx) length(mod_tx) ## ----------------------------------------------------------------------------- mod_tx <- split(mod_tx,seqnames(mod_tx)) names <- Reduce(intersect,list(names(mod_tx),names(tx))) # Getting the corresponding 5'-UTR and 3'-UTR annotations fp <- fiveUTRsByTranscript(txdb) tp <- threeUTRsByTranscript(txdb) tx <- tx[names] mod_tx <- mod_tx[names] fp_m <- match(names,names(fp)) fp_m <- fp_m[!is.na(fp_m)] tp_m <- match(names,names(tp)) tp_m <- tp_m[!is.na(tp_m)] fp <- fp[fp_m] tp <- tp[tp_m] # Getting lengths of transcripts, 5'-UTR and 3'-UTR tx_lengths <- sum(width(tx)) fp_lengths <- rep(0L,length(tx)) names(fp_lengths) <- names fp_lengths[names(fp)] <- sum(width(fp)) tp_lengths <- rep(0L,length(tx)) names(tp_lengths) <- names tp_lengths[names(tp)] <- sum(width(tp)) # Rescale modifications # CDS start is at position 1L and cds end at position 1000L from <- IRanges(fp_lengths+1L, tx_lengths - tp_lengths) to <- IRanges(1L,1000L) mod_rescale <- rescale(mod_tx, to, from) # Construct result data.frame rel_pos <- data.frame(mod_type = unlist(mcols(mod_rescale,level="within")[,"mod_type"]), rel_pos = unlist(start(mod_rescale))) rel_pos <- rel_pos[rel_pos$rel_pos < 1500 & rel_pos$rel_pos > -500,] ## ----------------------------------------------------------------------------- library(ggplot2) ggplot(rel_pos[rel_pos$mod_type %in% c("m6A","m1A","Y"),], aes(x = rel_pos, colour = mod_type)) + geom_density() ## ----------------------------------------------------------------------------- sessionInfo()