Wrapper that instantiates a gGraph object from a variety of different inputs.

Only select parameters combos need to be / should be specified simultaneously.

gG(
  genome = NULL,
  breaks = NULL,
  junctions = NULL,
  alignments = NULL,
  juncs = NULL,
  prego = NULL,
  jabba = NULL,
  cougar = NULL,
  weaver = NULL,
  remixt = NULL,
  rck = NULL,
  nodes = NULL,
  edges = NULL,
  walks = NULL,
  nodeObj = NULL,
  edgeObj = NULL,
  meta = NULL
)

Arguments

genome

seqlengths or seqinfo object around which to build an empty gGraph

breaks

GRanges around which to build a reference gGraph

junctions

BND vcf or bedpe file path, gGraph::Junctions object, or GRangesList specifying pairs of locations to reconnect (can be used in conjunction with breaks)

alignments

GRanges with fields $cigar $flag and $qname (e.g. output of bamUtils::read.bam or RSeqLib::BWA specifying alignments to a reference, the graph will then represent the (possibly multimapped) implicit nodes and edges representing an "end to end" walk of all queries lifted to the reference. Insertions are represented as 0-width nodes and multi-maps yield branches. The resulting graph can be walked to exhaustively or greedily enumerate all possible linear embeddings of the queries on the reference

prego

path to PREGO output file. if specified, instantiates a gGraph object from PREGO output with y.field "cn" specifying copy number

jabba

path to JaBbA .rds output file, if specified instantiates a gGraph object from JaBbA output with y.field "cn" specifying copy number

weaver

path to Weaver output. if specified, instantiates a gGraph object from Weaver output with y.field "cn" specifying copy number

remixt

path to RemiXT output, if specified, instantiates a gGraph object from ReMiXT output with y.field "cn" specifying copy number

rck

path to RCK output, if specified, instantiates a gGraph object from RCK output with y.field "cn" specifying total copy number

nodes

GRanges of unsigned intervals to be rejoined in gGRaph, used in conjunction with edges argument below

edges

data.table with field n1, n2, n1.side, n2.side with each row specifying an edge, i.e. which sides ("left" vs "right") of which integer node indices to connect in the gGRaph

walks

GRangesList or gWalk to build a "haplograph" around, see ?haplograph

nodeObj

gNode object to create a gGraph around (similar to nodes input above), except generated via the $nodes accessor of an existing gGraph object, used in cojunction with gEdge input to create a new gGnome object from an existing one

meta

list of metadata to associate with this gGraph object, for now mostly used to populate gTrack visualization parameters

edgeeObj

gEdge object to create a gGraph around (similar to edges input above), except generated via the $edges accessor of an existing gGraph object

Value

A new gGraph object that is the sum of the component gGraphs

Examples

mygenome = c('chr1' = 1e6, 'chr2' = 1e7)
myjuncs = system.file('extdata', "delly.final.vcf.gz", package = "gGnome") ## junctions
mybreaks = gr.tile(mygenome, 10000) ## 1kb tiles across my genome
myweaver = system.file('extdata', 'weaver', package='gGnome')
myremixt = system.file('extdata', 'remixt', package='gGnome')
myprego = system.file('extdata', 'intervalFile.results', package='gGnome')
myjab = system.file('extdata', 'jabba.simple.rds', package="gGnome")

gG(genome = mygenome)
#> gGraph with 0 nodes, 0 loose ends (0 terminal and 0 internal), and 0 edges (0 REF and 0 ALT)
#> 
#> gNode object of length 0

## create a graph from junctions
gG(breaks = mybreaks, juncs = myjuncs)
#> gGraph with 1435 nodes, 146 loose ends (146 terminal and 0 internal), and 1470 edges (1206 REF and 264 ALT)
#>  comprising:
#> gNode object of length 1435
#> GRanges object with 4 ranges and 7 metadata columns:
#>     seqnames          ranges strand |  query.id   tile.id loose.left
#>        <Rle>       <IRanges>  <Rle> | <integer> <integer>  <logical>
#>   1        1         6525379      + |      <NA>      <NA>       TRUE
#>   2        1 6569298-6683445      + |      <NA>      <NA>      FALSE
#>   3        1         6683446      + |      <NA>      <NA>      FALSE
#>   4        1 6683447-8397762      + |      <NA>      <NA>      FALSE
#>     loose.right   node.id  snode.id     index
#>       <logical> <integer> <numeric> <integer>
#>   1       FALSE         1         1         1
#>   2       FALSE         2         2         2
#>   3       FALSE         3         3         3
#>   4       FALSE         4         4         4
#>   -------
#>   seqinfo: 86 sequences from an unspecified genome
#> ... (1431 additional nodes)
#> 
#> gEdge object with 1470 edges
#>    sedge.id type grl.ix     CIEND     CIPOS CHR2       END PE MAPQ SR      SRQ
#> 1:        1  ALT      1     -4, 4     -4, 4    1  58605870 11   37 10 1.000000
#> 2:        2  ALT      2 -165, 165 -165, 165    2  92322345 15   25 NA       NA
#> 3:        3  ALT      3     -5, 5     -5, 5    2 136132774 23   37 10 0.975610
#> 4:        4  ALT      4     -2, 2     -2, 2    2 143640816 15   37  9 0.977099
#>                                                                                                                                                               CONSENSUS
#> 1:                    CTGTCATAGGGTCTTATAGTCATTTGCTTAACTGTCTGAATCCCATCTTCATCTCTAAGCTCCTTGGATGCTACTTGAGGCTCAATAGAAGAATGATACTTTCTAGCTTCACCATGTGGTATGGAATATGGTTCAGCCATCACAA
#> 2:                                                                                                                                                                 <NA>
#> 3: CTTGATATTTGCAAGTTGGTGCTCAGAATTCATACTTTAGGACAGGAGGCTCTGGAGTGGTGGCCCATAGTGTGATCTCTTGGACCTGAAGAATGTATTGAAGGAGGATTATTTTTTAGGTAGACTTGAGAAAAATATGAGACACAGAAGGAAAGGAATTAATC
#> 4:                                   AGTTTGCCAGGCTAGTTTCCACTTGAATCTTCAGATCTTTCTTCCTTCATTGTCTTGTTAACTGTCCAGATTTATTACCTAGGAGTTTATTACCAGTGGTGCAACCTCGGCTCACTGCAGGCTCCACCCC
#>         CE   CT IMPRECISE PRECISE SVTYPE         SVMETHOD INSLEN HOMLEN
#> 1: 1.96437 3to5     FALSE    TRUE    DEL EMBL.DELLYv0.7.7      0      3
#> 2:      NA 3to5      TRUE   FALSE    DEL EMBL.DELLYv0.7.7     NA     NA
#> 3: 1.92497 3to5     FALSE    TRUE    DEL EMBL.DELLYv0.7.7      0      5
#> 4: 1.94283 3to5     FALSE    TRUE    DEL EMBL.DELLYv0.7.7      0      1
#>     RDRATIO SOMATIC paramRangeID REF   ALT QUAL FILTER edge.id    class n1.side
#> 1: 0.684033    TRUE         <NA>   G <DEL>   NA   PASS       1 DEL-like   right
#> 2: 1.031910    TRUE         <NA>   A <DEL>   NA   PASS       2 DEL-like   right
#> 3: 0.327684    TRUE         <NA>   C <DEL>   NA   PASS       3 DEL-like   right
#> 4: 0.653066    TRUE         <NA>   A <DEL>   NA   PASS       4 DEL-like   right
#>    n2.side  n1  n2
#> 1:    left  10  11
#> 2:    left 186 187
#> 3:    left 189 190
#> 4:    left 190 191
#> ... (1466 additional edges)

## import a genome graph from popular callers
gG(jabba = myjab)
#> gGraph with 895 nodes, 448 loose ends (170 terminal and 278 internal), and 1079 edges (810 REF and 269 ALT)
#>  comprising:
#> gNode object of length 895
#> GRanges object with 4 ranges and 16 metadata columns:
#>     seqnames          ranges strand |        cn  start.ix    end.ix eslack.in
#>        <Rle>       <IRanges>  <Rle> | <numeric> <integer> <integer> <numeric>
#>   1        1       1-6525379      + |         4         1        73         0
#>   2        1 6525380-6569292      + |         2        74        76         0
#>   3        1 6569293-6570681      + |         3        77        78         0
#>   4        1 6570682-6570788      + |         4        79        79         0
#>     eslack.out     loose        edges.in       edges.out   tile.id     index
#>      <numeric> <logical>     <character>     <character> <integer> <integer>
#>   1          0     FALSE            ()-> ->2(2),->129(2)         1         1
#>   2          0     FALSE          1(2)->          ->3(2)         2         2
#>   3          0     FALSE 2(2)->,899(1)->          ->4(3)         3         3
#>   4          0     FALSE 3(3)->,898(1)-> ->5(3),->814(1)         4         4
#>      snode.id loose.left loose.right loose.cn.left loose.cn.right   node.id
#>     <numeric>  <logical>   <logical>     <numeric>      <numeric> <integer>
#>   1         1       TRUE       FALSE             0              0         1
#>   2         2      FALSE       FALSE             0              0         2
#>   3         3      FALSE       FALSE             0              0         3
#>   4         4      FALSE       FALSE             0              0         4
#>   -------
#>   seqinfo: 85 sequences from an unspecified genome
#> ... (891 additional nodes)
#> 
#> gEdge object with 1079 edges
#>    sedge.id cn type CHROM     POS paramRangeID  REF           ALT QUAL FILTER
#> 1:        1  2  REF  <NA>      NA         <NA> <NA>                 NA   <NA>
#> 2:        2  2  ALT     1 6525379         <NA>    C C[3:85232671[   99   PASS
#> 3:        3  2  REF  <NA>      NA         <NA> <NA>                 NA   <NA>
#> 4:        4  3  REF  <NA>      NA         <NA> <NA>                 NA   <NA>
#>    DISC_MAPQ NUMPARTS MATEMAPQ MATEID MAPQ REPSEQ READNAMES
#> 1:        NA       NA       NA   <NA>   NA   <NA>          
#> 2:       255        3       NA 6536:2   60   <NA>          
#> 3:        NA       NA       NA   <NA>   NA   <NA>          
#> 4:        NA       NA       NA   <NA>   NA   <NA>          
#>                        SCTG SVTYPE BX NM MATENM SPAN
#> 1:                     <NA>   <NA>    NA     NA   NA
#> 2: c_1_6517001_6542001_163C    BND     0      0   -1
#> 3:                     <NA>   <NA>    NA     NA   NA
#> 4:                     <NA>   <NA>    NA     NA   NA
#>                                                                                                                                                                                                        INSERTION
#> 1:                                                                                                                                                                                                          <NA>
#> 2: ATAGAGCCCAAACCCAATTAATCTTCTAAAAATGGGTAGCCTCTCTTTGACAGCACAGTGCAATTGCATGGTTTTGGAAGCTGAGAGAAAATATTCTATCATGTCTATATTCTTTTGGCCTCTAACATGTATTAAAATTGATATTATTTTAATGATTTCTCAATATTTTGAATCTCTATACATTGAAAGTTTAAAACAATATAAT
#> 3:                                                                                                                                                                                                          <NA>
#> 4:                                                                                                                                                                                                          <NA>
#>    SUBN HOMLEN HOMSEQ IMPRECISE EVDNC SECONDARY mateid svtype first right
#> 1:   NA     NA   <NA>        NA  <NA>        NA   <NA>   <NA>    NA    NA
#> 2:   NA     NA   <NA>     FALSE TSI_G     FALSE 6536:2    BND  TRUE  TRUE
#> 3:   NA     NA   <NA>        NA  <NA>        NA   <NA>   <NA>    NA    NA
#> 4:   NA     NA   <NA>        NA  <NA>        NA   <NA>   <NA>    NA    NA
#>        coord     mcoord mix MATECHROM  MATEPOS tier edge.id    class n1.side
#> 1:      <NA>       <NA>  NA      <NA>       NA   NA       1      REF   right
#> 2: 1:6525379 3:85232671 122         3 85232670    2       2 TRA-like   right
#> 3:      <NA>       <NA>  NA      <NA>       NA   NA       3      REF   right
#> 4:      <NA>       <NA>  NA      <NA>       NA   NA       4      REF   right
#>    n2.side n1  n2
#> 1:    left  1   2
#> 2:    left  1 129
#> 3:    left  2   3
#> 4:    left  3   4
#> ... (1075 additional edges)
gG(weaver = myweaver)
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 2 out-of-bound ranges located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 2 out-of-bound ranges located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 2 out-of-bound ranges located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 2 out-of-bound ranges located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 2 out-of-bound ranges located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> Warning: GRanges object contains 1 out-of-bound range located on sequence 17.
#>   Note that ranges located on a sequence whose length is unknown (NA) or
#>   on a circular sequence are not considered out-of-bound (use
#>   seqlengths() and isCircular() to get the lengths and circularity flags
#>   of the underlying sequences). You can use trim() to trim these ranges.
#>   See ?`trim,GenomicRanges-method` for more information.
#> gGraph with 7124 nodes, 6382 loose ends (46 terminal and 6336 internal), and 7427 edges (7101 REF and 326 ALT)
#>  comprising:
#> gNode object of length 7124
#> GRanges object with 4 ranges and 8 metadata columns:
#>     seqnames        ranges strand |       acn       bcn        cn loose.left
#>        <Rle>     <IRanges>  <Rle> | <integer> <integer> <integer>  <logical>
#>   1        1       1-10000      + |      <NA>      <NA>      <NA>       TRUE
#>   2        1   10001-11000      + |        15         0        15       TRUE
#>   3        1  11001-564368      + |         9         0         9      FALSE
#>   4        1 564369-565368      + |       155         0       155       TRUE
#>     loose.right   node.id  snode.id     index
#>       <logical> <integer> <numeric> <integer>
#>   1       FALSE         1         1         1
#>   2        TRUE         2         2         2
#>   3       FALSE         3         3         3
#>   4        TRUE         4         4         4
#>   -------
#>   seqinfo: 23 sequences from an unspecified genome
#> ... (7120 additional nodes)
#> 
#> gEdge object with 7427 edges
#>    sedge.id type grl.ix allele1 allele2 cn unknown1 unknown2
#> 1:        1  ALT      1      -1      -1  1        3     10/0
#> 2:        2  ALT      2      -1      -1  9        3      4/3
#> 3:        3  ALT      3       1       1  5        3    22/10
#> 4:        4  ALT      4      -1      -1  3        3     10/0
#>                    timing    class edge.id n1.side n2.side n1   n2
#> 1: somatic_post_aneuploid DUP-like       1    left   right 14   24
#> 2: somatic_post_aneuploid DEL-like       2   right    left 14   26
#> 3: somatic_post_aneuploid TRA-like       3   right   right 57 4531
#> 4: somatic_post_aneuploid INV-like       4    left    left 60   62
#> ... (7423 additional edges)
gG(prego = myprego)
#> gGraph with 604 nodes, 54 loose ends (54 terminal and 0 internal), and 690 edges (576 REF and 114 ALT)
#>  comprising:
#> gNode object of length 604
#> GRanges object with 4 ranges and 8 metadata columns:
#>     seqnames          ranges strand |        cn     left.tag    right.tag
#>        <Rle>       <IRanges>  <Rle> | <integer>  <character>  <character>
#>   1        1       1-6525379      + |         2       c1_1_1 c1_1_6525379
#>   2        1 6525380-6570788      + |         2 c2_1_6525380 c2_1_6570788
#>   3        1 6570789-8175806      + |         2 c3_1_6570789 c3_1_8175806
#>   4        1 8175807-8401105      + |         2 c4_1_8175807 c4_1_8401105
#>     loose.left loose.right   node.id  snode.id     index
#>      <logical>   <logical> <integer> <numeric> <integer>
#>   1       TRUE       FALSE         1         1         1
#>   2      FALSE       FALSE         2         2         2
#>   3      FALSE       FALSE         3         3         3
#>   4      FALSE       FALSE         4         4         4
#>   -------
#>   seqinfo: 24 sequences from an unspecified genome
#> ... (600 additional nodes)
#> 
#> gEdge object with 690 edges
#>    sedge.id        node1 chr1    pos1        node2 chr2    pos2 cn type n1.left
#> 1:        1 c1_1_6525379    1 6525379 c2_1_6525380    1 6525380  2  REF      NA
#> 2:        2 c2_1_6570788    1 6570788 c3_1_6570789    1 6570789  2  REF      NA
#> 3:        3 c3_1_8175806    1 8175806 c4_1_8175807    1 8175807  2  REF      NA
#> 4:        4 c4_1_8401105    1 8401105 c5_1_8401106    1 8401106  2  REF      NA
#>    n1.right n2.left n2.right edge.id class n1.side n2.side n1 n2
#> 1:        1       2       NA       1   REF   right    left  1  2
#> 2:        2       3       NA       2   REF   right    left  2  3
#> 3:        3       4       NA       3   REF   right    left  3  4
#> 4:        4       5       NA       4   REF   right    left  4  5
#> ... (686 additional edges)
gG(remixt = myremixt)
#> gGraph with 6145 nodes, 94 loose ends (46 terminal and 48 internal), and 6203 edges (6122 REF and 81 ALT)
#>  comprising:
#> gNode object of length 6145
#> GRanges object with 4 ranges and 37 metadata columns:
#>     seqnames         ranges strand |     length major_is_allele_a
#>        <Rle>      <IRanges>  <Rle> |  <numeric>         <integer>
#>   1        1       1-177417      + |  11278.414                 1
#>   2        1  177418-267719      + |   2372.545                 1
#>   3        1  267720-471368      + |    127.247                 1
#>   4        1 471369-1000000      + | 262848.023                 1
#>     major_readcount minor_readcount readcount allele_ratio major_depth
#>           <integer>       <integer> <integer>    <numeric>   <numeric>
#>   1              38               2     18510     0.050000    1.559129
#>   2               0               0      5384     0.000000    2.269293
#>   3               0               0      2429     0.000000   19.088788
#>   4           18683            2598     82956     0.122081    0.277075
#>     minor_depth total_depth   major_0   minor_0   major_1   minor_1   major_2
#>       <numeric>   <numeric> <integer> <integer> <integer> <integer> <integer>
#>   1   0.0820594    1.641188         1         1         4         2         4
#>   2   0.0000000    2.269293         1         1         4         2         4
#>   3   0.0000000   19.088788         1         1         4         2         4
#>   4   0.0385292    0.315604         1         1         4         2         4
#>       minor_2 major_raw minor_raw major_depth_e minor_depth_e total_depth_e
#>     <integer> <numeric> <numeric>     <numeric>     <numeric>     <numeric>
#>   1         2   66.8658  3.312029     0.0980487     0.0515662      0.149615
#>   2         2   97.4220 -0.218737     0.0980487     0.0515662      0.149615
#>   3         2  821.1136 -0.218737     0.0980487     0.0515662      0.149615
#>   4         2   11.7030  1.439058     0.0980487     0.0515662      0.149615
#>        major_e     minor_e    total_e major_raw_e minor_raw_e major_diff
#>      <numeric>   <numeric>  <numeric>   <numeric>   <numeric>  <integer>
#>   1  1105.8340   581.58517  1687.4191           4           2          0
#>   2   232.6250   122.34318   354.9682           4           2          0
#>   3    12.4765     6.56167    19.0381           4           2          0
#>   4 25771.9109 13554.07911 39325.9900           4           2          0
#>     minor_diff prob_is_outlier_total prob_is_outlier_allele
#>      <integer>             <numeric>              <numeric>
#>   1          0                  0.01                   0.01
#>   2          0                  0.01                   0.01
#>   3          0                  0.01                   0.01
#>   4          0                  0.01                   0.01
#>     total_likelihood_mask allele_likelihood_mask        cn loose.left
#>                 <integer>              <integer> <integer>  <logical>
#>   1                     0                      0         6       TRUE
#>   2                     0                      0         6      FALSE
#>   3                     0                      0         6      FALSE
#>   4                     0                      0         6      FALSE
#>     loose.right   node.id  snode.id     index
#>       <logical> <integer> <numeric> <integer>
#>   1       FALSE         1         1         1
#>   2       FALSE         2         2         2
#>   3       FALSE         3         3         3
#>   4       FALSE         4         4         4
#>   -------
#>   seqinfo: 23 sequences from an unspecified genome
#> ... (6141 additional nodes)
#> 
#> gEdge object with 6203 edges
#>    sedge.id type grl.ix prediction_id cn cn_0 cn_1 cn_2 n_1 side_1 n_2 side_2
#> 1:        1  ALT      1             2  1    0    1    1 318      1 197      0
#> 2:        2  ALT      2             3  1    0    1    1 409      0 456      1
#> 3:        3  ALT      3             4  1    0    1    1 430      1 432      0
#> 4:        4  ALT      4             5  1    0    1    1 591      0 592      1
#>    edge.id    class n1.side n2.side  n1   n2
#> 1:       1 TRA-like   right    left  20 3253
#> 2:       2 DUP-like    left   right 111  158
#> 3:       3 DEL-like   right    left 132  134
#> 4:       4 DUP-like    left   right 293  294
#> ... (6199 additional edges)


## hard code a graph from GRanges and edges
nodes = c(GRanges("1",IRanges(1,100),"*"), GRanges("1",IRanges(101,200),"*"),
               GRanges("1",IRanges(201,300),"*"), GRanges("1",IRanges(301,400),"*"),
               GRanges("1",IRanges(401,500),"*"))
edges = data.table(n1 = c(3,2,4,1,3),
                   n2 = c(3,4,2,5,4),
                   n1.side = c(1,1,0,0,1),
                   n2.side = c(0,0,0,1,0))
gg = gG(nodes = nodes, edges = edges, meta = list(gr.colorfield = 'type'))

## mostly for developer use 
gG(nodeObj = gg$nodes, edgeObj = gg$edges)
#> gGraph with 5 nodes, 3 loose ends (3 terminal and 0 internal), and 5 edges (1 REF and 4 ALT)
#>  comprising:
#> gNode object of length 5
#> GRanges object with 4 ranges and 5 metadata columns:
#>     seqnames    ranges strand | loose.left loose.right   node.id  snode.id
#>        <Rle> <IRanges>  <Rle> |  <logical>   <logical> <integer> <numeric>
#>   1        1     1-100      + |      FALSE        TRUE         1         1
#>   2        1   101-200      + |      FALSE       FALSE         2         2
#>   3        1   201-300      + |      FALSE       FALSE         3         3
#>   4        1   301-400      + |      FALSE        TRUE         4         4
#>         index
#>     <integer>
#>   1         1
#>   2         2
#>   3         3
#>   4         4
#>   -------
#>   seqinfo: 1 sequence from an unspecified genome
#> ... (1 additional nodes)
#> 
#> gEdge object with 5 edges
#>    sedge.id type    class edge.id n1.side n2.side n1 n2
#> 1:        1  ALT DUP-like       1   right    left  3  3
#> 2:        2  ALT DEL-like       2   right    left  2  4
#> 3:        3  ALT INV-like       3    left    left  4  2
#> 4:        4  ALT DUP-like       4    left   right  1  5
#> ... (1 additional edges)