Repository navigation
Directory structure outs/ - #87
Conversation
| #' refers to either "raw" or "filtered" to match the `data` argument.) | ||
| #' The base directory "outs/" from Space Ranger can either be included | ||
| #' manually in the paths provided in `samples`, or can be ignored; | ||
| #' if ignored it will be added automatically. The `.h5` files are |
There was a problem hiding this comment.
done (here and in vignette)
| #' · · · · |—scalefactors_json.json \cr | ||
| #' · · · · |—tissue_lowres_image.png \cr | ||
| #' · · · · |—tissue_positions_list.csv \cr | ||
| #' · |—outs \cr |
There was a problem hiding this comment.
looking at this after a long time, I think it would be nice if the - and | aligned, i.e.
#' sample \cr
#' · | — outs \cr
#' · · | — raw/filtered_feature_bc_matrix.h5 \cr
#' · · | — raw/filtered_feature_bc_matrix \cr
#' · · · | — barcodes.tsv.gz \cr
#' · · · | — features.tsv.gz \cr
#' · · · | — matrix.mtx.gz \cr
#' · · | — spatial \cr
#' · · · | — scalefactors_json.json \cr
#' · · · | — tissue_lowres_image.png \cr
#' · · · | — tissue_positions_list.csv \cr
There was a problem hiding this comment.
done (here and in vignette)
| stop("names of 'samples' should be unique") | ||
| names(samples) <- sids | ||
|
|
||
| # add "outs/" directory if not already included |
There was a problem hiding this comment.
looks buggy to me - what if one of the basenames is missing the outs, but all others have it? I think we want
i <- basename(samples) != "outs"
samples[i] <- file.path(samples[i], "outs")
# this does nothing if `!any(i)`,
# so no need for an `if`-statement
Test example:
# old
samples <- c("dir/dir", "dir/dir/outs")
if (!(all(basename(samples) == "outs")))
samples <- file.path(samples, "outs")
# samples
# > "dir/dir/outs" "dir/dir/outs/outs"
# new
samples <- c("dir/dir", "dir/dir/outs")
i <- basename(samples) != "outs"
samples[i] <- file.path(samples[i], "outs")
# samples
# > "dir/dir/outs" "dir/dir/outs"
There was a problem hiding this comment.
Yes, this is true. I think in practice people will either have added outs/ or not for all samples. But you are right it is better to be more robust to the edge case. Will add unit test too.
|
General comment: The purpose is to support both with and without the Perhaps I missed something, but could we actually have i) and example and ii) unit-tests for this? Currently, you added |
|
Thanks for comments above @HelenaLC . Agree this is better and more robust. I had thought about an I have also added examples and a unit test. All the other examples updated in the earlier commits should be consistent with existing code from our users (i.e. |
|
Looks all good to me now. Ready to merge. However, this is v1.3.5 & the current |
|
Great, thanks for checking it! I think I left |
Here is my updated solution for the
outs/directory structure issue discussed in #76 and #78.This is now much simpler and shouldn't break anyone's existing code. The main change is to add the following in
read10xVisium(), i.e. add theouts/directory automatically if it is not included by the user in thesamplesinput:This will make things easier for new users who are not familiar with the
outs/directory structure from Space Ranger. At the same time, all existing code (where users include theouts/manually) will still work.The rest of the updates are:
extdatato include theouts/directory in the correct place (e.g.section1/outs/raw_feature_bc_matrixinstead ofsection1/raw_feature_bc_matrix) so all the examples still work. Previously theouts/was missing here, which is inconsistent with the directory structure that Space Ranger generates (for a sample namedsection1).outs/directory manually, as was previously required when users usedread10xVisium()but was not required in these examples / tests because our example paths inextdatadid not have theouts/raw/filteredand.h5files as suggested by @LTLA in read10xVisium describes the wrong directory structure #76Since quite a few files are affected, could you please both @drighelli and @HelenaLC have a look and review the changes. Thanks!