Skip to content

Miscellaneous utilities for BiocPy, mostly to mimic base functionality in R.

License

Notifications You must be signed in to change notification settings

BiocPy/BiocUtils

Repository files navigation

Utilities for BiocPy

Project generated with PyScaffoldPyPI-ServerMonthly DownloadsUnit tests

Motivation

This repository contains a variety of simple utilities for the BiocPy project, mostly convenient aspects of R that aren't provided by base Python. The aim is to simplify development of higher-level packages like scranpy and singler that would otherwise have to implement these methods individually.

Available utilities

match

importbiocutilsbiocutils.match(["A", "C", "E"], ["A", "B", "C", "D", "E"]) ## [0, 2, 4]

factor

importbiocutilsbiocutils.factorize(["A", "B", "B", "A", "C", "D", "C", "D"]) ## (['A', 'B', 'C', 'D'], [0, 1, 1, 0, 2, 3, 2, 3])

intersect

importbiocutilsbiocutils.intersect(["A", "B", "C", "D"], ["D", "A", "E"]) ## ['A', 'D']

union

importbiocutilsbiocutils.union(["A", "B", "C", "D"], ["D", "A", "E"]) ## ['A', 'B', 'C', 'D', 'E']

subset

importbiocutilsbiocutils.subset(["A", "B", "C", "D", "E"], [0, 2, 4]) ## ['A', 'C', 'E']importnumpyasnpy=np.array([10, 20, 30, 40, 50]) biocutils.subset(y, [0, 2, 4]) ## array([10, 30, 50])

is_list_of_type

Checks if all elements of a list or tuple are of the same type.

importbiocutilsimportnumpyasnpx= [np.random.rand(3), np.random.rand(3, 2)] biocutils.is_list_of_type(x, np.ndarray) ## True

and many more. Check out the documentation for more information.

About

Miscellaneous utilities for BiocPy, mostly to mimic base functionality in R.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages