-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
132 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
citHeader("To cite phylofactor in publications, please use:") | ||
|
||
citEntry(entry = "article", | ||
|
||
title = "Phylogenetic factorization of compositional data yields lineage-level associations in microbiome data", | ||
|
||
author = personList(person("Washburne", "Alex D."), | ||
person("Silverman", "Justin D."), | ||
person("Leff", "Jonathan W."), | ||
person("Bennett", "Dominic J."), | ||
person("Darcy", "John L."), | ||
person("Mukherjee", "Sayan"), | ||
person("Fierer", "Noah"), | ||
person("David", "Lawrence A.")), | ||
|
||
journal = "PeerJ", | ||
|
||
year = "2017", | ||
|
||
volume = "5:e2969", | ||
|
||
url = "https://doi.org/10.7717/peerj.2969", | ||
|
||
textVersion = paste("Washburne AD, Silverman JD, Leff JW, Bennett DJ, Darcy JL, Mukherjee S, Fierer N, and David LA (2017)", | ||
|
||
"Phylogenetic factorization of compositional data yields lineage-level associations in microbiome data", | ||
|
||
"PeerJ. 5:e2969", | ||
|
||
"https://doi.org/10.7717/peerj.2969"), | ||
|
||
) |
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <R.h> | ||
#include <Rinternals.h> | ||
#include <stdlib.h> // for NULL | ||
#include <R_ext/Rdynload.h> | ||
|
||
/* FIXME: | ||
Check these declarations against the C/Fortran source code. | ||
*/ | ||
|
||
/* .Call calls */ | ||
extern SEXP bifurcations(SEXP, SEXP, SEXP); | ||
|
||
static const R_CallMethodDef CallEntries[] = { | ||
{"bifurcations", (DL_FUNC) &bifurcations, 3}, | ||
{NULL, NULL, 0} | ||
}; | ||
|
||
void R_init_phylofactor(DllInfo *dll) | ||
{ | ||
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); | ||
R_useDynamicSymbols(dll, FALSE); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#include <R.h> | ||
#include <Rinternals.h> | ||
|
||
// find the connecting edge from a node | ||
int getEdg(int nd, int * edge1, int * edge2, | ||
int nedges) | ||
{ | ||
int i; | ||
int edg=-1; | ||
for (i=0;i<nedges;i++) { | ||
if (nd==edge2[i]) { | ||
edg=i; | ||
break; | ||
} | ||
} | ||
return edg; | ||
} | ||
|
||
// find the connecting edge from an edge | ||
int cnnctngEdg(int edge, int * edge1, int * edge2, | ||
int nedges) | ||
{ | ||
int nxt; | ||
int nd=edge1[edge]; | ||
nxt = getEdg(nd, edge1, edge2, nedges); | ||
return nxt; | ||
} | ||
|
||
// return array of edge bipartitions | ||
SEXP bifurcations(SEXP e1, SEXP e2, | ||
SEXP nts) | ||
{ | ||
int i; | ||
int edg; | ||
SEXP res; | ||
int* edge1 = INTEGER(e1); | ||
int* edge2 = INTEGER(e2); | ||
int nedges = length(e1); | ||
int ntips = asInteger(nts); | ||
PROTECT(res=allocMatrix(INTSXP, nedges, ntips)); | ||
int n = length(res); | ||
for(i=0;i<n; i++) { | ||
INTEGER(res)[i] = 0; | ||
} | ||
for(i=0;i<ntips; i++) { | ||
edg=getEdg(i+1, edge1, edge2, nedges); | ||
INTEGER(res)[edg + i * nedges]=1; | ||
edg=cnnctngEdg(edg, edge1, edge2, nedges); | ||
while(edg!=-1) { | ||
INTEGER(res)[edg + i * nedges]=1; | ||
edg=cnnctngEdg(edg, edge1, edge2, nedges); | ||
} | ||
} | ||
UNPROTECT(1); | ||
return res; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include <R.h> | ||
#include <Rinternals.h> | ||
#include <stdlib.h> // for NULL | ||
#include <R_ext/Rdynload.h> | ||
|
||
/* FIXME: | ||
Check these declarations against the C/Fortran source code. | ||
*/ | ||
|
||
/* .Call calls */ | ||
extern SEXP bifurcations(SEXP, SEXP, SEXP); | ||
|
||
static const R_CallMethodDef CallEntries[] = { | ||
{"bifurcations", (DL_FUNC) &bifurcations, 3}, | ||
{NULL, NULL, 0} | ||
}; | ||
|
||
void R_init_phylofactor(DllInfo *dll) | ||
{ | ||
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); | ||
R_useDynamicSymbols(dll, FALSE); | ||
} |