Learn R Programming

GenoView (version 1.6.0)

makeGR: Make GRanges object from data.frame

Description

Extracts GRanges data from relevant columns from a data.frame, performs seqlengths adjustments and complete case filtering

Usage

makeGR(dataFrame, chr.col, s.p.col, e.p.col, str.col, id.col = NULL, plot.int, des.seqs, show.legend = FALSE, l.height = 0)

Arguments

dataFrame
Data.frame which contains at least Chromosome, Start Position, End Position, and Strand data. It may also contain a column which uniquely identifies each entry for legend plotting.
chr.col
Chromosome data column name
s.p.col
Start position data column name
e.p.col
End position data column name
str.col
Strand data column name
id.col
Fill data column name
plot.int
GRanges object of length 1 of the plotting interval in genomic coordinates
des.seqs
Desired seqlengths appropriate for dataFrame
show.legend
Determines whether legend information is kept based on boolean
l.height
Determines whether legend information is kept based on height allocation

Value

GRanges object containing filtered genomic data

Examples

Run this code
library(biovizBase)

# Create a missense mutations dataset in TP53
set.seed(1)
N = 25
locations = sample(7571720:7590863, size = N)
mut.df <- data.frame(chrom = "chr17", 
                    start = locations, 
                    end = locations, 
                    str = "-", 
                    fill = 1:N)

# Create a truncated plotting interval
plot.int = GRanges(seqnames = "chr17", 
                    IRanges(start = 7576000, end = 7579000), 
                    strand = "-")

# Obtain hg19 seqlengths data
data(hg19Ideogram, package = "biovizBase")
seqs.hg19 <- seqlengths(hg19Ideogram)

makeGR(dataFrame = mut.df, chr.col = "chrom", s.p.col = "start", 
        e.p.col = "end", str.col = "str", id.col = "fill", 
        plot.int = plot.int, show.legend = TRUE, 
        des.seqs = seqs.hg19)

Run the code above in your browser using DataLab