thierrygosselin / assigner

Population assignment analysis using R
http://thierrygosselin.github.io/assigner
GNU General Public License v3.0
17 stars 6 forks source link

Error in bind_rows_(x, .id) #12

Closed aford29 closed 5 years ago

aford29 commented 6 years ago

Hi there,

I am new to assignment analysis and found your package straight forward and somewhat easy to use. I have a panel of SNP information in genepop format and everytime I run the assignment_ngs() function I get the following error:

assignment12 <- assignment_ngs(tidy12, assignment.analysis = "gsi_sim", sampling.method = "ranked", thl = 0.5, snp.ld = NULL, iteration.subsample = 10, common.markers = FALSE, blacklist.id = NULL, subsample = 5, filename = "12SNP-Panel-run.txt", keep.gsi.files = FALSE, pop.levels = NULL, random.seed = 100, folder = "Vivax12") ####################################################################### ###################### assigner::assignment_ngs ####################### ####################################################################### Assignment analysis with gsi_sim Folder: /Users/aford29/Downloads/Vivax12/ Scanning for monomorphic markers... Number of markers before/blacklisted/after: 12/0/12

Tidy genomic data: Number of markers: 12 Number of chromosome/contig/scaffold: no chromosome info Number of individuals: 294 Number of populations: 5 Subsampling: selected Analyzing subsample: 1 Conducting Assignment analysis with ranked markers Using thl method, ranking Fst with training samples... Holdout samples saved in your folder Starting parallel computations for the assignment analysis: ranked markers For progress: monitor activity in the folder... | | 0%, ETA NA Compiling results Error in bindrows(x, .id) : Argument 1 must have names In addition: Warning messages: 1: In dir.create(file.path(directory)) : '/Users/aford29/Downloads/Vivax12' already exists 2: In .assigner_parallel(X = iterations.list, FUN = assignment_ranking, : scheduled cores encountered errors in user code

The warnings at the end just started happening, but the "Error in bindrows(x, .id):" has been occurring for every file that I've tried. I've also tried other files and sample files with the same error. If it helps I attached a sample of the file that I am working with

sample_run.txt

I'm not sure if it is the file that is giving me the trouble (maybe formatting errors) but I compared them with others that seemed to work and formatting wise everything seemed pretty much the same. I thought maybe using the strata function would work, but the function individuals2strata didn't work out as I may have to make one from scratch. Sorry if it seems my question/issue is all over the place; I'm pretty new to the field.

Any help you can provide would be much appreciated.

thierrygosselin commented 6 years ago

Sorry for the long delay, this issues completely escaped me. Will check the problem over the weekend

Best Thierry

thierrygosselin commented 5 years ago

genepop file need to end with .gen

So if you change that with sample_run, the codes below should work. Reopen the issue if you still have a problem...

# make sure you work with latest releases:
devtools::install_github("thierrygosselin/radiator")
devtools::install_github("thierrygosselin/assigner")
assigner::install_gsi_sim(fromSource = TRUE)
library(assigner)
data <- radiator::tidy_genomic_data(data = "sample_run.gen")
test1 <- assigner::assignment_ngs(
  data = data, 
  assignment.analysis = "gsi_sim",
  sampling.method = "ranked", 
  thl = 0.5)
fig <- test1$plot.assignment  + 
  ggplot2::facet_grid(SUBSAMPLE~CURRENT) + 
  ggplot2::scale_y_continuous(limits = c(0,100))
fig

This should work