thibautjombart / adegenet

adegenet: a R package for the multivariate analysis of genetic markers
166 stars 64 forks source link

Error with splitStrata(x) <- value #277

Closed Barsha-P closed 4 years ago

Barsha-P commented 4 years ago

Hi there, I am getting this error while trying to run splitStrata(x) <- ~value.

This is my CSV file Sorghum,2019,QLD,Dalby,287,23 Sorghum,2019,QLD,Dalby,287,22 Sorghum,2019,QLD,Brookstead,, Sorghum,2019,QLD,Dalby,287,58 Sorghum,2019,QLD,Dalby,287,26 Sorghum,2019,QLD,Dalby,287,25

Note: I have also tried removing blank spaces but doesn't make any difference.

Set strata

X <- getfile() strata.df <- read.csv(X$files, head = FALSE, sep = ",") length(strata.df) 6 head(strata.df) V1 V2 V3 V4 V5 V6 1 Sorghum 2019 QLD Dalby 287 23 2 Sorghum 2019 QLD Dalby 287 22 3 Sorghum 2019 QLD Brookstead
4 Sorghum 2019 QLD Dalby 287 58 5 Sorghum 2019 QLD Dalby 287 26 6 Sorghum 2019 QLD Dalby 287 25

strata(Isolates) <- strata.df nameStrata(Isolates) <- ~Location/State/Host/Year/FN/PL Isolates

This is a genclone object

Genotype information:

186 original multilocus genotypes 
191 haploid individuals

4859 codominant loci

Population information:

  6 strata - Location, State, Host, Year, FN, PL
  0 populations defined. 

splitStrata(Isolates) <- ~Location/State/Host/Year/FN/PL

Error: Data has 1 level of strata with the separator _ . Here is the first column of the data: Sorghum In addition: Warning message: Strata must be length 1. Taking the first column.

Might be an obvious mistake but I am not able to figure it out.

Thanks Barsha

zkamvar commented 4 years ago

Hi @Barsha-P,

Thank you for your patience on this. You do not need to use splitStrata() in this situation. It was designed for use with genetic file formats that only expected one level of population stratification. Since you have a data frame, you do not need to use splitStrata(). I hope that helps.