Skip to content

Commit

Permalink
docs(main): update documentation for .h5 file
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheng, Caibin committed Aug 1, 2022
1 parent 73bc13e commit 2a309e0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
34 changes: 30 additions & 4 deletions docs/tutorials/index.rst
Expand Up @@ -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
Expand Down Expand Up @@ -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.
- ``assignment.pickle``, optional, feature assignment, e.g., sgRNA, tag, and etc..
8 changes: 4 additions & 4 deletions scar/main/__main__.py
Expand Up @@ -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.")
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 2a309e0

Please sign in to comment.