scmags.ScMags

class ScMags(data, labels, gene_ann=None, verbose=True)[source]

A class containing the Count matrix and cluster labels, with methods that can select markers and visualize selected markers

Parameters
  • data (Union[ndarray, csr_matrix, csc_matrix]) – Count matrix with rows corresponding to cells and columns to genes in numpy array format.

  • labels (ndarray) – One-dimensional numpy array containing cluster labels.

  • gene_ann (Optional[ndarray]) – One-dimensional numpy array containing gene annotations.

  • verbose (bool) – Verbosity

Returns

Return type

class: ~ScMags.

Examples

>>> import scmags as mg
>>> li = mg.datasets.li()

Methods

__init__(data, labels[, gene_ann, verbose])

Initialize self.

dot_plot([cmap, figsize, log_transform, …])

This function draws the dot plot from the scanpy library In this plot,the colors represent the normalized within-cluster average expression, and the circles represent the within-cluster expression rates.

dp_silh_compute(data, mask, pb_it)

It finds the best combination of given genes by parallel computation based on silhouette index.

filter_genes([in_cls_thres, im_exp, …])

It filters out genes that cannot be cluster-specific markers for each cluster for computational efficiency.

get_filter_genes([ind_return])

Returns the remaining genes after filtering.

get_marker_data([log_norm])

It pulls the selected markers from the count matrix and returns it.

get_markers([ind_return])

Returns the selected markers

knn_classifier([test_ratio, nof_neighbors, …])

This function performs k-NN classification with selected markers.

markers_heatmap([scale, log_norm, cmap, …])

Draws a heatmap with selected markers

markers_tSNE([log_norm, n_iter, perplexity, …])

Draws tSNE plot with selected markers

sel_clust_marker([nof_markers, n_cores, …])

Performs cluster-specific marker selection among filtered genes.

silh_compute(data, mask_labs, i, j)

Calculates silhouette index of any gene

Attributes

get_filt_cluster_thresholds

Returns auto-determined in-cluster expression threshold values

get_filter_gene_scores

Returns the calculated score values of the remaining genes after filtering.