Comments (2)
I agree that splats are nicer... and they have been used in Scanpy since the very beginning, e.g. here.
However, both pandas and numpy don't use it in their concat function
(np, pd) and I took these as the model for AnnDatas concat function.
Hence, I'm not sure whether we should deviate from this - I think we should be as close as possible to numpy and pandas whenever it's not completely outrageous.
PS: The Scanpy users are often not very python experienced, and they are used to passing lists without a splat star (*alist
) also in many other places, like plotting an AnnData with several colors
sc.pl.scatter(adata, color=['anno1', 'anno2', 'anno3'])
from anndata.
i see. that’s unfortunate, since numpy’s API is confusing for newbies as well. the linked question shows why that API violates several parts of the zen of python.
so we’re stuck between a rock and a hard place: be confusing for python beginners or be confusing for numpy-experienced users.
i think that a good error message goes a long way – using splats means the user can’t pass further arguments by position but only by keyword (which is a good thing), and we could provide either a custom error message, or special handling of sequences being passed as only positional argument, like:
def concatenate(*adatas, batch_key='batch', batch_categories=None):
if len(adatas) == 1 and not isinstance(adatas[0], AnnData):
try: # convert iterable into tuple
adatas = tuple(adatas[0])
except Exception:
pass
from anndata.
Related Issues (20)
- Dask and Zarr not loading obsp and obsm from remote s3 HOT 7
- Compatibility with `GenomicRanges` HOT 5
- anndata.concat(): Data loss for var elements when concatenating along obs elements HOT 5
- Creating anndata from a subset of dataframe raises error "Index of obs must match index of X." HOT 3
- URGENT: Anndata write is broken. HOT 3
- Documentation webpage search not working HOT 2
- Better customization of chunking HOT 1
- Can't convert string categoricals HOT 3
- TypeError: expected str, bytes or os.PathLike object, not AnnData while saving a subsample of Anndata HOT 1
- best practice for storing and versioning large X and obs/obsm HOT 4
- 0.9.0 on Windows: KeyError: "Unable to open object (object 'anno1' doesn't exist)" HOT 5
- Can't write bool that's nulled by concatenation HOT 4
- lazy dataframes in `.obs` and `.var` with `backed="r"` mode HOT 13
- Finalizing the anndata paper HOT 1
- Concatenate using `.str` accessor on `var_names` HOT 2
- Removing ambient genes from adata
- ValueError: '_index' is a reserved name for dataframe columns. Above error raised while writing key 'var' of to / HOT 2
- Fix compatibility with pandas 2.0.1
- How do I check if my anndata object has a populated raw slot? HOT 1
- Adding "_reader" and "_writer" arguments sometimes causes errors HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anndata.