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

Pollinators-bees system data #12

Open
SteveViss opened this issue Dec 4, 2016 · 25 comments
Open

Pollinators-bees system data #12

SteveViss opened this issue Dec 4, 2016 · 25 comments

Comments

@SteveViss
Copy link
Contributor

Hi @ibartomeus,

It will be nice to include your data as part of the package (data folder).
Hence, I can use them to do do some unit testing on package functionalities.

Let me know what do you think,
Cheers.

@ibartomeus
Copy link
Contributor

ibartomeus commented Dec 4, 2016 via email

@SteveViss
Copy link
Contributor Author

SteveViss commented Dec 4, 2016

Perfect, let me know if you need help (by writing on this issue). That was nice to meet you! Have a good trip!

@ibartomeus
Copy link
Contributor

Data available at : https://github.com/bw4sz/Montreal_Workshop/tree/master/Data
Before pushing it to this repo I have a few questions:

Interactions, plant and pollinator datasets can be merged, should I upload just one unique dataset? Or the three tables separately?

Other issues:
-I still need to fetch some more pollinator traits, as there are too many NA's for now.

  • Phylogeny: Plant data can be obtained from phylomatic, but any idea about pollinator data? I have a dated bee tree (in nexus) for bee genera, but I wouldn't want to exclude flies, vespids, beetles,... Maybe we can build an undated taxonomic tree depicting the relationships among genara, families, orders?

@SteveViss
Copy link
Contributor Author

Hi @ibartomeus,

I started to work on your issue before leaving for vacation. I'm still working on it. What I'm doing is this: I'm writing an update to your markdown document (montreal_workshop repo) to add a new section which reshape your data in order to get the data input format needed by the function as.alienData(). The idea is to use a standard format (which is the output of the as.alienData() function) and store the output in /data/.

@ibartomeus
Copy link
Contributor

Great, I'll have updated and hopefully final data (same format) next week. Happy to help!

@ibartomeus
Copy link
Contributor

@SteveViss I don't see any update in the M_w repo. If you tell me the data format needed I can try to do it this week and get data part done!

@SteveViss
Copy link
Contributor Author

@ibartomeus, sorry for the delay. I restart to work on this today, I'll push before the end of the day. Can you tell me what means IT in the pol_tr data.frame?

@ibartomeus
Copy link
Contributor

Intertegular distance. A proxy of body size.

Just let me know what do you need next.

@SteveViss
Copy link
Contributor Author

library(devtools)
install_github("TheoreticalEcosystemEcology/alienR", ref = "alienData")
library("alienR")
load("data/argsAlienData.RData") # How I created this file is explained in the explnation.Rmd. File is in attachment
dataBartomeus <- as.alienData(idObs=idObs,interactPair=interactPair,traitInd=traitInd,traitSp=traitSp)
str(dataBartomeus)

head(dataBartomeus$idObs)
head(dataBartomeus$interactSp) #being this a bipartite netw, you don't want to have a square matrix here
dim(dataBartomeus$interactSp)
head(dataBartomeus$interactInd)
dim(dataBartomeus$interactInd) #same here, this is quite a waste of space, because most indiv won't interact with others, and certainly not with themselves
head(dataBartomeus$coOcc) #this I think is not well calculated. SHould be from idObs
head(dataBartomeus$traitSp)
head(dataBartomeus$traitInd)

@SteveViss
Copy link
Contributor Author

@ibartomeus, you're the specialist. So I'll include of these comments.
Thanks !

@ibartomeus
Copy link
Contributor

Sorry I should have used the issue and not the mail. some details:

I don't get how cOcc is created from the interaction matrix (interactPair) as this do not has any information on where and when. I expect co-ocurrence ignores real interactions and only uses if two species are present at the same time (Round in my case) and place (site in my case). Right? This would need to be amended if I am right.

as.alienData also create potential interaction matrices that are squared. This lead to a lot of structural NA's in bipartite networks, which IMO are suboptimal.

SteveViss added a commit that referenced this issue Feb 17, 2017
SteveViss pushed a commit that referenced this issue Feb 17, 2017
* Added the as.alienData function with help file written in roxygen2

* CamelCase functions

* restore Bartomeus data file in R/

* Fixing issue with weight_sd and weight_mean functions

* removin weight_mean and weigthed_sd, already present in stats - close  #17

* Rebuild package and add new clean target in makefile

* fixinx syntax issues

* code review; fix minor issues/syntax errors

* Set mandatory idObs object in as.alienData() #21

* cleaning up data format

* removing ressourceConsumer matrix

* Details on roxygen documentation

* Add data consistency among interacPair and idObs #21

* set build interac matrix #21

* Add interacSp and interacInd from interacPair

* finish to reference interacSp and interacInd with idObs #21

* check consistency among traitSp and traitInd with idObs #21

* imp. coOcc methods: inferred or not; last checks on out objects; make sure coOcc rownames and colnames reffered to idObs

* make sure siteEnv are referenced in idObs #21

* build doc of as.alienData function

* Push last edits on as.alienData function

* set traitSp and traitInd as long format

* fixing functions errors

* Fixing last issue with res

* building docs; and close #21

* Add data and test it

* Add comments on as.alienData posible enhancements

* set Nacho's comments in issue #12

* set bartomeus in data folder

* init as.alienData test

* init test on integrity #18

* cover unit tests as.alienData() - issue #18

* add unit tests to data structure issue #18
@SteveViss
Copy link
Contributor Author

@ibartomeus:

as.alienData also create potential interaction matrices that are squared. This lead to a lot of structural NA's in bipartite networks, which IMO are suboptimal.

This is much easier to make tests on matrices, than a long format data.frame. But I'm still open to store interactInd and interactSp in long format data.frame if this is what you have in mind.

Thanks,

@SteveViss
Copy link
Contributor Author

head(dataBartomeus$coOcc) #this I think is not well calculated. SHould be from idObs

According to your comment @ibartomeus, the coOcc matrix will be obtained from this order:

  1. Provides by the user
  2. Derived from the coAbund matrix
  3. Derived from idObs

I'm fine with that.

@ibartomeus
Copy link
Contributor

Good for the coOcc! Regarding the interactSp, whatever is wise programmatically is ok with me. I think in long formats, but It0s not important if it works fine in the package.

@SteveViss
Copy link
Contributor Author

I don't get how cOcc is created from the interaction matrix (interactPair) as this do not has any information on where and when. I expect co-ocurrence ignores real interactions and only uses if two species are present at the same time (Round in my case) and place (site in my case).

This part is done, have a look here: https://github.com/TheoreticalEcosystemEcology/alien/blob/alienData/R/as.alienData.R#L360-L372

@ibartomeus
Copy link
Contributor

Thanks, now looks good to me!

@SteveViss
Copy link
Contributor Author

@MoralesCastilla, Do you still working on the phylo? I'm not familiar with it but I might help you to include it in the as.alienData() function. Let me know !

@MoralesCastilla
Copy link
Contributor

MoralesCastilla commented Mar 2, 2017

Hi Steve, I'm working into assembling the pollinator phylogeny to run the different models with Nacho's data. The plant phylogeny is ready. I guess that for coding purposes we could use the plant phylogeny and a dummy pollinator phylogeny (until I manage to build a final version). I have seen that you coded the phylo param as a square matrix (I'm assuming you mean the patristic phylogenetic distance matrix). I wonder if we could input the phylogeny as a "phylo" object instead, which is the most common format for phylogenies in R (https://cran.rstudio.com/web/packages/ape/index.html). By doing so we would avoid loosing information and we can always transform the phylo object into a square phylogenetic distance matrix using the function cophenetic.phylo(). Let me know if you need me to upload the phylogenies as they are to the data folder (I'm happy to upload them as either phylo objects or square matrices).

@SteveViss
Copy link
Contributor Author

I wonder if we could input the phylogeny as a "phylo" object instead, which is the most common format for phylogenies in R (https://cran.rstudio.com/web/packages/ape/index.html). By doing so we would avoid loosing information and we can always transform the phylo object into a square phylogenetic distance matrix using the function cophenetic.phylo().

Sure, I'm fine with the phyloobject. I'll have to set new tests in the as.alienData to make sure this object class is passed to the function and species are consistent with the data.frame idObs(see here).

Thanks @MoralesCastilla !

@SteveViss
Copy link
Contributor Author

Hi @MoralesCastilla, any progress on the phylo object? Let me know if you need help.

@MoralesCastilla
Copy link
Contributor

MoralesCastilla commented Mar 28, 2017

Hi @SteveViss, I have pushed a bit of code to include phylo objects in asAlienData. It would need to be reviewed as the ape package is required to read the class phylo. I have not added the code directly on asAlienData to avoid unwanted changes. Let me know if it is ok.

@SteveViss
Copy link
Contributor Author

Hi @MoralesCastilla, Nice, I'll will have a look at it. I will open a new issue if any things are missings or have to be improve. Travel safe.

@SteveViss
Copy link
Contributor Author

@ibartomeus, when you have a moment, can you take a look at the data(plantsPol) to make sure data stored is accurate? I might go back to your alienData object later to fulfill missing taxonomic informations at higher levels. We might think of adding the phylogenetic informations of your species at family level as @MoralesCastilla suggested in the Montreal_workshop repo.

@ibartomeus
Copy link
Contributor

Looks ok to me. @MoralesCastilla Where is the phylo for plants? Can we add it already? And which is the best way to construct the phylo for pollinators (using a distance metric of its taxonomy?)

@SteveViss
Copy link
Contributor Author

@ibartomeus in the Montreal_workshop repo: https://github.com/bw4sz/Montreal_Workshop/tree/master/Data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants