rystanley / genepopedit

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

Convert to genind #17

Closed quinn-ca closed 8 months ago

quinn-ca commented 8 months ago

Hi,

I used your program to randomly subset my genepop file (from Stacks) to generate 10 datasets.

Code I used:

SubSamp_1 <- genepop_sample("./private_alleles/autosomal_genstr_filtered_maxMeanDP49_rmRelated_snps_noATPUname_PGDgen.txt", nsample = 18)

subset_genepop_individual("./private_alleles/autosomal_genstr_filtered_maxMeanDP49_rmRelated_snps_noATPUname_PGDgen.txt", indiv = SubSamp_1, keep = TRUE, path = paste0("./private_alleles","Genepop_Subset1.txt"))

I've attached the "Genepop_Subset1.txt" file here to ensure the output is as expected. private_allelesGenepop_Subset1.txt

I changed the file extension of the subset genepop to be ".gen" and then used read.genepop from adegenet to try and convert the genepop to a genind object (that I plan to use with the poppr program). However, read.genepop seems to have misread the genepop file I created using genepop edit, for example: there are no slots for ind.names or loc.names. Additionally, the population names listed are actually names of individuals.

Do you have any experience converting genepopedit files to genind objects? Thanks for your help!

rystanley commented 8 months ago

Hmm I tried that file and found the same outcome. Interestingly when I run the file through PGDSpider and convert it to a 'genepop' format (so essentially a genepop to genepop) the output is the same, so I don't think there is anything wrong necessarily with what genepopedit is doing. By chance, have you tried to convert to an intermediary file type (not genepop) using some of the other genepopedit conversions (e.g., genepop_structure) to see if adgenet will encode that information properly?

quinn-ca commented 8 months ago

Yeah, it's weird! I haven't; I ended up using the lists of subset individuals generated with genepop_sample to subsample an existing genind object with the full dataset. Thanks!

rystanley commented 8 months ago

Well glad that worked! Sorry you had to have a work around. We haven't explored doing a genepop_genind conversion because that function was native to adgenet. Maybe something to dig into for the future. Best of luck with your research!