df2GRanges: Data frame to GenomicRanges::GRanges object

View source: R/granges_conversion.R

df2GRangesR Documentation

Data frame to GenomicRanges::GRanges object

Description

Wrapper for GenomicRanges::makeGRangesFromDataFrame().

Usage

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

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/MouseFM documentation built on Sept. 5, 2024, 12:39 p.m.