Open DingWB opened 2 months ago
Hmm, since this function exists explicitly to handle big files, I think it wouldn’t be fair to say “just make new files without these parts”, so this is a reasonable request.
Regarding API: We already have the pairwise
option, but its goal is to discourage merging semantically unwise-to-merge graphs instead of topologically unmergeable arrays, so we shouldn’t add a parameter for each attr.
Therefore I think we have two options:
on_error
parameter that can take
X
, obsm['a']
, …). can re-raise or return a value that attr/entry is then set to[^1]"warn"
: raises a warning, and if every single axis-wise merge failed (uns can always be merged), still throws an error."raise"
: the default, just raises an error on any merge failure
If one wants to completely ignore errors, they could then specify on_error=lambda e, **kw: None
or manually ignore warnings, which is intentionally unwieldy because warnings are a good thing.[^1]: I’d think signature would be
Parameters (all except `error` are keyword-only):
- `error`: The error instance
- `attr`: `AnnData` attribute we failed to concat
- `key`: String key if `attr` is e.g. `obsm` or `layers`, `None` if `attr` is e.g. `X` or `obs`
- maybe more? e.g. a list of elements to-be-concatenated?
Returns:
- a value if the user wants to default to something/handle something themselves
- `None` if we don’t want to set the thing
- raise an error (e.g. the original one) if the user wants to forward the error.
Hi @flying-sheep ,
I think you misunderstood my meaning. I have two adata files, both have obsm['X_pca'], but the shapes are different: (369626, 50) and (135426, 63). So I got an error.
Is there a way to skip the concat of obsm?
I understood that perfectly.
No, there isn’t, that’s why I’m brainstorming solutions.
OK. Thanks.
Please make sure these conditions are met
Report
When I concat two adata using the following code:
I got an error:
Because the obsm['X_pca'] has a different shape in two adatas, but I only need to contact the X, I don't need obsm or varm. Could you please add a parameter to let me skip obsm (or varm) and only concat X?
Versions