Obtains taxa and character metadata from a nexml object

get_char_matrix_meta(nex)

Arguments

nex

a nexml object

Value

A list of two data frames. The first list item, id_taxa, contains a data frame with columns label, href (taxon IRI), otu (OTU ID) and otus (OTUs block ID) columns. The second list item, id_entities, contains a data frame with columns label, href (character ID), and char (character ID in NeXML document). For nexml objects obtained with get_ontotrace_data() the href column will contain the entity term IRI rather than the character ID, and the char column will contain the entity term ID (the term IRI without the HTTP path prefix).

Examples

# apply to (synthetic) Ontotrace data matrix
nex <- get_ontotrace_data(taxon = c("Ictalurus", "Ameiurus"), entity = "fin spine")
get_char_matrix_meta(nex)
#> $id_taxa
#>                     label                                       href
#> 1          Ameiurus catus http://purl.obolibrary.org/obo/VTO_0036275
#> 2        Ictalurus pricei http://purl.obolibrary.org/obo/VTO_0036218
#> 3     Ictalurus punctatus http://purl.obolibrary.org/obo/VTO_0036225
#> 4   Ameiurus serracanthus http://purl.obolibrary.org/obo/VTO_0036277
#> 5        Ameiurus natalis http://purl.obolibrary.org/obo/VTO_0036274
#> 6      Ictalurus furcatus http://purl.obolibrary.org/obo/VTO_0036223
#> 7       Ameiurus brunneus http://purl.obolibrary.org/obo/VTO_0036273
#> 8      Ictalurus balsanus http://purl.obolibrary.org/obo/VTO_0036221
#> 9     Ictalurus mexicanus http://purl.obolibrary.org/obo/VTO_0061498
#> 10        Ictalurus lupus http://purl.obolibrary.org/obo/VTO_0036220
#> 11 Ameiurus platycephalus http://purl.obolibrary.org/obo/VTO_0036276
#> 12     Ameiurus nebulosus http://purl.obolibrary.org/obo/VTO_0036278
#> 13    Ictalurus australis http://purl.obolibrary.org/obo/VTO_0061495
#> 14         Ameiurus melas http://purl.obolibrary.org/obo/VTO_0036272
#> 15      Ictalurus dugesii http://purl.obolibrary.org/obo/VTO_0061497
#>            otu                                  otus
#> 1  VTO_0036275 tcb028860-571e-478a-9449-947a521946a1
#> 2  VTO_0036218 tcb028860-571e-478a-9449-947a521946a1
#> 3  VTO_0036225 tcb028860-571e-478a-9449-947a521946a1
#> 4  VTO_0036277 tcb028860-571e-478a-9449-947a521946a1
#> 5  VTO_0036274 tcb028860-571e-478a-9449-947a521946a1
#> 6  VTO_0036223 tcb028860-571e-478a-9449-947a521946a1
#> 7  VTO_0036273 tcb028860-571e-478a-9449-947a521946a1
#> 8  VTO_0036221 tcb028860-571e-478a-9449-947a521946a1
#> 9  VTO_0061498 tcb028860-571e-478a-9449-947a521946a1
#> 10 VTO_0036220 tcb028860-571e-478a-9449-947a521946a1
#> 11 VTO_0036276 tcb028860-571e-478a-9449-947a521946a1
#> 12 VTO_0036278 tcb028860-571e-478a-9449-947a521946a1
#> 13 VTO_0061495 tcb028860-571e-478a-9449-947a521946a1
#> 14 VTO_0036272 tcb028860-571e-478a-9449-947a521946a1
#> 15 VTO_0061497 tcb028860-571e-478a-9449-947a521946a1
#> 
#> $id_entities
#>                                             label
#> 1        anterior dentation of pectoral fin spine
#> 2 anterior distal serration of pectoral fin spine
#>                                            href           char
#> 1 http://purl.obolibrary.org/obo/UBERON_2002001 UBERON_2002001
#> 2 http://purl.obolibrary.org/obo/UBERON_2002002 UBERON_2002002
#> 

# apply to data matrix from a study
slist <- get_studies(taxon = "Ictalurus australis", entity = "fin spine")
nex <- get_study_data(slist$id[1])[[1]]
metadata <- get_char_matrix_meta(nex)
# for brevity show only first 5 rows
metadata$id_taxa[1:5,]
#>                label                                       href
#> 1     Noturus flavus http://purl.obolibrary.org/obo/VTO_0036263
#> 2    Ictalurus lupus http://purl.obolibrary.org/obo/VTO_0036220
#> 3   Noturus insignis http://purl.obolibrary.org/obo/VTO_0036237
#> 4 Ameiurus nebulosus http://purl.obolibrary.org/obo/VTO_0036278
#> 5   Ictalurus pricei http://purl.obolibrary.org/obo/VTO_0036218
#>                                        otu
#> 1 otu_3d644586-19a2-49d5-ab3c-673f483c362f
#> 2 otu_7359fcc3-edb3-4ed9-a236-c1e846b8a5f6
#> 3 otu_dddcc44c-8c9a-40a7-a7b3-277ce9871593
#> 4 otu_31f42c8a-cd70-4bf4-994d-9bc483822ba7
#> 5 otu_da138745-cedf-4cbc-8305-0e602518548c
#>                                        otus
#> 1 otus_623e5db5-d4a5-40b9-b087-e4047cea0e75
#> 2 otus_623e5db5-d4a5-40b9-b087-e4047cea0e75
#> 3 otus_623e5db5-d4a5-40b9-b087-e4047cea0e75
#> 4 otus_623e5db5-d4a5-40b9-b087-e4047cea0e75
#> 5 otus_623e5db5-d4a5-40b9-b087-e4047cea0e75
metadata$id_entities[1:5,]
#>                           label
#> 1 Posterior flap of adipose fin
#> 2                Gill membranes
#> 3                   Orbital rim
#> 4                    Caudal fin
#> 5           Lateral line extent
#>                                                                   href
#> 1 http://purl.org/phenoscape/uuid/9a83ecb3-e4fc-4232-8144-c90dd8c9f19b
#> 2 http://purl.org/phenoscape/uuid/1c9fac46-3ea1-414a-a43b-18a8cbc94371
#> 3 http://purl.org/phenoscape/uuid/9484e795-2f20-459c-9fc0-75118931d621
#> 4 http://purl.org/phenoscape/uuid/89a17565-fb95-4d57-9db6-654724adb470
#> 5 http://purl.org/phenoscape/uuid/9480950e-79ae-4c8e-98f3-4e55663ecf8f
#>                                             char
#> 1 character_9bd0cd96-aa92-4a07-b735-83be9046467e
#> 2 character_1b7cb4d8-2021-4fe6-a43a-a32d6be9879e
#> 3 character_edea1753-087e-4f7c-8d5d-472fbe2c8f38
#> 4 character_9f3e078d-05fd-465f-b137-227d6fb847d9
#> 5 character_31d06b95-7175-4c5a-8f92-3de324699507