drighelli / SpatialExperiment

55 stars 20 forks source link

read10xVisium() in version 1.7.1 (and now 1.8.0) creates a dangerous silent error by mismatching tissue positions across multiple samples #135

Closed lcolladotor closed 1 year ago

lcolladotor commented 1 year ago

Hi SpatialExperiment authors,

A few minutes ago I gave you a heads up on Slack related to a potential new spaceranger release (the last publicly available one is 2.0.0). See https://community-bioc.slack.com/archives/CR1BLV821/p1677783580326559 for more.

This new issue is related to the same lines of code, but in a different context. It's also a dangerous one because it creates a silent error that maybe others won't notice.

@CATALYST-project took the initiative on July 29th 2022 at https://github.com/drighelli/SpatialExperiment/commit/f741025528c81abba2f2db18dc67d80c883ce0be to add support for SpaceRanger 2.0.0 files where they changed the tissue_positions_list.csv file to tissue_positions.csv. So that commit and a related one, introduced this flexibility. Those commits were part of version 1.7.1 which eventually was added to bioc-release as version 1.8.0 around October 2022.

The problem is that this new code actually creates a silent error when you supply multiple samples to read10xVisium(). It's a silent error because it creates a mismatch between the sample being read and the tissue positions file read for that sample. I think that there were no unit tests for multiple samples that checked the positions info, so no one noticed this.

I first noticed something was wrong a few months ago (December 2022) when I wrote https://github.com/LieberInstitute/spatialDLPFC/blob/main/code/analysis/01_build_spe/check_pxl_in_spe_objects.R. The data and code for that script is now fully public. In that script, I was very confused as to why the tissue position information didn't match between a fresh re-run of read10xVisium() (SpatialExperiment version 1.8.0) versus what we had in our objects created with earlier versions.

I've narrowed down the issue to https://github.com/drighelli/SpatialExperiment/blob/7b8289fec1b94c37f91546e724bffc2be554bc10/R/read10xVisium.R#L127-L131

Here's how I noticed it using a mix of both https://github.com/LieberInstitute/spatialDLPFC/blob/main/code/analysis/01_build_spe/check_pxl_in_spe_objects.R and https://github.com/drighelli/SpatialExperiment/blob/master/R/read10xVisium.R.

(For @lmweber, I ran this at /dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC which only matters for the xyz <- xyz[file.exists(xyz)] line at the end)

sample_id = c(
    "DLPFC_Br2743_ant_manual_alignment",
    "DLPFC_Br2743_mid_manual_alignment_extra_reads",
    "DLPFC_Br2743_post_manual_alignment",
    "DLPFC_Br3942_ant_manual_alignment",
    "DLPFC_Br3942_mid_manual_alignment",
    "DLPFC_Br3942_post_manual_alignment",
    "DLPFC_Br6423_ant_manual_alignment_extra_reads",
    "DLPFC_Br6423_mid_manual_alignment",
    "DLPFC_Br6423_post_extra_reads",
    "DLPFC_Br8492_ant_manual_alignment",
    "DLPFC_Br8492_mid_manual_alignment_extra_reads",
    "DLPFC_Br8492_post_manual_alignment",
    "DLPFC_Br2720_ant_2",
    "DLPFC_Br2720_mid_manual_alignment",
    "DLPFC_Br2720_post_extra_reads",
    "DLPFC_Br6432_ant_2",
    "DLPFC_Br6432_mid_manual_alignment",
    "DLPFC_Br6432_post_manual_alignment",
    "DLPFC_Br6471_ant_manual_alignment_all",
    "DLPFC_Br6471_mid_manual_alignment_all",
    "DLPFC_Br6471_post_manual_alignment_all",
    "DLPFC_Br6522_ant_manual_alignment_all",
    "DLPFC_Br6522_mid_manual_alignment_all",
    "DLPFC_Br6522_post_manual_alignment_all",
    "DLPFC_Br8325_ant_manual_alignment_all",
    "DLPFC_Br8325_mid_2",
    "DLPFC_Br8325_post_manual_alignment_all",
    "DLPFC_Br8667_ant_extra_reads",
    "DLPFC_Br8667_mid_manual_alignment_all",
    "DLPFC_Br8667_post_manual_alignment_all"
)

samples <- file.path(here::here("processed-data", "rerun_spaceranger"),
    sample_id,
    "outs")

type = "sparse"
data = "raw"
images = c("lowres", "hires", "detected", "aligned")
load = TRUE

# check sample identifiers
if (is.null(sids <- names(samples))) {
    if (is.null(sids <- sample_id)) {
        stop("'sample_id' mustn't be NULL when 'samples' are unnamed")
    } else if (!is.character(sample_id)
        && length(unique(sample_id)) != length(samples))
        stop("'sample_id' should contain as many unique values as 'samples'")
} else if (length(unique(sids)) != length(samples))
    stop("names of 'samples' should be unique")
names(samples) <- sids

# add "outs/" directory if not already included
i <- basename(samples) != "outs"
samples[i] <- file.path(samples[i], "outs")

# setup file paths
fns <- paste0(data, "_feature_bc_matrix",
    switch(type, HDF5 = ".h5", ""))
counts <- file.path(samples, fns)

# TODO: check that these files exist & are of valid format
# otherwise things will fail & give unhelpful error messages

dir <- file.path(samples, "spatial")
xyz <- file.path(rep(dir, each = length(sids)),
    sprintf("tissue_positions%s.csv",
        rep(c("", "_list"), length(sids))))
xyz <- xyz[file.exists(xyz)]

As you can see below, here we have 30 samples. But the xyz file path character vector for the tissue positions file does not match. Actually, xyz is 15 times longer than the sample_id vector. If it was recycled in the same order, I wouldn't have noticed it. But since it changes the order, things break.

> length(sample_id)
[1] 30
> head(sample_id)
[1] "DLPFC_Br2743_ant_manual_alignment"            
[2] "DLPFC_Br2743_mid_manual_alignment_extra_reads"
[3] "DLPFC_Br2743_post_manual_alignment"           
[4] "DLPFC_Br3942_ant_manual_alignment"            
[5] "DLPFC_Br3942_mid_manual_alignment"            
[6] "DLPFC_Br3942_post_manual_alignment"           
> head(xyz)
[1] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv"
[2] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv"
[3] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv"
[4] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv"
[5] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv"
[6] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv"
> length(xyz)
[1] 450

Here's more output.

```R > xyz [1] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [2] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [3] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [4] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [5] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [6] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [7] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [8] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [9] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [10] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [11] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [12] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [13] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [14] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [15] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [16] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_mid_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [17] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_mid_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [18] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_mid_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [19] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_mid_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [20] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_mid_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [21] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_mid_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [22] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_mid_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [23] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_mid_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [24] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_mid_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [25] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_mid_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [26] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_mid_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [27] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_mid_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [28] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_mid_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [29] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_mid_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [30] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_mid_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [31] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [32] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [33] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [34] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [35] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [36] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [37] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [38] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [39] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [40] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [41] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [42] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [43] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [44] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [45] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br2743_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [46] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [47] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [48] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [49] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [50] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [51] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [52] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [53] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [54] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [55] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [56] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [57] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [58] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [59] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [60] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_ant_manual_alignment/outs/spatial/tissue_positions_list.csv" [61] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_mid_manual_alignment/outs/spatial/tissue_positions_list.csv" [62] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_mid_manual_alignment/outs/spatial/tissue_positions_list.csv" [63] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_mid_manual_alignment/outs/spatial/tissue_positions_list.csv" [64] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_mid_manual_alignment/outs/spatial/tissue_positions_list.csv" [65] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_mid_manual_alignment/outs/spatial/tissue_positions_list.csv" [66] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_mid_manual_alignment/outs/spatial/tissue_positions_list.csv" [67] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_mid_manual_alignment/outs/spatial/tissue_positions_list.csv" [68] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_mid_manual_alignment/outs/spatial/tissue_positions_list.csv" [69] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_mid_manual_alignment/outs/spatial/tissue_positions_list.csv" [70] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_mid_manual_alignment/outs/spatial/tissue_positions_list.csv" [71] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_mid_manual_alignment/outs/spatial/tissue_positions_list.csv" [72] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_mid_manual_alignment/outs/spatial/tissue_positions_list.csv" [73] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_mid_manual_alignment/outs/spatial/tissue_positions_list.csv" [74] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_mid_manual_alignment/outs/spatial/tissue_positions_list.csv" [75] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_mid_manual_alignment/outs/spatial/tissue_positions_list.csv" [76] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [77] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [78] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [79] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [80] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [81] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [82] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [83] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [84] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [85] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [86] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [87] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [88] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [89] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [90] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br3942_post_manual_alignment/outs/spatial/tissue_positions_list.csv" [91] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br6423_ant_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [92] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br6423_ant_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [93] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br6423_ant_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [94] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br6423_ant_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [95] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br6423_ant_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [96] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br6423_ant_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [97] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br6423_ant_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [98] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br6423_ant_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [99] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br6423_ant_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" [100] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br6423_ant_manual_alignment_extra_reads/outs/spatial/tissue_positions_list.csv" ## Truncated otherwise I would exceed the 65536 character limit on GitHub for comments [400] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8325_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [401] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8325_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [402] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8325_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [403] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8325_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [404] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8325_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [405] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8325_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [406] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_ant_extra_reads/outs/spatial/tissue_positions_list.csv" [407] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_ant_extra_reads/outs/spatial/tissue_positions_list.csv" [408] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_ant_extra_reads/outs/spatial/tissue_positions_list.csv" [409] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_ant_extra_reads/outs/spatial/tissue_positions_list.csv" [410] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_ant_extra_reads/outs/spatial/tissue_positions_list.csv" [411] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_ant_extra_reads/outs/spatial/tissue_positions_list.csv" [412] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_ant_extra_reads/outs/spatial/tissue_positions_list.csv" [413] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_ant_extra_reads/outs/spatial/tissue_positions_list.csv" [414] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_ant_extra_reads/outs/spatial/tissue_positions_list.csv" [415] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_ant_extra_reads/outs/spatial/tissue_positions_list.csv" [416] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_ant_extra_reads/outs/spatial/tissue_positions_list.csv" [417] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_ant_extra_reads/outs/spatial/tissue_positions_list.csv" [418] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_ant_extra_reads/outs/spatial/tissue_positions_list.csv" [419] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_ant_extra_reads/outs/spatial/tissue_positions_list.csv" [420] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_ant_extra_reads/outs/spatial/tissue_positions_list.csv" [421] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_mid_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [422] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_mid_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [423] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_mid_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [424] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_mid_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [425] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_mid_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [426] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_mid_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [427] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_mid_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [428] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_mid_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [429] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_mid_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [430] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_mid_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [431] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_mid_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [432] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_mid_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [433] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_mid_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [434] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_mid_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [435] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_mid_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [436] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [437] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [438] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [439] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [440] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [441] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [442] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [443] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [444] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [445] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [446] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [447] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [448] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [449] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" [450] "/dcs04/lieber/lcolladotor/spatialDLPFC_LIBD4035/spatialDLPFC/processed-data/rerun_spaceranger/DLPFC_Br8667_post_manual_alignment_all/outs/spatial/tissue_positions_list.csv" > > > length(xyz) [1] 450 > length(sample_id) [1] 30 > length(xyz) / length(sample_id) [1] 15 ```

Version 1.7.1 became part of bioc-release as version 1.8.0 in October 2022, so any SPE objects that were created after that are likely suspect.

Thanks again for creating SpatialExperiment and keeping it updated! It's a really useful tool for all of us =)

Best, Leo

lcolladotor commented 1 year ago

Note that it's not as simple as changing

xyz <- file.path(rep(dir, each = length(sids)),
    sprintf("tissue_positions%s.csv",
        rep(c("", "_list"), length(sids))))

to

xyz <- file.path(dir,
    sprintf("tissue_positions%s.csv",
        rep(c("", "_list"), length(sids))))

(creates a vector of length 60 prior to file.exists(); aka number of samples * 2)

which, although it has the right length, it's still on a different order:

> xyz <- xyz[file.exists(xyz)]
> options(width = 300)
> data.frame(basename(gsub("/outs/spatial/tissue_positions_list.csv", "", xyz)), names(samples))
   basename.gsub...outs.spatial.tissue_positions_list.csv.......                                names.samples.
1                  DLPFC_Br2743_mid_manual_alignment_extra_reads             DLPFC_Br2743_ant_manual_alignment
2                              DLPFC_Br3942_ant_manual_alignment DLPFC_Br2743_mid_manual_alignment_extra_reads
3                             DLPFC_Br3942_post_manual_alignment            DLPFC_Br2743_post_manual_alignment
4                              DLPFC_Br6423_mid_manual_alignment             DLPFC_Br3942_ant_manual_alignment
5                              DLPFC_Br8492_ant_manual_alignment             DLPFC_Br3942_mid_manual_alignment
6                             DLPFC_Br8492_post_manual_alignment            DLPFC_Br3942_post_manual_alignment
7                              DLPFC_Br2720_mid_manual_alignment DLPFC_Br6423_ant_manual_alignment_extra_reads
8                                             DLPFC_Br6432_ant_2             DLPFC_Br6423_mid_manual_alignment
9                             DLPFC_Br6432_post_manual_alignment                 DLPFC_Br6423_post_extra_reads
10                         DLPFC_Br6471_mid_manual_alignment_all             DLPFC_Br8492_ant_manual_alignment
11                         DLPFC_Br6522_ant_manual_alignment_all DLPFC_Br8492_mid_manual_alignment_extra_reads
12                        DLPFC_Br6522_post_manual_alignment_all            DLPFC_Br8492_post_manual_alignment
13                                            DLPFC_Br8325_mid_2                            DLPFC_Br2720_ant_2
14                                  DLPFC_Br8667_ant_extra_reads             DLPFC_Br2720_mid_manual_alignment
15                        DLPFC_Br8667_post_manual_alignment_all                 DLPFC_Br2720_post_extra_reads
16                 DLPFC_Br2743_mid_manual_alignment_extra_reads                            DLPFC_Br6432_ant_2
17                             DLPFC_Br3942_ant_manual_alignment             DLPFC_Br6432_mid_manual_alignment
18                            DLPFC_Br3942_post_manual_alignment            DLPFC_Br6432_post_manual_alignment
19                             DLPFC_Br6423_mid_manual_alignment         DLPFC_Br6471_ant_manual_alignment_all
20                             DLPFC_Br8492_ant_manual_alignment         DLPFC_Br6471_mid_manual_alignment_all
21                            DLPFC_Br8492_post_manual_alignment        DLPFC_Br6471_post_manual_alignment_all
22                             DLPFC_Br2720_mid_manual_alignment         DLPFC_Br6522_ant_manual_alignment_all
23                                            DLPFC_Br6432_ant_2         DLPFC_Br6522_mid_manual_alignment_all
24                            DLPFC_Br6432_post_manual_alignment        DLPFC_Br6522_post_manual_alignment_all
25                         DLPFC_Br6471_mid_manual_alignment_all         DLPFC_Br8325_ant_manual_alignment_all
26                         DLPFC_Br6522_ant_manual_alignment_all                            DLPFC_Br8325_mid_2
27                        DLPFC_Br6522_post_manual_alignment_all        DLPFC_Br8325_post_manual_alignment_all
28                                            DLPFC_Br8325_mid_2                  DLPFC_Br8667_ant_extra_reads
29                                  DLPFC_Br8667_ant_extra_reads         DLPFC_Br8667_mid_manual_alignment_all
30                        DLPFC_Br8667_post_manual_alignment_all        DLPFC_Br8667_post_manual_alignment_all
> identical(basename(gsub("/outs/spatial/tissue_positions_list.csv", "", xyz)), names(samples))
[1] FALSE
lcolladotor commented 1 year ago

Got it!

> xyz <- file.path(rep(dir, each = 2),
+     sprintf("tissue_positions%s.csv",
+         rep(c("", "_list"), length(sids))))
> xyz <- xyz[file.exists(xyz)]
> length(xyz)
[1] 30
> identical(basename(gsub("/outs/spatial/tissue_positions_list.csv", "", xyz)), names(samples))
[1] TRUE
> data.frame(basename(gsub("/outs/spatial/tissue_positions_list.csv", "", xyz)), names(samples))
   basename.gsub...outs.spatial.tissue_positions_list.csv.......                                names.samples.
1                              DLPFC_Br2743_ant_manual_alignment             DLPFC_Br2743_ant_manual_alignment
2                  DLPFC_Br2743_mid_manual_alignment_extra_reads DLPFC_Br2743_mid_manual_alignment_extra_reads
3                             DLPFC_Br2743_post_manual_alignment            DLPFC_Br2743_post_manual_alignment
4                              DLPFC_Br3942_ant_manual_alignment             DLPFC_Br3942_ant_manual_alignment
5                              DLPFC_Br3942_mid_manual_alignment             DLPFC_Br3942_mid_manual_alignment
6                             DLPFC_Br3942_post_manual_alignment            DLPFC_Br3942_post_manual_alignment
7                  DLPFC_Br6423_ant_manual_alignment_extra_reads DLPFC_Br6423_ant_manual_alignment_extra_reads
8                              DLPFC_Br6423_mid_manual_alignment             DLPFC_Br6423_mid_manual_alignment
9                                  DLPFC_Br6423_post_extra_reads                 DLPFC_Br6423_post_extra_reads
10                             DLPFC_Br8492_ant_manual_alignment             DLPFC_Br8492_ant_manual_alignment
11                 DLPFC_Br8492_mid_manual_alignment_extra_reads DLPFC_Br8492_mid_manual_alignment_extra_reads
12                            DLPFC_Br8492_post_manual_alignment            DLPFC_Br8492_post_manual_alignment
13                                            DLPFC_Br2720_ant_2                            DLPFC_Br2720_ant_2
14                             DLPFC_Br2720_mid_manual_alignment             DLPFC_Br2720_mid_manual_alignment
15                                 DLPFC_Br2720_post_extra_reads                 DLPFC_Br2720_post_extra_reads
16                                            DLPFC_Br6432_ant_2                            DLPFC_Br6432_ant_2
17                             DLPFC_Br6432_mid_manual_alignment             DLPFC_Br6432_mid_manual_alignment
18                            DLPFC_Br6432_post_manual_alignment            DLPFC_Br6432_post_manual_alignment
19                         DLPFC_Br6471_ant_manual_alignment_all         DLPFC_Br6471_ant_manual_alignment_all
20                         DLPFC_Br6471_mid_manual_alignment_all         DLPFC_Br6471_mid_manual_alignment_all
21                        DLPFC_Br6471_post_manual_alignment_all        DLPFC_Br6471_post_manual_alignment_all
22                         DLPFC_Br6522_ant_manual_alignment_all         DLPFC_Br6522_ant_manual_alignment_all
23                         DLPFC_Br6522_mid_manual_alignment_all         DLPFC_Br6522_mid_manual_alignment_all
24                        DLPFC_Br6522_post_manual_alignment_all        DLPFC_Br6522_post_manual_alignment_all
25                         DLPFC_Br8325_ant_manual_alignment_all         DLPFC_Br8325_ant_manual_alignment_all
26                                            DLPFC_Br8325_mid_2                            DLPFC_Br8325_mid_2
27                        DLPFC_Br8325_post_manual_alignment_all        DLPFC_Br8325_post_manual_alignment_all
28                                  DLPFC_Br8667_ant_extra_reads                  DLPFC_Br8667_ant_extra_reads
29                         DLPFC_Br8667_mid_manual_alignment_all         DLPFC_Br8667_mid_manual_alignment_all
30                        DLPFC_Br8667_post_manual_alignment_all        DLPFC_Br8667_post_manual_alignment_all
lmweber commented 1 year ago

Thanks a lot for finding this @lcolladotor -- working through it now

lmweber commented 1 year ago

Yes, this makes sense, and working through the same example in our directories I get the same outcome. Thanks for the detailed example and the PR. I'll try to add a unit test for the PR -- cc @HelenaLC @drighelli

lcolladotor commented 1 year ago

Awesome, thanks Lukas! It'd be great if you could push the fix to both bioc-release and devel. Just because it's a bug fix, not a new feature. Thanks!

lmweber commented 1 year ago

Yes agree this should go into both release and devel as an urgent bug fix. I just finished writing a unit test now and will push it to the PR and check some more.

drighelli commented 1 year ago

Wow, thanks guys for the issue and the fast resolution of it!

That's awesome! :)

But, I have a question: does this solution solves the different versions of tissue_position[s|list].csv (header/not header)?

lcolladotor commented 1 year ago

This issue and the related PR are about a separate issue. So they don't address the position file.

lmweber commented 1 year ago

Do you mean the new / second issue that @lcolladotor raised in Bioc Slack for the new / upcoming version of Space Ranger? No, these are two separate issues, so this PR only solves the first one for now.

lmweber commented 1 year ago

Merged and pushed to both release (version 1.8.1) and devel (version 1.9.5). Thanks all!