Skip to content

Commit

Permalink
Move rfdistr git repository into this repository
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankWhoee committed Aug 15, 2019
1 parent a19316c commit 08483ae
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
12 changes: 5 additions & 7 deletions rfdistr/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
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 <[email protected]>
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
4 changes: 2 additions & 2 deletions rfdistr/R/RF_FFT.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)))
}
Expand Down
6 changes: 3 additions & 3 deletions rfdistr/R/RF_NTTfromPy.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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=""))

Expand Down Expand Up @@ -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)))
}
Expand Down

0 comments on commit 08483ae

Please sign in to comment.