diff --git a/docs/tutorials/index.rst b/docs/tutorials/index.rst index 6c81c40..9d59a94 100644 --- a/docs/tutorials/index.rst +++ b/docs/tutorials/index.rst @@ -15,6 +15,35 @@ Run scar with Python API Run scar with the command line tool --------------------------------- + +Use ``.h5`` files as the input +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +We can directly use cellranger outputed *filtered_feature_bc_matrix.h5* to run ``scar`` by:: + + scar filtered_feature_bc_matrix.h5 -ft feature_type -o output + +``filtered_feature_bc_matrix.h5``, the cellranger output. + +``feature_type``, a string, either 'mRNA' or 'sgRNA' or 'ADT' or 'tag' or 'CMO'. + + .. note:: + The ambient profile is calculated by averaging the cell pool under this mode. + +The output folder contains an h5ad file:: + + output + └── filtered_feature_bc_matrix_denoised_feature_type.h5ad + +In the h5ad object: + +- anndata.X, denosed counts. +- anndata.obs[``noise_ratio``], estimated noise ratio per cell. +- anndata.layer[``native_frequencies``], estimated native frequencies. +- anndata.layer[``BayesFactor``], bayesian factor of ambient contamination. +- anndata.obs[``sgRNAs``], optional, feature assignment, e.g., sgRNA, tag, CMO, and etc.. + +Use ``.pickle`` files as the input +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ We can also run ``scar`` by:: scar raw_count_matrix.pickle -ft feature_type -o output @@ -80,7 +109,4 @@ In the folder structure above: - ``denoised_counts.pickle``, denoised count matrix. - ``BayesFactor.pickle``, bayesian factor of ambient contamination. - ``expected_native_freq.pickle``, estimated native frequencies. -- ``assignment.pickle``, feature assignment, e.g., sgRNA, tag, and etc.. - -.. note:: - Only ``.pickle`` format is supported at the moment. \ No newline at end of file +- ``assignment.pickle``, optional, feature assignment, e.g., sgRNA, tag, and etc.. \ No newline at end of file diff --git a/scar/main/__main__.py b/scar/main/__main__.py index bd3fac7..1a4a02c 100644 --- a/scar/main/__main__.py +++ b/scar/main/__main__.py @@ -85,7 +85,7 @@ def main(): adata_fb = adata[:, adata.var["feature_types"] == features] count_matrix = adata_fb.to_df() - print(f"{len(features)} modalities to denoise: {features}") + print(f"modalities to denoise: {features}") else: raise Exception(file_extension + " files are not supported.") @@ -191,7 +191,7 @@ def main(): elif file_extension == ".h5": output_path_h5ad = os.path.join( - output_dir, "filtered_feature_bc_matrix_denoised_{feature_type}.h5ad" + output_dir, f"filtered_feature_bc_matrix_denoised_{feature_type}.h5ad" ) denoised_adata = adata.copy() @@ -247,14 +247,14 @@ def scar_parser(): "count_matrix", type=str, nargs="+", - help="The file of observed count matrix, 2D array (cells x genes) or the path of a filtered_feature_bc_matrix.h5", + help="The file of raw count matrix, 2D array (cells x genes) or the path of a filtered_feature_bc_matrix.h5", ) parser.add_argument( "-ap", "--ambient_profile", type=str, default=None, - help="The file of empty profile obtained from empty droplets, 1D array or the path of a raw_feature_bc_matrix.h5", + help="The file of empty profile obtained from empty droplets, 1D array", ) parser.add_argument( "-ft",