-
Notifications
You must be signed in to change notification settings - Fork 4
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
Linking 'taxlist' and 'taxa' #2
Comments
I continued with the vignette and am, in my opinion, one step forward. Though this may not be the most elegant way to do it, but I can construct parental lines as follows: plant_hierarchy <- list()
plant_hierarchy[[1]] <- plant_table$TaxonConceptID
i <- 2
repeat{
plant_hierarchy[[i]] <- plant_table$Parent[match(plant_hierarchy[[i - 1]],
plant_table$TaxonConceptID)]
i <- i + 1
if(!all(is.na(plant_hierarchy[[i - 1]]))) next else break
}
plant_hierarchy <- do.call(cbind, plant_hierarchy)[,-length(plant_hierarchy)] I can even go farther and produce a list with those hierarchies (discarding the top ranks). plant_hierarchy <- split(plant_hierarchy, 1:nrow(plant_hierarchy))
plant_hierarchy <- lapply(plant_hierarchy, function(x) x[!is.na(x)])
plant_hierarchy <- plant_hierarchy[sapply(plant_hierarchy, function(x) length(x) > 1)] Now is my question, can I use those vectors (which are the taxon identifiers) as indexes in Perhaps I should also include @sckott in this discussion. |
Hi @kamapu, I will look at this more soon, but I think we will be able to do this using |
Hi @kamapu, sorry for the delay. I meant # devtools::install_github("ropensci/taxa", ref = "eval")
library(taxlist)
library(taxa)
parse_taxlist <- function(intput) {
# Use the edge list to start making the intput object
obj = taxa:::parse_edge_list(intput@taxonRelations, taxon_id = "TaxonConceptID", supertaxon_id = "Parent", taxon_name = "TaxonConceptID", taxon_rank = "Level")
names(obj$data) <- c("relations")
# Set taxon names and authorities
concept_data <- intput@taxonNames[! duplicated(intput@taxonNames$TaxonConceptID), ]
obj$set_taxon_names(concept_data$TaxonName[match(obj$taxon_ids(), concept_data$TaxonConceptID)])
obj$set_taxon_auths(concept_data$AuthorName[match(obj$taxon_ids(), concept_data$TaxonConceptID)])
# Add traits table to the intputect
obj$data$traits <- intput@taxonTraits
names(obj$data$traits)[1] <- "taxon_id"
# Add views table to the intputect
obj$data$views <- intput@taxonViews
# Add synonyms in a table
obj$data$synonyms <- intput@taxonNames[duplicated(intput@taxonNames$TaxonConceptID), c("TaxonConceptID", "TaxonName", "AuthorName")]
names(obj$data$synonyms) <- c("taxon_id", "synonym", "synonym_authority")
return(obj)
}
obj <- parse_taxlist(Easplist)
obj
|
@zachary-foster
|
Its on the "eval" branch of taxa. Do you mean on a fork of
In a way, but not explicitly.
Sounds good. Let me know if you need help with manipulating |
OK. If you don't mind @zachary-foster I will just copy the code and adapt it to a function in |
That is fine with me
Perhaps not with the function I wrote, but it should be possible. |
Hello @zachary-foster library(devtools)
install_github("kamapu/taxlist", ref="miguel")
install_github("ropensci/taxa", ref="eval") I included an R-image with three examples:
library(taxlist)
library(taxa)
load(file.path(path.package("taxlist"), "taxlist_examples/examples.Rda")) Export to Test1 <- taxlist2taxmap(data1)
Test2 <- taxlist2taxmap(data2)
Test3 <- taxlist2taxmap(data3) For the export back, there is the function
Note that the later is working with the example from package |
Some comments to my later message:
|
Hi @kamapu Cool, I hope you had a nice trip!
Is the R image in the package or was it supposed to be attached to this issue? I don't see it.
Yes, it will be merged eventually. I am hoping to get a change to work on it soon.
Thats ok, I think I will remove that warning eventually. It happens when you filter taxa but some of the data is not classified by taxa so it cant be filtered.
It should be working, but I have seen that error once before, but have never been able to reproduce it. If I can reproduce it with the code you supplied, perhaps I can finally fix it!
You mean how much RAM it takes? I am not sure. Its probably a difference between how S4 and R6 stores data. R6 is pretty lightweight as I understand it. I don't have much experience with S4. I will look into it when I test out the code. |
Hi @zachary-foster : Here a quick reply.
The image will be installed with library(devtools)
install_github("kamapu/taxlist", ref="miguel") Then you just need following command to get the objects in your session: library(taxlist)
load(file.path(path.package("taxlist"), "taxlist_examples/examples.Rda")) Note, this image is not in master.
Yes, I meant the allocated RAM. If you compare outputs of Regarding the warning message, I assume, it is OK, eventhough some users get scared from warnings (they confuse them with error messages) and it can cause some troubles when checking examples. Just to remind you, the export/import functions were requested by the editor to proceed with the submission of |
Thanks for the info on finding the test data! I did not see it in your first message until now. These function seem to work fine for me, at least with the test data. I cannot replicate the In regards to memory use, I recommend using
Ok, i will try to get eval pushed to master soon. |
@zachary-foster some news on this regard? |
I am currently rewriting the fundamental classes of |
Hi @kamapu, it should work with |
Great! I tested it and got no errors! |
@zachary-foster Is there a release of the current version of |
I had not planned one, but I probably could release an updated version to CRAN if you need. I am about 70% done rewriting |
I'll need a new version of |
New version of |
Dear @zachary-foster
I'll need your support in this matter. I started with a first attempt to export an object of class
taxlist
to one intaxa
(I'm not sure now which one, but I'm browsing your vignette from the beginning on).Here an script creating the example object and handlling it:
And then, I got a brain jam. My next step would be to use the function
hierarchy()
to establish parent-child relationships but the example in the documentation seems to be much more simple than this case. Inplant_table
I included the information on parent taxa for genus and lower ranks. Can I use it in one command for establishing the hierarchy in objectplant_taxon
? How?The text was updated successfully, but these errors were encountered: