diff options
| -rwxr-xr-x | scripts/qtl2-impute-bimbam.R | 9 | ||||
| -rw-r--r-- | src/routes/gemma.rs | 8 |
2 files changed, 13 insertions, 4 deletions
diff --git a/scripts/qtl2-impute-bimbam.R b/scripts/qtl2-impute-bimbam.R index df5f6d6..2e11a40 100755 --- a/scripts/qtl2-impute-bimbam.R +++ b/scripts/qtl2-impute-bimbam.R @@ -82,12 +82,15 @@ for (chr_name in names(imputed)) { writeLines(vapply(rows, paste, character(1), collapse = ","), paste0(out_prefix, ".bimbam.txt")) -# The individual order of the calls, because it is the *cross's* order and not -# necessarily the panel's: a caller that writes a phenotype file positionally +# The individual order of the calls -- rownames, because maxmarg returns +# individuals x markers and colnames are therefore markers (measured: writing +# colnames put 1452 marker names in a file of individuals, every value aligned +# to nothing, and the run reported "number of analyzed individuals equals 0") -- +# because it is the *cross's* order and not necessarily the panel's: a caller that writes a phenotype file positionally # has to align to this, or the two disagree by name and every individual is # missing (measured: gemma answered "no individuals in common" and ravanan # reported no association files at all). -writeLines(colnames(imputed[[1]]), paste0(out_prefix, ".individuals.txt")) +writeLines(rownames(imputed[[1]]), paste0(out_prefix, ".individuals.txt")) writeLines(vapply(snps, paste, character(1), collapse = ","), paste0(out_prefix, ".snps.txt")) diff --git a/src/routes/gemma.rs b/src/routes/gemma.rs index 329158a..e94ca72 100644 --- a/src/routes/gemma.rs +++ b/src/routes/gemma.rs @@ -947,9 +947,15 @@ async fn prepare_genotypes( .file_stem() .map(|name| name.to_string_lossy().into_owned()) .unwrap_or_else(|| "panel".to_string()); + // The cache key carries a version, because it is keyed on the panel and the + // mode and NOT on the code that produces them: a fixed bug in the imputation + // script would otherwise be masked by its own old output (measured: a + // corrected individuals file was ignored and the run kept failing on the + // stale one). Bump this when either script changes what it writes. + const IMPUTE_CACHE_VERSION: &str = "v2"; let prefix = std::path::Path::new(&config.ravanan_cache_dir) .join("imputed") - .join(format!("{stem}-{mode}")); + .join(format!("{stem}-{mode}-{IMPUTE_CACHE_VERSION}")); let prepared_geno = format!("{}.bimbam.txt", prefix.to_string_lossy()); let prepared_snps = format!("{}.snps.txt", prefix.to_string_lossy()); |
