Merge branch 'baps-file' into issue-2-greedy-test

This commit is contained in:
Waldir Leoncio 2021-03-30 08:23:44 +02:00
commit 2bb94b815c
3 changed files with 7 additions and 7 deletions

View file

@ -68,19 +68,19 @@ greedyMix <- function(
# fprintf(1,'Data: %s\n',[pathname filename]); # fprintf(1,'Data: %s\n',[pathname filename]);
# end # end
data <- read.delim(pathname_filename) # TODO: discover delimiter data <- read.delim(pathname_filename, header = FALSE, sep = " ")
ninds <- testaaOnkoKunnollinenBapsData(data) # testing ninds <- testaaOnkoKunnollinenBapsData(data) # testing
if (ninds == 0) stop('Incorrect Data-file') if (ninds == 0) stop('Incorrect Data-file')
# ASK: remove? # ASK: remove?
# h0 = findobj('Tag','filename1_text'); # h0 = findobj('Tag','filename1_text');
# set(h0,'String',filename); clear h0; # set(h0,'String',filename); clear h0;
cat( message(
'When using data which are in BAPS-format,', 'When using data which are in BAPS-format,',
'you can specify the sampling populations of the', 'you can specify the sampling populations of the',
'individuals by giving two additional files:', 'individuals by giving two additional files:',
'one containing the names of the populations,', 'one containing the names of the populations,',
'the other containing the indices of the first', 'the other containing the indices of the first ',
'individuals of the populations.' 'individuals of the populations.'
) )
input_pops <- inputdlg( input_pops <- inputdlg(

View file

@ -7,13 +7,13 @@ testaaOnkoKunnollinenBapsData <- function(data) {
# Tarkastaa onko viimeisess?sarakkeessa kaikki # Tarkastaa onko viimeisess?sarakkeessa kaikki
# luvut 1,2,...,n johonkin n:<3A><>n asti. # luvut 1,2,...,n johonkin n:<3A><>n asti.
# Tarkastaa lis<69>ksi, ett?on v<>hint<6E><74>n 2 saraketta. # Tarkastaa lis<69>ksi, ett?on v<>hint<6E><74>n 2 saraketta.
if (size[data, 1] < 2) { if (size(data, 1) < 2) {
ninds <- 0 ninds <- 0
return(ninds) return(ninds)
} }
lastCol <- data[, ncol(data)] lastCol <- data[, ncol(data)]
ninds <- max(lastCol) ninds <- max(lastCol)
if (t(1:ninds) != unique(lastCol)) { if (any(1:ninds != unique(lastCol))) {
ninds <- 0 ninds <- 0
return(ninds) return(ninds)
} }

View file

@ -2,8 +2,8 @@ context("Opening files on greedyMix")
# TODO: needs #12 to be fixed before this can be done without user intervention # TODO: needs #12 to be fixed before this can be done without user intervention
greedyMix( greedyMix(
tietue = "inst/ext/ExamplesDataFormatting/Example baseline data in GENEPOP format for Trained clustering.txt", tietue = "inst/ext/ExamplesDataFormatting/Example data in BAPS format for clustering of diploid individuals.txt",
format = "GenePop", format = "BAPS",
savePreProcessed = FALSE savePreProcessed = FALSE
) # Upper bounds 100 100 ) # Upper bounds 100 100