Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,4 @@ ENV/

# IDE settings
.vscode/
.idea/
8 changes: 8 additions & 0 deletions docs/genetools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ genetools.stats module
:undoc-members:
:show-inheritance:

genetools.trajectory module
---------------------------

.. automodule:: genetools.trajectory
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------
Expand Down
4 changes: 2 additions & 2 deletions genetools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
__version__ = "0.4.0"

# We want genetools.[submodule].[function] to be accessible simply by importing genetools, without having to import genetools.[submodule]
from . import helpers, plots, scanpy_helpers, stats
from . import helpers, plots, scanpy_helpers, stats, trajectory

__all__ = ["helpers", "plots", "scanpy_helpers", "stats"]
__all__ = ["helpers", "plots", "scanpy_helpers", "stats", "trajectory"]
22 changes: 22 additions & 0 deletions genetools/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,28 @@ def merge_into_left(left, right, **kwargs):
return df


def sample_cells_from_clusters(obs_df, n_cells, cluster_key, cluster_names):
"""[summary]

:param obs_df: [description]
:type obs_df: [type]
:param n_cells: [description]
:type n_cells: [type]
:param cluster_key: [description]
:type cluster_key: [type]
:param cluster_names: [description]
:type cluster_names: [type]
:return: [description]
:rtype: [type]
"""
return (
obs_df[obs_df[cluster_key].isin(cluster_names)]
.index.to_series()
.sample(n_cells)
.values
)


def horizontal_concat(df_left, df_right):
"""Concatenate df_right horizontally to df_left, with no checks for whether the indexes match, but confirming final shape.

Expand Down
Loading