gstudio
gstudio copied to clipboard
Reading in cdpop/cdmetapop files incorrectly
Hi, I noticed that grep is having issues reading in loci/alleles from cdmetapop/cdpop files when more than 10 loci occur. In read_population line 251 (.read_cdpop):
locus_names <- grepl("L[[:digit:]]A[[:digit:]]+$",col_names)
change to:
locus_names <- grepl("L[[:digit:]]+A[[:digit:]]+$",col_names)
Adding the '+' allows it to read in loci that have more than one digit (e.g., locus 10 ,11, etc.)
Second, line 263:
idx <- grep(paste("L",i,sep=""),locus_names)
change to:
idx <- grep(paste("L",i,"A",sep=""),locus_names)
Adding the "A" prevents it from reading the alleles as if they were loci, otherwise it was reading locus 10 as though those alleles belonged to locus 1 and would again fail to see more than 10 loci.