Merge branch 'issue-3' into develop

This commit is contained in:
Waldir Leoncio 2023-01-23 11:22:19 +01:00
commit 4ba4d4b934
3 changed files with 22 additions and 3 deletions

View file

@ -1,6 +1,6 @@
Package: rBAPS
Title: Bayesian Analysis of Population Structure
Version: 0.0.0.9015
Version: 0.0.0.9016
Date: 2020-11-09
Authors@R:
c(

View file

@ -10,7 +10,7 @@ dec2bitv <- function(d, n) {
d <- d[]
f <- e <- NA
c(f, e) <- matlab2r::log2(max(d)) # How many digits do we need to represent the numbers?
bits <- floor(d * 2 ^ (seq(1 - max(n, e), 0))) %% 2
c(f, e) %<-% matlab2r::log2(max(d)) # How many digits do we need to represent the numbers?
bits <- floor(d * 2 ^ (seq(1 - max(n, e), 0))) %% 2
return(bits)
}

19
R/testFastaData.R Normal file
View file

@ -0,0 +1,19 @@
testFastaData <- function(inFile) {
# added by Lu Cheng, 11.11.2012
if (!exists(inFile, 'file')) {
stop('Fasta file ', inFile, ' does not exist!')
}
seqs <- load_fasta(inFile)
heds <- colnames(seqs)
ninds <- length(seqs)
data <- as.matrix(seqs)
newData <- ones(size(data)) * -9
newData[toupper(data) == 'A'] <- 1
newData[toupper(data) == 'C'] <- 2
newData[toupper(data) == 'G'] <- 3
newData[toupper(data) == 'T'] <- 4
data <- c(newData, t(1:ninds))
return(list("ninds" = ninds, "data" = data, "heds" = heds))
}