From 3255beadc11063ca8ed5a5f35c9c8b44530593d5 Mon Sep 17 00:00:00 2001 From: ASintsova Date: Thu, 8 Feb 2024 16:30:53 +0100 Subject: [PATCH 1/9] Create ci-with-conda.yml --- .github/workflows/ci-with-conda.yml | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/ci-with-conda.yml diff --git a/.github/workflows/ci-with-conda.yml b/.github/workflows/ci-with-conda.yml new file mode 100644 index 0000000..22dd1e9 --- /dev/null +++ b/.github/workflows/ci-with-conda.yml @@ -0,0 +1,34 @@ +name: Python Package using Conda + +on: [push] + +jobs: + build-linux: + runs-on: ubuntu-latest + strategy: + max-parallel: 5 + + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.8 + uses: actions/setup-python@v3 + with: + python-version: '3.8' + - name: Add conda to system path + run: | + # $CONDA is an environment variable pointing to the root of the miniconda directory + echo $CONDA/bin >> $GITHUB_PATH + - name: Install dependencies + run: | + conda env update --file mbarq_environment.yaml --name base + - name: Lint with flake8 + run: | + conda install flake8 + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + conda install pytest + pytest From fddb71b3626e0a86b8b98824f16144259029c4e6 Mon Sep 17 00:00:00 2001 From: ASintsova Date: Thu, 8 Feb 2024 16:36:01 +0100 Subject: [PATCH 2/9] Update ci-with-conda.yml --- .github/workflows/ci-with-conda.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-with-conda.yml b/.github/workflows/ci-with-conda.yml index 22dd1e9..8592f01 100644 --- a/.github/workflows/ci-with-conda.yml +++ b/.github/workflows/ci-with-conda.yml @@ -1,6 +1,10 @@ name: Python Package using Conda -on: [push] +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] jobs: build-linux: From d2805515baae0c65f6dec8c8c819cb6cb4e160a3 Mon Sep 17 00:00:00 2001 From: ASintsova Date: Thu, 8 Feb 2024 17:55:20 +0100 Subject: [PATCH 3/9] Update ci-with-conda.yml --- .github/workflows/ci-with-conda.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-with-conda.yml b/.github/workflows/ci-with-conda.yml index 8592f01..9daeca1 100644 --- a/.github/workflows/ci-with-conda.yml +++ b/.github/workflows/ci-with-conda.yml @@ -24,7 +24,8 @@ jobs: echo $CONDA/bin >> $GITHUB_PATH - name: Install dependencies run: | - conda env update --file mbarq_environment.yaml --name base + conda install mamba + mamba env update --file mbarq_environment.yaml --name base - name: Lint with flake8 run: | conda install flake8 From a20ef5ce918d0029dd9b20eec74a6e6103b8ad0a Mon Sep 17 00:00:00 2001 From: ASintsova Date: Thu, 8 Feb 2024 18:01:56 +0100 Subject: [PATCH 4/9] Update ci-with-conda.yml --- .github/workflows/ci-with-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-with-conda.yml b/.github/workflows/ci-with-conda.yml index 9daeca1..e1a8cd2 100644 --- a/.github/workflows/ci-with-conda.yml +++ b/.github/workflows/ci-with-conda.yml @@ -24,7 +24,7 @@ jobs: echo $CONDA/bin >> $GITHUB_PATH - name: Install dependencies run: | - conda install mamba + conda install -c conda-forge mamba mamba env update --file mbarq_environment.yaml --name base - name: Lint with flake8 run: | From 6b31902985ea6b790508048b534d31fca7d73e1d Mon Sep 17 00:00:00 2001 From: ASintsova Date: Thu, 8 Feb 2024 20:36:09 +0100 Subject: [PATCH 5/9] Update ci-with-conda.yml --- .github/workflows/ci-with-conda.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-with-conda.yml b/.github/workflows/ci-with-conda.yml index e1a8cd2..bd9ae8c 100644 --- a/.github/workflows/ci-with-conda.yml +++ b/.github/workflows/ci-with-conda.yml @@ -14,10 +14,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Python 3.8 + - name: Set up Python 3.10 uses: actions/setup-python@v3 with: - python-version: '3.8' + python-version: '3.10' - name: Add conda to system path run: | # $CONDA is an environment variable pointing to the root of the miniconda directory From b3c05298f088b3ed5753616a77523083e4c74bf5 Mon Sep 17 00:00:00 2001 From: ASintsova Date: Thu, 8 Feb 2024 20:41:05 +0100 Subject: [PATCH 6/9] Update mbarq_environment.yaml --- mbarq_environment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mbarq_environment.yaml b/mbarq_environment.yaml index 76942ff..9346bb0 100644 --- a/mbarq_environment.yaml +++ b/mbarq_environment.yaml @@ -5,7 +5,7 @@ channels: - defaults dependencies: - mageck - - python==3.8.* + - python>=3.8 - blast==2.9.* - bedtools==2.30.* - biopython==1.79 From 3d3aad5a32e5552736ffd1340b6df2e176334283 Mon Sep 17 00:00:00 2001 From: ASintsova Date: Thu, 8 Feb 2024 20:44:53 +0100 Subject: [PATCH 7/9] Update mbarq_environment.yaml --- mbarq_environment.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mbarq_environment.yaml b/mbarq_environment.yaml index 9346bb0..ee6c304 100644 --- a/mbarq_environment.yaml +++ b/mbarq_environment.yaml @@ -9,8 +9,8 @@ dependencies: - blast==2.9.* - bedtools==2.30.* - biopython==1.79 - - numpy=1.22.1 - - pandas==1.3.3 + - numpy=1.22 + - pandas - pytest - click - pip From 632d51454a5d63918ea64bf361c23f2b62507250 Mon Sep 17 00:00:00 2001 From: ASintsova Date: Thu, 8 Feb 2024 20:54:05 +0100 Subject: [PATCH 8/9] Fix bug in analysis.py --- mbarq/analysis.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/mbarq/analysis.py b/mbarq/analysis.py index f878d3d..f17da81 100644 --- a/mbarq/analysis.py +++ b/mbarq/analysis.py @@ -383,12 +383,14 @@ def process_results(self, contrasts_run=()): self.logger.info('Writing out final results.') if not contrasts_run: contrasts_run = self.sd.contrasts - try: - res = pd.concat([pd.read_table(self.output_dir / f"{self.name}_{i}_vs_{self.sd.baseline}.gene_summary.txt") - .assign(contrast=i) for i in contrasts_run]) - except: - print(f"Warning: No such file or directory: {self.output_dir}/{self.name}_{i}_vs_{self.sd.baseline}.gene_summary.txt") - + contrast_dfs = [] + for con in contrasts_run: + try: + contrast_dfs.append(pd.read_table(self.output_dir / f"{self.name}_{con}_vs_{self.sd.baseline}.gene_summary.txt") + .assign(contrast=con)) + except: + print(f"Warning: No such file or directory: {self.output_dir}/{self.name}_{con}_vs_{self.sd.baseline}.gene_summary.txt") + res = pd.concat(contrast_dfs) bc_res = pd.concat([pd.read_table(self.output_dir / f"{self.name}_{i}_vs_{self.sd.baseline}.sgrna_summary.txt") .assign(contrast=i) for i in contrasts_run]).rename({'sgrna': 'barcode', 'Gene': 'Name'}, axis=1) fres = res[['id', 'num', 'neg|lfc', 'neg|fdr', 'pos|fdr', 'contrast']] From adb905713981c40bea8677d4ae7951a9c299ea92 Mon Sep 17 00:00:00 2001 From: ASintsova Date: Thu, 8 Feb 2024 20:59:11 +0100 Subject: [PATCH 9/9] Update ci-with-conda.yml --- .github/workflows/ci-with-conda.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-with-conda.yml b/.github/workflows/ci-with-conda.yml index bd9ae8c..3398ce8 100644 --- a/.github/workflows/ci-with-conda.yml +++ b/.github/workflows/ci-with-conda.yml @@ -26,6 +26,7 @@ jobs: run: | conda install -c conda-forge mamba mamba env update --file mbarq_environment.yaml --name base + pip install . - name: Lint with flake8 run: | conda install flake8