akoontz11 / OTU_Phylogeny

OTU threshold analysis pipeline using phylogenetic transformations
0 stars 0 forks source link

Updating analysis to compare against untransformed phylogenies #5

Closed akoontz11 closed 4 years ago

akoontz11 commented 4 years ago

I wanted to give an update on what I've been doing to update the code to compare against untransformed phylogenies.

Currently, I'm encountering issues with the worker function I'm sapplying to the simulation data. The original worker function just correlated to the 10th column (i.e. delta = 1.0) of the matrix of MPD values supplied as an argument to that function. That would typically look like

> data[[1]][,10]
   Site_1    Site_2    Site_3    Site_4    Site_5    Site_6    Site_7    Site_8    Site_9   Site_10 
30.750000 26.240000 48.000000 13.058985 38.437500 22.777778 40.163265 43.911243 49.603025 36.207500 
  Site_11   Site_12   Site_13   Site_14   Site_15   Site_16   Site_17   Site_18   Site_19   Site_20 
37.950413 60.173333 41.497041 54.294785 22.777778 39.861111 21.191111 38.437500 53.330000 40.493827 
  Site_21   Site_22   Site_23   Site_24   Site_25   Site_26   Site_27   Site_28   Site_29   Site_30 
41.000000 64.229492 35.483929 36.444444 36.384088 41.000000 38.816568 54.814404 12.187500 52.331633 
  Site_31   Site_32   Site_33   Site_34   Site_35   Site_36   Site_37   Site_38   Site_39   Site_40 
58.360285 28.126200 35.434903 51.504132 51.890625 37.950413 40.163265 33.586777 36.444444 52.714286 
  Site_41   Site_42   Site_43   Site_44   Site_45   Site_46   Site_47   Site_48 
52.382500 54.613281  2.000000 41.000000 36.444444 41.000000  8.816327  8.265306

My new worker function instead takes a vector of MPD values of the original untransformed phylogeny as a 2nd argument to the function, and correlates against that. That vector looks identical to the matrix column shown above, and using the new worker function works when I'm comparing just a single set of values.

But when I try to sapply the new worker function, I get an error reading "incompatible dimensions". I feel like this may be happening because I'm trying to sapply a function that takes multiple arguments, and I'm doing that incorrectly, but I'm not sure.

I'm still working on this, and considering if there's a means to do all of this in a more straightforward way. But I wanted to let you know where I was at.

willpearse commented 4 years ago

Great, thanks. You can give arguments to an sapply function, and there is mapply too if you need it. At any rate, good to see you're making progress!

akoontz11 commented 4 years ago

Thanks for the tip. I'm going to close this issue as I think I figured this out: a few changes were required, but the major one was that I did indeed need to use mapply.