gbradburd / conStruct

method for modeling continuous and discrete population genetic structure
35 stars 14 forks source link

data.block not saved from conStruct run #63

Closed renhamm closed 10 months ago

renhamm commented 10 months ago

After running my spatial model (see code below), the resulting graphs and data are correct, but when I try to remake the structure plots ordered by latitude, the data.block consists of only what I can assume to be generic toy data form the general conStruct package. Is my run's data.block titled something else. How can I access the data.blovk for my individual runs?

Here is my run code: spatial.HF.2 <- conStruct(spatial = TRUE, K = 2, freqs = AFdata, geoDist = GeoDist, coords = LonLat_sorted, prefix = "spK2-HF", n.chains = 1, n.iter = 1000, make.figs = TRUE, save.files = TRUE)

This is what it looks like when I access data.block$coords:

data.block$coords drainage.long drainage.lat Burke -126.3833 52.40000 Vancouver Island -125.2333 49.83708 Bulkley -126.9700 54.65833 Skeena -128.5382 54.65000 Chuckwall -126.9549 51.69118 Fraser -121.7143 49.43900 Dean -126.7881 52.81905 Squamish -123.3764 50.05417 Alsek -137.8750 59.52500 Klinaklini -125.8203 51.34479 Columbia -122.9367 45.80833 Iskut -130.7296 56.80741 Willamette -123.0784 44.71275 Lillooet -122.8408 50.24138 Kitimat -128.5792 54.13958 Homathko -124.8154 51.04038 Bell-Irving -129.7524 56.67857 Quesnel -122.2532 52.97692 McGregor -122.3179 54.04359 Nass -129.1021 55.34375 Philips -125.2833 50.64167 Jervis -123.9775 50.23478 Taku -133.3458 58.75833 Lower Stikine -131.7400 57.29867 Toba -124.1583 50.54167 Fairbanks -146.3500 64.90000 Gillam -94.6300 56.35000 Denali National Park -149.0200 63.87000 Fort McMurray -111.5000 56.92000 Norman Wells -126.6700 65.23000 Inuvik -133.7700 68.38000 Grand Prairie -118.6300 54.75000 Hay River -115.7800 60.80000 Calgary -113.4200 50.82000 White Horse -135.3300 60.70000

gbradburd commented 10 months ago

Hm that's a new one. I have three guesses: 1) it's a path problem. are you sure you're running this code in the directory you're looking for your output in? 2) you're somehow writing over your output files. is it possible that you're running the conStruct example analyses after running your analysis? 3) you haven't loaded the saved data block .Robj file. if the conStruct library is loaded, the "toy" data block will be accessible as data.block (even though it won't show up in your working memory in the output of, e.g., ls()). In order to see your data block, you have to load the .Robj file (via, e.g., load("myPath/renhammExample_data.block.Robj")).

If it's not any of those, please send a MWE and I'll see if I can replicate.

renhamm commented 10 months ago

Thanks! Since I ran so many iterations across various K values across multiple datasets, my data.blocks got scattered. Directly loading the .Robj file fixed it (option 3)!