Skip to content

Commit

Permalink
change the parsing pattern in process_reaction
Browse files Browse the repository at this point in the history
  • Loading branch information
noriakis committed Dec 2, 2023
1 parent c4e565c commit 063f484
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions R/pathway_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -430,13 +430,15 @@ process_reaction <- function(g, single_edge=FALSE, keep_no_reaction=TRUE) {
new_eds$from <- as.integer(new_eds$from)
new_eds$to <- as.integer(new_eds$to)
if (keep_no_reaction) {
for (coln in colnames(no_reacs)) {
if (!coln %in% colnames(new_eds)) {
new_eds[[coln]] <- NA
if (dim(no_reacs)[1]!=0) {## If the no-reaction row is present
for (coln in colnames(no_reacs)) {
if (!coln %in% colnames(new_eds)) {
new_eds[[coln]] <- NA
}
}
new_eds <- new_eds[,colnames(no_reacs)]
new_eds <- rbind(no_reacs, new_eds)
}
new_eds <- new_eds[,colnames(no_reacs)]
new_eds <- rbind(no_reacs, new_eds)
}
new_g <- tbl_graph(nodes=nds, edges=new_eds)
new_g
Expand Down

0 comments on commit 063f484

Please sign in to comment.