Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pruning] Seismic #124

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
merged changes from master
  • Loading branch information
ShaiberAlon committed Jan 7, 2022
commit d04d6bc4bf5cd1b6b9a39876ba041bb5ce495c85
24 changes: 24 additions & 0 deletions R/eventCallers.R
Original file line number Diff line number Diff line change
Expand Up @@ -3032,3 +3032,27 @@ seismic = function(gg, amp.thresh = 2, ploidy.thresh = 2, min.internal = 14,

return(gg)
}

#' @name events.to.gr
#' @title Extract event annotation as a GRanges
#'
#' @author Alon Shaiber
#' @param gg gGraph
#' @return GRanges containing ranges of annotated events along with all metadata from gg$meta$events
#' @export
events.to.gr = function(gg){
if (!inherits(gg, 'gGraph')){
stop('Expected gGraph, but got: ', class(gg))
}
if (!('events' %in% names(gg$meta))){
stop('Missing events field in gGraph meta. Are you sure you ran gGraph::events()?')
}
if (gg$meta$events[,.N] == 0){
warning('No events annotated in this gGraph')
return(GRanges())
}
ggrl = parse.grl(gg$meta$events$footprint)
mcols(ggrl) = gg$meta$events
ggr = grl.unlist(ggrl)
return(ggr)
}
You are viewing a condensed version of this merge commit. You can view the full changes here.