SchlossLab / clustur

Cluster algorithms from mothur in R
http://www.schlosslab.org/clustur/
Other
0 stars 0 forks source link

Questions if distance matrices/count tables come from within R #24

Open pschloss opened 3 weeks ago

pschloss commented 3 weeks ago

Currently we read in distance matrices and count tables from disk as if they were generated by mothur. But, if they were generated in R, how do we hand off the data to clustur without writing to/reading from disk?

This should be "easy" to do... Could we have a conversion function that converts between an object from stats::dist() or sparseMatrix and our read_dist() object or a data.frame object and our read_count() object? Possible functions convert_dist() / convert_count()

More challenging... Could we pass a memory address between packages? For example, if down the road we create a calc_dist() function that stores the distances as a pointer to a C++ object, can we pass that object to cluster() or do we need to output to a data.frame and then convert that to our pointer? What are the memory/speed considerations here? Are deep copies generated? It would be good to set up a toy package to see if we can create the pointer and pass it to cluster.