diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b6a065 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.Rproj.user +.Rhistory +.RData +.Ruserdata diff --git a/rfdistr/DESCRIPTION b/rfdistr/DESCRIPTION index 91eac15..61b584e 100644 --- a/rfdistr/DESCRIPTION +++ b/rfdistr/DESCRIPTION @@ -1,13 +1,11 @@ Package: rfdistr Type: Package -Title: RF distribution +Title: What the Package Does (Title Case) Version: 0.1.0 -Author: Maryam Hayati -Maintainer: The package maintainer -Description: These codes implement an improved version of the RF distribution computation by Bryant et al. -Here, we modified the dynamic programming algorithm introduced by Bryant et al for computing the distribution of RF distance -for a given tree by leveraging the Number-Theoretic Transform (NTT), and improve the running time from O(l^5) to O(l^3log(l)), -where l is the number of tips of the tree. +Author: Who wrote it +Maintainer: The package maintainer +Description: More about what it does (maybe more than one line) + Use four spaces when indenting paragraphs within the Description. License: What license is it under? Encoding: UTF-8 LazyData: true diff --git a/rfdistr/R/RF_FFT.R b/rfdistr/R/RF_FFT.R index 9989faf..d904f60 100644 --- a/rfdistr/R/RF_FFT.R +++ b/rfdistr/R/RF_FFT.R @@ -39,7 +39,7 @@ internalchildren <- function(tree,v,ntip){ } -RF_Convolve=function(tree,n){ +fft_RF_Convolve=function(tree,n){ ntip=n-1 N=tree$Nnode R=rep(list(matrix(0,(ntip-1),(ntip-1))),N) @@ -117,7 +117,7 @@ qmT=function(R,n,m){ } fft_polynomial=function(tree,n){ - R=RF_Convolve(tree,n) + R=fft_RF_Convolve(tree,n) for (i in seq(0,2*(n-3),2)) { print(qmT(R,n,n-3-(i/2))) } diff --git a/rfdistr/R/RF_NTTfromPy.R b/rfdistr/R/RF_NTTfromPy.R index 1054b53..d3e4408 100644 --- a/rfdistr/R/RF_NTTfromPy.R +++ b/rfdistr/R/RF_NTTfromPy.R @@ -46,7 +46,7 @@ internalchildren <- function(tree,v,ntip){ return(result) } -RF_Convolve=function(tree,n){ +ntt_RF_Convolve=function(tree,n){ tt=0 t=(n-4)*(n-2)*3 L= 2^ceiling(log(t)/log(2)) @@ -115,7 +115,7 @@ RF_Convolve=function(tree,n){ #read the output of Python - system('python /python_code/ntt_fromR.py') + system('python ntt_fromR.py') U=as.matrix(read.csv("outNTT.txt",header = FALSE, quote="")) @@ -157,7 +157,7 @@ qmT=function(R,n,m){ #this function computes the RF distribution ntt_polynomial=function(tree,n){ Coef=numeric() - R=RF_Convolve(tree,n) + R=ntt_RF_Convolve(tree,n) for (i in seq(0,2*(n-3),2)) { Coef=c(Coef,qmT(R,n,n-3-(i/2))) }