Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add taxon ids for names to table column output in get_data #48

Closed
2 tasks done
zachary-foster opened this issue May 31, 2017 · 1 comment
Closed
2 tasks done
Assignees
Milestone

Comments

@zachary-foster
Copy link
Collaborator

zachary-foster commented May 31, 2017

get_data returns this:

> ex_taxmap$get_data()
$taxon_names
             1              2              3              4              5              6              7              8              9 
    "Mammalia"      "Plantae"      "Felidae" "Notoryctidae"    "Hominidae"   "Solanaceae"     "Panthera"        "Felis"   "Notoryctes" 
            10             11             12             13             14             15             16             17 
        "homo"      "Solanum"       "tigris"        "catus"     "typhlops"      "sapiens" "lycopersicum"    "tuberosum" 

$taxon_ids
 [1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10" "11" "12" "13" "14" "15" "16" "17"

$taxon_indexes
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17

$n_supertaxa
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 
 0  0  1  1  1  1  2  2  2  2  2  3  3  3  3  3  3 

$n_subtaxa
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 
11  4  4  2  2  3  1  1  1  1  2  0  0  0  0  0  0 

$n_subtaxa_1
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 
 3  1  2  1  1  1  1  1  1  1  2  0  0  0  0  0  0 

$name
[1] tiger  cat    mole   human  tomato potato
Levels: cat human mole potato tiger tomato

$n_legs
[1] 4 4 4 2 0 0

$dangerous
[1]  TRUE FALSE FALSE  TRUE FALSE FALSE

$phylopic_ids
                                    12                                     13                                     14 
"e148eabb-f138-43c6-b1e4-5cda2180485a" "12899ba0-9923-4feb-a7f9-758c3c7d5e13" "11b783d5-af1c-4f4e-8ab5-a51470652b47" 
                                    15                                     16                                     17 
"9fae30cd-fb59-4a81-a39c-e1826a35f612" "b6400f39-345a-4711-ab4f-92fd4e22cb1a" "63604565-0406-460b-8cb8-1abe954b3f3a" 

$foods
$foods$`12`
[1] "mammals" "birds"  

$foods$`13`
[1] "cat food" "mice"    

$foods$`14`
[1] "insects"

$foods$`15`
[1] "Most things, but especially anything rare or expensive"

$foods$`16`
[1] "light" "dirt" 

$foods$`17`
[1] "light" "dirt" 


$reaction
[1] "Watch out! That tiger might attack!" "No worries; its just a cat."         "No worries; its just a mole."       
[4] "Watch out! That human might attack!" "No worries; its just a tomato."      "No worries; its just a potato." 

Note how entries like "dangerous" that came from tables in ex_taxmap$data are not named by taxon id.
Not all tables have a "taxon_id" column, but if it is there, then they should be named.

  • make private function to get the taxon ids for things in ex_taxmap$data by name
  • Add taxon ids to output when possible
@zachary-foster zachary-foster added this to the v0.1 milestone May 31, 2017
@zachary-foster zachary-foster self-assigned this May 31, 2017
@zachary-foster
Copy link
Collaborator Author

I thin I have it working:

> ex_taxmap$get_data()
$taxon_names
             1              2              3              4              5              6              7              8              9 
    "Mammalia"      "Plantae"      "Felidae" "Notoryctidae"    "Hominidae"   "Solanaceae"     "Panthera"        "Felis"   "Notoryctes" 
            10             11             12             13             14             15             16             17 
        "homo"      "Solanum"       "tigris"        "catus"     "typhlops"      "sapiens" "lycopersicum"    "tuberosum" 

$taxon_ids
 [1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10" "11" "12" "13" "14" "15" "16" "17"

$taxon_indexes
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 

$n_supertaxa
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 
 0  0  1  1  1  1  2  2  2  2  2  3  3  3  3  3  3 

$n_subtaxa
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 
11  4  4  2  2  3  1  1  1  1  2  0  0  0  0  0  0 

$n_subtaxa_1
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 
 3  1  2  1  1  1  1  1  1  1  2  0  0  0  0  0  0 

$taxon_ranks
        1         2         3         4         5         6         7         8         9        10        11        12        13 
  "class" "kingdom"  "family"  "family"  "family"  "family"   "genus"   "genus"   "genus"   "genus"   "genus" "species" "species" 
       14        15        16        17 
"species" "species" "species" "species" 

$is_root
    1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16    17 
 TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 

$is_stem
    1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16    17 
 TRUE  TRUE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE 

$is_branch
    1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16    17 
FALSE FALSE  TRUE  TRUE  TRUE FALSE  TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE 

$is_leaf
    1     2     3     4     5     6     7     8     9    10    11    12    13    14    15    16    17 
FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE 

$name
    12     13     14     15     16     17 
 tiger    cat   mole  human tomato potato 
Levels: cat human mole potato tiger tomato

$n_legs
12 13 14 15 16 17 
 4  4  4  2  0  0 

$dangerous
   12    13    14    15    16    17 
 TRUE FALSE FALSE  TRUE FALSE FALSE 

$phylopic_ids
                                    12                                     13                                     14 
"e148eabb-f138-43c6-b1e4-5cda2180485a" "12899ba0-9923-4feb-a7f9-758c3c7d5e13" "11b783d5-af1c-4f4e-8ab5-a51470652b47" 
                                    15                                     16                                     17 
"9fae30cd-fb59-4a81-a39c-e1826a35f612" "b6400f39-345a-4711-ab4f-92fd4e22cb1a" "63604565-0406-460b-8cb8-1abe954b3f3a" 

$foods
$foods$`12`
[1] "mammals" "birds"  

$foods$`13`
[1] "cat food" "mice"    

$foods$`14`
[1] "insects"

$foods$`15`
[1] "Most things, but especially anything rare or expensive"

$foods$`16`
[1] "light" "dirt" 

$foods$`17`
[1] "light" "dirt" 


$reaction
[1] "Watch out! That tiger might attack!" "No worries; its just a cat."         "No worries; its just a mole."       
[4] "Watch out! That human might attack!" "No worries; its just a tomato."      "No worries; its just a potato."     

zachary-foster added a commit that referenced this issue May 31, 2017
* resolves issue #48
* replaces functions extract_taxon_ids and get_data_taxon_ids with new version of get_data_taxon_ids
* updated ex_taxmap object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant