Skip to content

Commit

Permalink
devtools build with citation
Browse files Browse the repository at this point in the history
  • Loading branch information
reptalex committed Dec 6, 2017
1 parent 1dac641 commit 142626f
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 15 deletions.
32 changes: 32 additions & 0 deletions inst/CITATION
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"),

)
15 changes: 0 additions & 15 deletions inst/CITATION.txt

This file was deleted.

Binary file modified src-i386/phylofactor.dll
Binary file not shown.
22 changes: 22 additions & 0 deletions src-i386/phylofactor_init.c
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);
}
56 changes: 56 additions & 0 deletions src-x64/bifurcations.c
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 added src-x64/phylofactor.dll
Binary file not shown.
22 changes: 22 additions & 0 deletions src-x64/phylofactor_init.c
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);
}

0 comments on commit 142626f

Please sign in to comment.