RangedData-methods        package:rtracklayer        R Documentation

_D_a_t_a _o_n _a _G_e_n_o_m_e

_D_e_s_c_r_i_p_t_i_o_n:

     The 'rtracklayer' package adds convenience methods on top of
     'RangedData' manipulate data on genomic ranges. The spaces are now
     called chromosomes (but could still refer to some other type of
     sequence). The universe refers to the genome and there is formal
     treatment of an optional 'strand' variable.

_A_c_c_e_s_s_o_r_s:

     In the code snippets below, 'x' is a 'RangedData' object.


      'chrom(x)': Gets the chromosome names (a factor) over the ranges
          in 'x'.

      'genome(x)', 'genome(x) <- value': Gets or sets the genome (a
          single string or 'NULL') for the ranges in 'x'; simple
          wrappers around 'universe' and 'universe<-', respectively.

      'strand(x)': Gets the strand factor in 'x', with the standard 
          levels: '-', '+' and '*', referring to the negative, positive
          and either/both strands, respectively. Any strand factor
          stored in the 'RangedData' should have those levels. 'NA''s
          are allowed; the value is all 'NA' if no strand has been
          specified.

      'score(x)': gets the column representing a "score" in 'x', as a
          vector. This is the column named 'score', or, if this does
          not exist, the first column, if it is numeric. Otherwise,
          'NULL' is returned.

      'score(x) <- value': sets the column named 'score' to 'value',
          which should be a numeric vector of length equal to the
          number of rows.


_C_o_n_s_t_r_u_c_t_o_r:


      'GenomicData(ranges, ..., strand = NULL, chrom = NULL, genome =
          NULL)': Constructs a 'RangedData' instance with the given
          'ranges' and variables in '...' (see the 'RangedData'
          constructor). If non-'NULL', 'strand' specifies the strand of
          each range. It should be a character vector or factor of
          length equal to that of 'ranges'. All values should be either
          '-', '+', '*' or 'NA'. To get these levels, call
          'levels(strand())'. 'chrom' is analogous to 'splitter' in
          'RangedData'; if non-'NULL' it should be coercible to a
          factor indicating how the ranges, variables and strand should
          be split up  across the chromosomes. The 'genome' argument
          should be a scalar string and is treated as the 'RangedData'
          universe. See the examples.


_A_u_t_h_o_r(_s):

     Michael Lawrence

_E_x_a_m_p_l_e_s:

       range1 <- IRanges(start=c(1,2,3), end=c(5,2,8))

       ## just ranges
       gr <- GenomicData(range1) 

       ## with a genome (universe)
       gr <- GenomicData(range1, genome = "hg18")
       genome(gr) ## "hg18"

       ## with some data
       filter <- c(1L, 0L, 1L)
       score <- c(10L, 2L, NA)
       strand <- factor(c("+", NA, "-"), levels = levels(strand()))
       gr <- GenomicData(range1, score, genome = "hg18")
       gr[["score"]]
       strand(gr) ## all NA
       gr <- GenomicData(range1, score, filt = filter, strand = strand)
       gr[["filt"]]
       strand(gr) ## equal to 'strand'

       range2 <- IRanges(start=c(15,45,20,1), end=c(15,100,80,5))
       ranges <- c(range1, range2)
       score <- c(score, c(0L, 3L, NA, 22L)) 
       chrom <- paste("chr", rep(c(1,2), c(length(range1), length(range2))), sep="")
       
       gr <- GenomicData(ranges, score, chrom = chrom, genome = "hg18")
       chrom(gr) # equal to 'chrom'
       gr[["score"]] # unlists over the chromosomes
       score(gr)
       gr[1][["score"]] # equal to score[1:3]

