Skip to content
Snippets Groups Projects

updated conversion: handle non-graphical nodes and use recent header specification

Merged Marek Ostaszewski requested to merge code_update into master
1 file
+ 8
2
Compare changes
  • Side-by-side
  • Inline
+ 8
2
@@ -90,6 +90,9 @@ write_Pathway <- function(gpml_pathway, filename) {
cys_nodedata <- function(cys_node_xgmml) {
nd_attrs <- xml_attrs(cys_node_xgmml)
gr_attrs <- xml_attrs(xml_find_first(cys_node_xgmml, "./xgmml:graphics", ns = ns_xgmml))
if(is.na(gr_attrs[1])) {
return(NULL)
}
return(data.frame(id = nd_attrs["id"], label = nd_attrs["label"],
type = xml_attrs(xml_find_first(cys_node_xgmml, "./xgmml:att[@name='mol_type']", ns = ns_xgmml))["value"],
x = as.numeric(gr_attrs["x"]), y = as.numeric(gr_attrs["y"]),
@@ -100,6 +103,9 @@ cys_nodedata <- function(cys_node_xgmml) {
cys_edgedata <- function(cys_edge_xgmml) {
eg_attrs <- xml_attrs(cys_edge_xgmml)
gr_attrs <- xml_attrs(xml_find_first(cys_edge_xgmml, "./xgmml:graphics", ns = ns_xgmml))
if(is.na(gr_attrs[1])) {
return(NULL)
}
return(data.frame(id = eg_attrs["id"], label = eg_attrs["label"],
source = eg_attrs["source"], target = eg_attrs["target"], color = gr_attrs["fill"], thickness = gr_attrs["width"]))
}
@@ -142,14 +148,14 @@ xgmml_gpml <- function(xgmml_file, output,
if(curl_image) {
message("Creating image ...")
system(paste0("curl -X POST --data-binary @", output," -H 'Content-Type: text/plain'",
system(paste0("curl -X POST --data-binary @", output," -H 'Content-Type: application/octet-stream'",
" https://minerva-dev.lcsb.uni.lu/minerva/api/convert/image/GPML:png > ",
paste0(output,".png")))
}
if(target_output != "") {
message("Translating to ...")
system(paste0("curl -X POST --data-binary @", output," -H 'Content-Type: text/plain'",
system(paste0("curl -X POST --data-binary @", output," -H 'Content-Type: application/octet-stream'",
" https://minerva-dev.lcsb.uni.lu/minerva/api/convert/GPML:", target_output," > ",
paste0(output,target_output,".xml")))
}
Loading