sgedges-methods {SplicingGraphs} | R Documentation

## Extract the edges (and nodes) of a splicing graph

### Description

`sgedges` (resp. `sgnodes`) extracts the edges (resp. the nodes) of the splicing graph of a given gene from a SplicingGraphs object.

### Usage

    sgedges(x, txweight=NULL, keep.dup.edges=FALSE)
    sgnodes(x)
    outdeg(x)
    indeg(x)

### Arguments

`x` | A SplicingGraphs object of length 1.
`txweight` | TODO
`keep.dup.edges` | If `FALSE` (the default), then edges with the same global edge id are merged into a single row. Use `keep.dup.edges=TRUE` if this merging should not be performed.

### Details

TODO

### Value

TODO

### Author(s)

H. Pagès

### See Also

This man page is part of the SplicingGraphs package. Please see `?`SplicingGraphs-package`` for an overview of the package and for an index of its man pages.

### Examples

    ## ---------------------------------------------------------------------
    ## 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))
    }

[Package SplicingGraphs version 1.29.1 Index]