-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update renderSbgn and print.SBGNview
- Loading branch information
Showing
8 changed files
with
553 additions
and
242 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,52 @@ | ||
|
||
######################################################################################################### | ||
# add input user data to glyph | ||
# add.omics.data.to.glyph <- function(glyph.info, glyph, node, sbgn.id.attr, user.data) { | ||
# | ||
# node.omics.data.id <- glyph.info[sbgn.id.attr] | ||
# # remove complex name from omics.data.id for metacyc | ||
# node.omics.data.id.without.complex <- gsub("_Complex.+:@:", ":@:", node.omics.data.id) | ||
# node.omics.data.id.without.complex <- gsub("_Complex_.+", "", node.omics.data.id) | ||
# | ||
# if (!xml2::xml_attr(xml2::xml_parent(glyph), "class") %in% c("complex", "submap")) { | ||
# # molecules within a complex sometimes have different ids, so we don't count them | ||
# # when calculating the mapped nodes | ||
# } | ||
# user.data=user.data[[1]] | ||
# ################################################################ | ||
# if (node.omics.data.id %in% rownames(user.data)) { | ||
# [email protected] <- user.data[node.omics.data.id,] #user.data[[node.omics.data.id]] | ||
# if (!xml2::xml_attr(xml2::xml_parent(glyph), "class") %in% c("complex", "submap")) { | ||
# # molecules within a complex sometimes have different ids, so we don't count them | ||
# # when calculating the mapped nodes | ||
# | ||
# } | ||
# } else if (node.omics.data.id.without.complex %in% rownames(user.data)) { | ||
# [email protected] <- user.data[node.omics.data.id.without.complex,] #[[node.omics.data.id.without.complex]] | ||
# if (!xml2::xml_attr(xml2::xml_parent(glyph), "class") %in% c("complex", "submap")) { | ||
# # molecules within a complex sometimes have different ids, so we don't count them | ||
# # when calculating the mapped nodes | ||
# | ||
# } | ||
# } else { | ||
# [email protected] <- c("no.user.data") | ||
# } | ||
# if (length([email protected]) == 1) { | ||
# [email protected] <- as.matrix(t(c([email protected], [email protected]))) | ||
# } | ||
# return(list(node = node)) | ||
# } | ||
|
||
## updated function checks if user.data has gene and/or cpd | ||
## gets both gene and cpd if both exist and adds omics data to glyphs | ||
add.omics.data.to.glyph <- function(glyph.info, glyph, node, sbgn.id.attr, user.data) { | ||
|
||
user.data.1 <- user.data[[1]] # get gene data | ||
user.data.2 <- NULL | ||
if(length(user.data) > 3) { # contains both converted gene and cpd data matrix | ||
user.data.2 <- user.data[[4]] # get cpd data | ||
} | ||
|
||
node.omics.data.id <- glyph.info[sbgn.id.attr] | ||
# remove complex name from omics.data.id for metacyc | ||
node.omics.data.id.without.complex <- gsub("_Complex.+:@:", ":@:", node.omics.data.id) | ||
|
@@ -12,32 +56,46 @@ add.omics.data.to.glyph <- function(glyph.info, glyph, node, sbgn.id.attr, user. | |
# molecules within a complex sometimes have different ids, so we don't count them | ||
# when calculating the mapped nodes | ||
} | ||
user.data=user.data[[1]] | ||
################################################################ | ||
if (node.omics.data.id %in% rownames(user.data)) { | ||
node@user.data <- user.data[node.omics.data.id,] #user.data[[node.omics.data.id]] | ||
|
||
if (node.omics.data.id %in% rownames(user.data.1)) { | ||
node@user.data <- user.data.1[node.omics.data.id,] #user.data[[node.omics.data.id]] | ||
if (!xml2::xml_attr(xml2::xml_parent(glyph), "class") %in% c("complex", "submap")) { | ||
# molecules within a complex sometimes have different ids, so we don't count them | ||
# when calculating the mapped nodes | ||
|
||
} | ||
} else if (node.omics.data.id.without.complex %in% rownames(user.data)) { | ||
node@user.data <- user.data[node.omics.data.id.without.complex,] #[[node.omics.data.id.without.complex]] | ||
} else if (node.omics.data.id.without.complex %in% rownames(user.data.1)) { | ||
node@user.data <- user.data.1[node.omics.data.id.without.complex,] #[[node.omics.data.id.without.complex]] | ||
if (!xml2::xml_attr(xml2::xml_parent(glyph), "class") %in% c("complex", "submap")) { | ||
# molecules within a complex sometimes have different ids, so we don't count them | ||
# when calculating the mapped nodes | ||
|
||
} | ||
} else if (!is.null(user.data.2)) { # add data to cpd glyphs | ||
|
||
if (node.omics.data.id %in% rownames(user.data.2)) { | ||
node@user.data <- user.data.2[node.omics.data.id,] #user.data[[node.omics.data.id]] | ||
if (!xml2::xml_attr(xml2::xml_parent(glyph), "class") %in% c("complex", "submap")) { | ||
# molecules within a complex sometimes have different ids, so we don't count them | ||
# when calculating the mapped nodes | ||
} | ||
} else if (node.omics.data.id.without.complex %in% rownames(user.data.2)) { | ||
node@user.data <- user.data.2[node.omics.data.id.without.complex,] #[[node.omics.data.id.without.complex]] | ||
if (!xml2::xml_attr(xml2::xml_parent(glyph), "class") %in% c("complex", "submap")) { | ||
# molecules within a complex sometimes have different ids, so we don't count them | ||
# when calculating the mapped nodes | ||
} | ||
} | ||
|
||
} else { | ||
node@user.data <- c("no.user.data") | ||
} | ||
|
||
if (length(node@user.data) == 1) { | ||
node@user.data <- as.matrix(t(c(node@user.data, node@user.data))) | ||
} | ||
|
||
return(list(node = node)) | ||
} | ||
|
||
|
||
######################################################################################################### | ||
# generate glyph objects for glyphs found in sbgn file | ||
generate.node.obj <- function(glyph, glyph.class, glyph.info, node, if.plot.svg, y.margin, | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.