df2GRanges: Data frame to GenomicRanges::GRanges object

Description Usage Arguments Value Examples

View source: R/granges_conversion.R

Description

Wrapper for GenomicRanges::makeGRangesFromDataFrame().

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
df2GRanges(
  geno,
  chr_name = "chr",
  start_name = "pos",
  end_name = "pos",
  strand_name = NULL,
  ref_version = ref_genome(),
  seq_lengths = NULL,
  is_circular = FALSE
)

Arguments

geno

Data frame.

chr_name

Name of chromosome column. Default is 'chr'.

start_name

Name of start position column. Default is 'pos.'

end_name

Name of end position column. Default is 'pos'

strand_name

Name of end position column. Default is NULL.

ref_version

Reference genome version. Default is 'ref_genome()'.

seq_lengths

List of sequence lengths with sequence name as key. Default is NULL.

is_circular

Whether genome is circular. Default is FALSE.

Value

GenomicRanges::GRanges object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
geno = finemap("chr1",
  start = 5000000, end = 6000000,
  strain1 = c("C57BL_6J"), strain2 = c("AKR_J", "A_J", "BALB_cJ")
)

geno$strand = "+"
seq_lengths = stats::setNames(
    as.list(avail_chromosomes()$length),
    avail_chromosomes()$chr
)
geno.granges = df2GRanges(geno,
    strand_name = "strand",
    seq_lengths = seq_lengths
)

matmu/mmus documentation built on Nov. 14, 2021, 1:18 a.m.