Skip to content

Commit

Permalink
cleaning up docstrings for consistenct, bump package versions of sce.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkanche committed Jan 3, 2024
1 parent 83a5fc7 commit 3f58783
Show file tree
Hide file tree
Showing 35 changed files with 516 additions and 343 deletions.
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ install_requires =
mattress>=0.0.7
assorthead>=0.0.10
numpy
BiocFrame>=0.3.1
BiocFrame>=0.5.0
biocutils
igraph
singlecellexperiment>=0.3.0
singlecellexperiment>=0.4.0
summarizedexperiment
delayedarray

Expand Down
5 changes: 3 additions & 2 deletions src/scranpy/_utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from typing import Sequence, Callable, Any, Tuple, Union
from typing import Sequence, Tuple, Union

from biocutils import factor, match
from mattress import TatamiNumericPointer, tatamize
from numpy import bool_, int32, int_, ndarray, uint8, uintp, zeros, array
from numpy import array, bool_, int32, int_, ndarray, uint8, uintp, zeros
from summarizedexperiment import SummarizedExperiment

__author__ = "ltla, jkanche"
Expand Down
84 changes: 43 additions & 41 deletions src/scranpy/analyze/AnalyzeOptions.py
Original file line number Diff line number Diff line change
@@ -1,53 +1,54 @@
from dataclasses import dataclass, field
from typing import Optional, Sequence

from .. import batch_correction as correct
from .. import clustering as clust
from .. import dimensionality_reduction as dimred
from .. import feature_selection as feat
from .. import marker_detection as mark
from .. import nearest_neighbors as nn
from .. import normalization as norm
from .. import quality_control as qc
from .. import batch_correction as correct


@dataclass
class MiscellaneousOptions:
"""Miscellaneous options for :py:meth:`~scranpy.analyze.analyze.analyze`.
Attributes:
cell_names (Sequence[str], optional):
cell_names:
Names for all cells in the dataset, to be added to any per-cell data frames.
This should have the same length as the number of columns in each data matrix.
rna_feature_names (Sequence[str], optional):
rna_feature_names:
Names for all features in the RNA data.
This should have the same length as the number of rows in the RNA count matrix.
adt_feature_names (Sequence[str], optional):
adt_feature_names:
Names for all tags in the ADT data.
This should have the same length as the number of rows in the ADT count matrix.
crispr_feature_names (Sequence[str], optional):
crispr_feature_names:
Names for all guides in the CRISPR data.
This should have the same length as the number of rows in the CRISPR count matrix.
filter_on_rna_qc (bool):
filter_on_rna_qc:
Whether to filter cells on the RNA-based quality control metrics,
when RNA data is available.
filter_on_adt_qc (bool):
filter_on_adt_qc:
Whether to filter cells on the ADT-based quality control metrics,
when ADT data is available.
filter_on_crispr_qc (bool):
filter_on_crispr_qc:
Whether to filter cells on the CRISPR-based quality control metrics,
when CRISPR data is available.
snn_graph_multilevel_resolution (float):
snn_graph_multilevel_resolution:
Resolution to use for multi-level clustering of the SNN graph.
block (Sequence, optional): Block assignment for each cell.
block:
Block assignment for each cell.
This should have length equal to the total number of cells in the dataset, before any quality control
is applied.
"""
Expand All @@ -74,104 +75,104 @@ class AnalyzeOptions:
check out the setter methods of this class for more details.
Attributes:
per_cell_rna_qc_metrics_options (PerCellRnaQcMetricsOptions):
per_cell_rna_qc_metrics_options:
Options to pass to :py:meth:`~scranpy.quality_control.per_cell_rna_qc_metrics.per_cell_rna_qc_metrics`.
suggest_rna_qc_filters_options (SuggestRnaQcFiltersOptions):
suggest_rna_qc_filters_options:
Options to pass to :py:meth:`~scranpy.quality_control.suggest_rna_qc_filters.suggest_rna_qc_filters`.
create_rna_qc_filter_options (CreateRnaQcFilterOptions):
create_rna_qc_filter_options:
Options to pass to :py:meth:`~scranpy.quality_control.create_rna_qc_filter.create_rna_qc_filter`.
per_cell_adt_qc_metrics_options (PerCellRnaQcMetricsOptions):
per_cell_adt_qc_metrics_options:
Options to pass to :py:meth:`~scranpy.quality_control.per_cell_adt_metrics.per_cell_adt_qc_metrics`.
suggest_adt_qc_filters_options (SuggestRnaQcFiltersOptions):
suggest_adt_qc_filters_options:
Options to pass to :py:meth:`~scranpy.quality_control.suggest_adt_qc_filters.suggest_adt_qc_filters`.
create_adt_qc_filter_options (CreateRnaQcFilterOptions):
create_adt_qc_filter_options:
Options to pass to :py:meth:`~scranpy.quality_control.create_adt_qc_filter.create_adt_qc_filter`.
per_cell_crispr_qc_metrics_options (PerCellRnaQcMetricsOptions):
per_cell_crispr_qc_metrics_options:
Options to pass to
:py:meth:`~scranpy.quality_control.per_cell_crispr_qc_metrics.per_cell_crispr_qc_metrics`.
suggest_crispr_qc_filters_options (SuggestRnaQcFiltersOptions):
suggest_crispr_qc_filters_options:
Options to pass to :py:meth:`~scranpy.quality_control.suggest_crispr_qc_filters.suggest_crispr_qc_filters`.
create_crispr_qc_filter_options (CreateRnaQcFilterOptions):
create_crispr_qc_filter_options:
Options to pass to :py:meth:`~scranpy.quality_control.create_crispr_qc_filter.create_crispr_qc_filter`.
filter_cells_options (FilterCellsOptions):
filter_cells_options:
Options to pass to :py:meth:`~scranpy.quality_control.filter_cells.filter_cells`.
rna_log_norm_counts_options (LogNormCountsOptions):
rna_log_norm_counts_options:
Options to pass to :py:meth:`~scranpy.normalization.log_norm_counts.log_norm_counts`
for the RNA count matrix.
grouped_size_factors_options (GroupedSizeFactorsOptions):
grouped_size_factors_options:
Options to pass to :py:meth:`~scranpy.normalization.grouped_size_factors.grouped_size_factors`
to compute ADT size factors.
adt_log_norm_counts_options (LogNormCountsOptions):
adt_log_norm_counts_options:
Options to pass to :py:meth:`~scranpy.normalization.log_norm_counts.log_norm_counts`
for the ADT count matrix.
crispr_log_norm_counts_options (LogNormCountsOptions):
crispr_log_norm_counts_options:
Options to pass to :py:meth:`~scranpy.normalization.log_norm_counts.log_norm_counts`
for the CRISPR count matrix.
choose_hvgs_options (ChooseHvgsOptions):
choose_hvgs_options:
Options to pass to :py:meth:`~scranpy.feature_selection.choose_hvgs.choose_hvgs`
to choose highly variable genes for the RNA data.
model_gene_variances_options (ModelGeneVariancesOptions):
model_gene_variances_options:
Options to pass to :py:meth:`~scranpy.feature_selection.model_gene_variances.model_gene_variances`
to model per-gene variances for the RNA data.
rna_run_pca_options (RunPcaOptions):
rna_run_pca_options:
Options to pass to :py:meth:`~scranpy.dimensionality_reduction.run_pca.run_pca`
for the RNA log-expression matrix.
adt_run_pca_options (RunPcaOptions):
adt_run_pca_options:
Options to pass to :py:meth:`~scranpy.dimensionality_reduction.run_pca.run_pca`
for the ADT log-expression matrix.
crispr_run_pca_options (RunPcaOptions):
crispr_run_pca_options:
Options to pass to :py:meth:`~scranpy.dimensionality_reduction.run_pca.run_pca`
for the CRISPR log-expression matrix.
mnn_correct_options (MnnCorrectOptions):
mnn_correct_options:
Options to pass to :py:meth:`~scranpy.batch_correction.mnn_correct.mnn_correct`.
build_neighbor_index_options (BuildNeighborIndexOptions):
build_neighbor_index_options:
Options to pass to :py:meth:`~scranpy.nearest_neighbors.build_neighbor_index.build_neighbor_index`.
find_nearest_neighbors_options (FindNearestNeighborsOptions):
find_nearest_neighbors_options:
Options to pass to :py:meth:`~scranpy.nearest_neighbors.find_nearest_neighbors.find_nearest_neighbors`.
run_tsne_options (RunTsneOptions):
run_tsne_options:
Options to pass to :py:meth:`~scranpy.dimensionality_reduction.run_tsne.run_tsne`.
run_umap_options (RunUmapOptions):
run_umap_options:
Options to pass to :py:meth:`~scranpy.dimensionality_reduction.run_umap.run_umap`.
build_snn_graph_options (BuildSnnGraphOptions):
build_snn_graph_options:
Options to pass to :py:meth:`~scranpy.clustering.build_snn_graph.build_snn_graph`.
rna_score_markers_options (ScoreMarkersOptions):
rna_score_markers_options:
Options to pass to :py:meth:`~scranpy.marker_detection.score_markers.score_markers`
for the RNA log-expression values.
adt_score_markers_options (ScoreMarkersOptions):
adt_score_markers_options:
Options to pass to :py:meth:`~scranpy.marker_detection.score_markers.score_markers`
for the ADT log-abundances.
crispr_score_markers_options (ScoreMarkersOptions):
crispr_score_markers_options:
Options to pass to :py:meth:`~scranpy.marker_detection.score_markers.score_markers`
for the CRISPR log-abundances.
miscellaneous_options (MiscellaneousOptions):
miscellaneous_options:
Further options that are not associated with any single function call.
"""

Expand Down Expand Up @@ -303,7 +304,7 @@ def set_seed(self, seed: int = 42):
:py:meth:`~scranpy.dimensionality_reduction.run_umap.run_umap`.
Args:
seed (int, optional):
seed:
Seed for random number generation.
"""
self.run_pca_options.set_seed(seed)
Expand All @@ -328,7 +329,8 @@ def set_threads(self, num_threads: int = 1):
In all cases, thread utilization will not exceed the limit specified here in ``num_threads``.
Args:
num_threads (int, optional): Number of threads. Defaults to 1.
num_threads:
Number of threads. Defaults to 1.
"""
self.per_cell_rna_qc_metrics_options.set_threads(num_threads)
self.log_norm_counts_options.set_threads(num_threads)
Expand Down
Loading

0 comments on commit 3f58783

Please sign in to comment.