rep0ooo

rep0ooo

spliceR,NGS-RNA-seq Rパッケージメモ

source("http://www.bioconductor.org/biocLite.R")

biocLite("spliceR")

library("spliceR", lib.loc="C:/Program Files/R/R-3.1.0/library")
cuff_spliceR<-prepareCuff(cuff)
myTranscripts<-transcripts(cuff_spliceR)
myExons<-exons(cuff_spliceR)
conditions(cuff_spliceR)
session<-browserSession("UCSC")

genome(session)<-"mm10"
query<-ucscTableQuery(session,"knownGene")
tableName(query)<-"knownGene"
cdsTable<-getTable(query)
tableName(query)<-"kgXref"
kgXref<-getTable(query)

knownGeneTranscripts <- GRanges(
seqnames=cdsTable$"chrom",
ranges=IRanges(
start=cdsTable$"txStart",
end=cdsTable$"txEnd"),
strand=cdsTable$"strand",
spliceR.isoform_id = cdsTable$"name",
spliceR.sample_1="placeholder1",
spliceR.sample_2="placeholder2",
spliceR.gene_id=kgXref[match(cdsTable$"name", kgXref$"kgID"),
"geneSymbol"],
spliceR.gene_value_1=1,
spliceR.gene_value_2=1,
spliceR.gene_log2_fold_change=log2(1/1),
spliceR.gene_p_value=1,
spliceR.gene_q_value=1,
spliceR.iso_value_1=1,
spliceR.iso_value_2=1,
spliceR.iso_log2_fold_change=log2(1/1),
spliceR.iso_p_value=1,
spliceR.iso_q_value=1
)

startSplit <- strsplit(as.character(cdsTable$"exonStarts"), split=",")
endSplit <- strsplit(as.character(cdsTable$"exonEnds"), split=",")
startSplit <- lapply(startSplit, FUN=as.numeric)
endSplit <- lapply(endSplit, FUN=as.numeric)
knownGeneExons <- GRanges(
seqnames=rep(cdsTable$"chrom", lapply(startSplit, length)),
ranges=IRanges(
start=unlist(startSplit)+1,
end=unlist(endSplit)),
strand=rep(cdsTable$"strand", lapply(startSplit, length)),
spliceR.isoform_id=rep(knownGeneTranscripts$"spliceR.isoform_id",
lapply(startSplit, length)),
spliceR.gene_id=rep(knownGeneTranscripts$"spliceR.gene_id",
lapply(startSplit, length))
)
knownGeneSpliceRList <- SpliceRList(
transcript_features=knownGeneTranscripts,
exon_features=knownGeneExons,
assembly_id="mm10",
source="granges",
conditions=c("placeholder1", "placeholder2")
)
cuff_spliceR_filtered<- preSpliceRFilter(
cuff_spliceR,
filters=c("expressedIso", "isoOK", "expressedGenes", "geneOK")
)
mySpliceRList <- spliceR(
cuff_spliceR,compareTo="preTranscript",filters=c("expressedGenes","geneOK", "isoOK", "expressedIso", "isoClass"),useProgressBar=F)
ucscCDS <- getCDS(selectedGenome="mm10", repoName="UCSC")

source("http://bioconductor.org/biocLite.R")
biocLite("BSgenome.Mmusculus.UCSC.mm10")
require("BSgenome.Mmusculus.UCSC.mm10",character.only = TRUE)
generateGTF(mySpliceRList, filters=

c("geneOK", "isoOK", "expressedGenes", "expressedIso"),
scoreMethod="local",
useProgressBar=F)

 

mySpliceRList<-spliceRPlot(mySpliceRList,nr_transcript_pr_gene")

 

あとで読み返す用 

詳しくは後で書くかもしれない