Skip to contents

produce list of vectors of (shortest) paths from root to all nodes in gr

Usage

graph2paths(gr, root = "http://www.ifomis.org/bfo/1.1#Entity", excise = NULL)

Arguments

gr

graphNEL (package graph) instance representing an ontology

root

character(1) node from which to produce paths

excise

character() or NULL, path steps to exclude

Examples

if (!requireNamespace("graph")) stop("install graph package from Bioconductor to use this function")
jpath = system.file("json", "aut.json.gz", package="ontoProc")
cg = jowl2classgraph(jpath,
  dropstrings = "http://purl.org/autism-ontology/1.0/autism-rules.owl#")
evec = grep("span\\#|snap\\#", graph::nodes(cg), value=TRUE)
paths = graph2paths(cg, excise=evec)
tail(paths)
#> [[1]]
#> [1] "http://www.ifomis.org/bfo/1.1#Entity"           
#> [2] "Autism Phenotype"                               
#> [3] "Personal Traits"                                
#> [4] "Cognitive Ability"                              
#> [5] "Abstract Thinking"                              
#> [6] "Imagination"                                    
#> [7] "Imaginative Play With Peers"                    
#> [8] "Some Play With Other Children BUT No Pretending"
#> 
#> [[2]]
#> [1] "http://www.ifomis.org/bfo/1.1#Entity"
#> [2] "Autism Phenotype"                    
#> [3] "Personal Traits"                     
#> [4] "Executive Function"                  
#> [5] "Planning"                            
#> [6] "Preparing forPreparing Tasks"        
#> 
#> [[3]]
#> [1] "http://www.ifomis.org/bfo/1.1#Entity"                  
#> [2] "Autism Phenotype"                                      
#> [3] "Personal Traits"                                       
#> [4] "Stereotyped Restricted and Repetitive Behavior"        
#> [5] "Restricted and Repetitive Behavior"                    
#> [6] "Restricted and Unusual Interests"                      
#> [7] "Circumscribed Interests"                               
#> [8] "Circumscribed InterestsCircumscribed UnknownOrNotAsked"
#> 
#> [[4]]
#> [1] "http://www.ifomis.org/bfo/1.1#Entity"
#> [2] "Autism Phenotype"                    
#> [3] "Social Competence"                   
#> [4] "Recognition of Social Norms"         
#> [5] "Intentional BadIntentional Behavior" 
#> 
#> [[5]]
#> [1] "http://www.ifomis.org/bfo/1.1#Entity"                            
#> [2] "Autism Phenotype"                                                
#> [3] "Social Competence"                                               
#> [4] "Interpersonal Interactions"                                      
#> [5] "Reciprocal SocialReciprocal Interaction"                         
#> [6] "Joint Attention"                                                 
#> [7] "Seeking To Share herHis Enjoyment With Others"                   
#> [8] "Seeking To Share herHis Enjoyment With Others NotKnownOrNotAsked"
#> 
#> [[6]]
#> [1] "http://www.ifomis.org/bfo/1.1#Entity"
#>