sa-lee / starmie

starmie: plotting and inference for population structure models :star2:
Other
12 stars 6 forks source link

Loading multiple files at once #43

Open markusruhsam opened 6 years ago

markusruhsam commented 6 years ago

Is it possible to load multiple STRUCTURE output files for the CLUMPPING together at once? At the moment it looks like that you have to load each output file separately k6_msat <- loadStructure(k6_file),.... and combine them with k6_all <- structList(k6_msat, k6_run2) which can then be used to Q_list <- lapply(k6_all, getQ). It would be much easier if it was possible to load for example all 10 repeat files of a certain K at once with something like allfiles <- choose.files() and then Q_list <- lapply(allfiles, getQ). Or is that possible already?

sa-lee commented 6 years ago

To load all the files at once you could use lapply on a vector of file names.

k6_all <- lapply(k6_files, loadStructure)
Q_all <- lapply(k6_all, getQ)

I agree that it would be good to add an option to just read the Q-matrix and ignore all other parts of the file though.

tommydevitt commented 5 years ago

When I try to use lapply I get

Error in readlines(ds, skip_empty_rows = skip_emptyrows, locale = locale, : Cannot read file /results_f/k1: Invalid argument

Any suggestions?