From 6b83770eafb675c36d6e40477a375b27e0ae0c31 Mon Sep 17 00:00:00 2001 From: Ken Brewer Date: Fri, 26 Apr 2024 12:03:54 +0000 Subject: [PATCH] ci: add docs build check --- .github/workflows/integration-test.yml | 17 ++++++++++ pycytominer/cyto_utils/features.py | 4 +-- pycytominer/normalize.py | 46 ++++++++++++-------------- 3 files changed, 41 insertions(+), 26 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 9f817695..883ba242 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -28,6 +28,23 @@ env: TARGET_PYTHON_VERSION: "3.9" jobs: + docs-check: + # This job is used to check the documentation build with strict mode enabled + name: Docs check + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v4 + - name: Setup python, and load cache + uses: ./.github/actions/setup-env + with: + python-version: ${{ env.TARGET_PYTHON_VERSION }} + cache-pre-commit: false + cache-venv: true + setup-poetry: true + install-deps: true + - name: Build documentation + run: mkdocs build --strict quality-test: # This job is used to run pre-commit checks to ensure that all files are # are formatted correctly. diff --git a/pycytominer/cyto_utils/features.py b/pycytominer/cyto_utils/features.py index bc05b21f..304e71f9 100644 --- a/pycytominer/cyto_utils/features.py +++ b/pycytominer/cyto_utils/features.py @@ -45,7 +45,7 @@ def label_compartment(cp_features, compartment, metadata_cols): cp_features : list of str All features being used. compartment : str - Measured compartment. + Measured compartment. metadata_cols : list Columns that should be considered metadata. @@ -150,7 +150,7 @@ def drop_outlier_features( "Metadata_treatment == 'control'" (include all quotes). If "all", use all samples to calculate. outlier_cutoff : int or float, default 500 - see https://github.com/cytomining/pycytominer/issues/237 for details. + see https://github.com/cytomining/pycytominer/issues/237 for details. Threshold to remove features if absolute values is greater Returns diff --git a/pycytominer/normalize.py b/pycytominer/normalize.py index 847b76ed..28d4b8bc 100644 --- a/pycytominer/normalize.py +++ b/pycytominer/normalize.py @@ -56,15 +56,13 @@ def normalize( If provided, will write normalized profiles as a specified file type (either CSV or parquet). If not specified and output_file is provided, then the file will be outputed as CSV as default. compression_options : str or dict, optional - Contains compression options as input to - pd.DataFrame.to_csv(compression=compression_options). pandas version >= 1.2. + Contains compression options as input to `pd.DataFrame.to_csv(compression=compression_options)`. float_format : str, optional Decimal precision to use in writing output file as input to pd.DataFrame.to_csv(float_format=float_format). For example, use "%.3g" for 3 decimal precision. mad_robustize_epsilon: float, optional - The mad_robustize fudge factor parameter. The function only uses - this variable if method = "mad_robustize". Set this to 0 if + The mad_robustize fudge factor parameter. The function only uses this variable if method = "mad_robustize". Set this to 0 if mad_robustize generates features with large values. spherize_center : bool If the function should center data before sphering (aka whitening). The @@ -86,36 +84,36 @@ def normalize( Examples -------- + ```python import pandas as pd from pycytominer import normalize - data_df = pd.DataFrame( - { - "Metadata_plate": ["a", "a", "a", "a", "b", "b", "b", "b"], - "Metadata_treatment": [ - "drug", - "drug", - "control", - "control", - "drug", - "drug", - "control", - "control", - ], - "x": [1, 2, 8, 2, 5, 5, 5, 1], - "y": [3, 1, 7, 4, 5, 9, 6, 1], - "z": [1, 8, 2, 5, 6, 22, 2, 2], - "zz": [14, 46, 1, 6, 30, 100, 2, 2], - } - ).reset_index(drop=True) + data_df = pd.DataFrame({ + "Metadata_plate": ["a", "a", "a", "a", "b", "b", "b", "b"], + "Metadata_treatment": [ + "drug", + "drug", + "control", + "control", + "drug", + "drug", + "control", + "control", + ], + "x": [1, 2, 8, 2, 5, 5, 5, 1], + "y": [3, 1, 7, 4, 5, 9, 6, 1], + "z": [1, 8, 2, 5, 6, 22, 2, 2], + "zz": [14, 46, 1, 6, 30, 100, 2, 2], + }).reset_index(drop=True) normalized_df = normalize( profiles=data_df, features=["x", "y", "z", "zz"], meta_features="infer", samples="Metadata_treatment == 'control'", - method="standardize" + method="standardize", ) + ``` """ # Load Data profiles = load_profiles(profiles)