Last data update: 2014.03.03

R: Intra-tuple transformations of a GTuples or GTuplesLists...
intra-tuple-methodsR Documentation

Intra-tuple transformations of a GTuples or GTuplesLists object

Description

This man page documents intra-tuple transformations of a GTuples or a GTuplesList object.

WARNING: These are not exactly the same as the intra-range methods defined in the GenomicRanges package (?GenomicRanges::intra-range-methods) or in the IRanges package (?IRanges::intra-range-methods).

Usage

## S4 method for signature 'GTuples'
shift(x, shift = 0L, use.names = TRUE)
## S4 method for signature 'GTuplesList'
shift(x, shift = 0L, use.names = TRUE)

## S4 method for signature 'GTuples'
trim(x, use.names = TRUE)

Arguments

x

A GTuples or GTuplesList object.

shift, use.names

See ?`intra-range-methods`.

...

Additional arguments to methods.

Details

  • shift behaves like the shift method for GRanges objects, except that any internalPos are also shifted. See ?`intra-range-methods` for further details of the shift method.

  • trim trims out-of-bound tuples located on non-circular sequences whose length is not NA.

Value

See Details section above.

Author(s)

Peter Hickey for methods involving GTuples and GTuplesList. P. Aboyoun and V. Obenchain <vobencha@fhcrc.org> for all the real work underlying the powerful intra-range methods.

See Also

  • GTuples and GTuplesList objects.

  • The intra-range-methods man page in the GenomicRanges package.

Examples

## ---------------------------------------------------------------------
## A. ON A GTuples OBJECT
## ---------------------------------------------------------------------
gt3 <- GTuples(seqnames = c('chr1', 'chr1', 'chr1', 'chr1', 'chr2'), 
               tuples = matrix(c(10L, 10L, 10L, 10L, 10L, 20L, 20L, 20L, 25L, 
                                 20L, 30L, 30L, 35L, 30L, 30L), ncol = 3), 
               strand = c('+', '-', '*', '+', '+'))
gt3

shift(gt3, 10)

## ---------------------------------------------------------------------
## B. ON A GTuplesList OBJECT
## ---------------------------------------------------------------------
gtl3 <- GRangesList(A = gt3, B = rev(gt3))
gtl3

shift(gtl3, IntegerList(10, 100))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(GenomicTuples)
Loading required package: GenomicRanges
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: IRanges
Loading required package: GenomeInfoDb
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/GenomicTuples/intra-tuple-methods.Rd_%03d_medium.png", width=480, height=480)
> ### Name: intra-tuple-methods
> ### Title: Intra-tuple transformations of a GTuples or GTuplesLists object
> ### Aliases: intra-tuple-methods shift shift,GTuples-method
> ###   shift,GTuplesList-method trim,GTuples-method
> ### Keywords: methods utilities
> 
> ### ** Examples
> 
> ## ---------------------------------------------------------------------
> ## A. ON A GTuples OBJECT
> ## ---------------------------------------------------------------------
> gt3 <- GTuples(seqnames = c('chr1', 'chr1', 'chr1', 'chr1', 'chr2'), 
+                tuples = matrix(c(10L, 10L, 10L, 10L, 10L, 20L, 20L, 20L, 25L, 
+                                  20L, 30L, 30L, 35L, 30L, 30L), ncol = 3), 
+                strand = c('+', '-', '*', '+', '+'))
> gt3
GTuples object with 5 x 3-tuples and 0 metadata columns:
      seqnames pos1 pos2 pos3 strand
  [1]     chr1   10   20   30      +
  [2]     chr1   10   20   30      -
  [3]     chr1   10   20   35      *
  [4]     chr1   10   25   30      +
  [5]     chr2   10   20   30      +
  ---
  seqinfo: 2 sequences from an unspecified genome; no seqlengths
> 
> shift(gt3, 10)
GTuples object with 5 x 3-tuples and 0 metadata columns:
      seqnames pos1 pos2 pos3 strand
  [1]     chr1   20   30   40      +
  [2]     chr1   20   30   40      -
  [3]     chr1   20   30   45      *
  [4]     chr1   20   35   40      +
  [5]     chr2   20   30   40      +
  ---
  seqinfo: 2 sequences from an unspecified genome; no seqlengths
> 
> ## ---------------------------------------------------------------------
> ## B. ON A GTuplesList OBJECT
> ## ---------------------------------------------------------------------
> gtl3 <- GRangesList(A = gt3, B = rev(gt3))
> gtl3
GTuplesList object of length 2:
$A 
GTuples object with 5 x 3-tuples and 0 metadata columns:
      seqnames pos1 pos2 pos3 strand
  [1]     chr1   10   20   30      +
  [2]     chr1   10   20   30      -
  [3]     chr1   10   20   35      *
  [4]     chr1   10   25   30      +
  [5]     chr2   10   20   30      +

$B 
GTuples object with 5 x 3-tuples and 0 metadata columns:
      seqnames pos1 pos2 pos3 strand
  [1]     chr2   10   20   30      +
  [2]     chr1   10   25   30      +
  [3]     chr1   10   20   35      *
  [4]     chr1   10   20   30      -
  [5]     chr1   10   20   30      +

-------
seqinfo: 2 sequences from an unspecified genome; no seqlengths
> 
> shift(gtl3, IntegerList(10, 100))
GTuplesList object of length 2:
$A 
GTuples object with 5 x 3-tuples and 0 metadata columns:
      seqnames pos1 pos2 pos3 strand
  [1]     chr1   20   30   40      +
  [2]     chr1   20   30   40      -
  [3]     chr1   20   30   45      *
  [4]     chr1   20   35   40      +
  [5]     chr2   20   30   40      +

$B 
GTuples object with 5 x 3-tuples and 0 metadata columns:
      seqnames pos1 pos2 pos3 strand
  [1]     chr2  110  120  130      +
  [2]     chr1  110  125  130      +
  [3]     chr1  110  120  135      *
  [4]     chr1  110  120  130      -
  [5]     chr1  110  120  130      +

-------
seqinfo: 2 sequences from an unspecified genome; no seqlengths
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>