## ---------------------------------------------------------------------
## 1. Make SplicingGraphs object 'sg' from toy gene model (see
## '?SplicingGraphs')
## ---------------------------------------------------------------------
example(SplicingGraphs) # create SplicingGraphs object 'sg'
sg
## 'sg' has 1 element per gene and 'names(sg)' gives the gene ids.
names(sg)
## ---------------------------------------------------------------------
## 2. Basic usage
## ---------------------------------------------------------------------
sgedges(sg["geneD"])
sgnodes(sg["geneD"])
outdeg(sg["geneD"])
indeg(sg["geneD"])
## ---------------------------------------------------------------------
## 3. Sanity checks
## ---------------------------------------------------------------------
check_way1_vs_way2 <- function(res1, res2)
{
edges1 <- res1[res1$ex_or_in != "", ] # remove artificial edges
edges2 <- mcols(unlist(res2, use.names=FALSE))
stopifnot(identical(edges1, edges2))
}
for (i in seq_along(sg)) {
sgi <- sg[i]
## After removal of the artificial edges, the edges returned
## by 'sgedges()' should be the same as those returned
## by 'sgedgesByGene()' on a SplicingGraphs object of length 1.
check_way1_vs_way2(
sgedges(sgi),
sgedgesByGene(sgi))
## After removal of the artificial edges, the edges returned
## by 'sgedges( , keep.dup.edges=TRUE)' should be the same as
## those returned by 'sgedgesByGene( , keep.dup.edges=TRUE)' or by
## 'sgedgesByTranscript()' on a SplicingGraphs object of length 1.
res1 <- DataFrame(sgedges(sgi, keep.dup.edges=TRUE))
check_way1_vs_way2(
res1,
sgedgesByGene(sgi, keep.dup.edges=TRUE))
check_way1_vs_way2(
res1,
sgedgesByTranscript(sgi))
}
Run the code above in your browser using DataLab