rystanley / genepopedit

Simple and flexible manipulation of genomic data.
15 stars 4 forks source link

Error Reading genepop file #13

Open kwojtusik opened 3 years ago

kwojtusik commented 3 years ago

Hello,

I am trying to use the program to create the necessary file to run Rubias.

In order to do this i am trying to use subset_genepop_aggregate to create the repunits file, but there seems to some kind of issue with reading the genepop file. Below is the code i am running, and after that is the error that I am getting. subset_genepop_aggregate("~/Documents/Thesis_Stuff/Analyses/Pop_assignment/All_Pops_neutral_outliers.gen", subs = NULL, keep = TRUE, agpopframe = "~/Documents/Thesis_Stuff/Analyses/Pop_assignment/All_rivers/All_Rivs_Agpop.csv", path = "~/Documents/Thesis_Stuff/Analyses/Pop_assignment/All_rivers")

Error: Error in setnames(x, value) : Can't assign 1 names to a 9493 column data.table In addition: Warning message: In data.table::fread(genepop, header = FALSE, sep = "\t", stringsAsFactors = FALSE) : Stopped early on line 24. Expected 9493 fields but found 1. Consider fill=TRUE and comment.char=. First discarded non-empty line: <<pop>>

Thank you for any help you can provide.

-Kris

rystanley commented 3 years ago

Hey Kris how many loci do you have? Seems like a formatting issue in one of the delimiters. Try to convert the file to a standard genepop format using PGDspider (convert genepop to genepop - seems redundant but it will augment the delimiters). If that doesn't work email me and I can try to work through the error with you.

kwojtusik commented 3 years ago

Hi Ryan,

I used PGDSpider to convert it and unfortunately it is still not working, though this this time it is a different error, and I don't think its an issue genepopedit:

Error in insert_vals(Vec = Loci, breaks = PopPosition, newVal = "Pop") : object 'PopPosition' not found

For some reason it does not seem to be finding the population ID. I looked at the genpop file and there were no pop IDs after conversion in PGDspider even though they were present in the previous file. I tried converting a structure file and a VCF and it did not keep the pop ids. I will try some other converters to see if I can get the appropriate files for the program. Thanks for your help.

-Kris

rystanley commented 3 years ago

Hey Kris,

Let me know how it goes. If you email me the file (or a subset of it) I can try to do the bug check on my own. The error seems to be a product of the parsing steps of the function. Should be an easy fix. It's also helpful to see where these errors occur so we can build in measures to mitigate them.

Ryan

kwojtusik commented 3 years ago

Hi Ryan,

I'd be happy to email you but am having trouble finding your email address. Could you post it here?

-Kris

rystanley commented 3 years ago

Right. I removed that. Ryan.Stanley at dfo-mpo.gc.ca

kwojtusik commented 3 years ago

Great. Thank you.