Skip to content

Commit

Permalink
erge branch 'ASintsova-ci-with-conda' of https://github.com/Microbiol…
Browse files Browse the repository at this point in the history
…ogyETHZ/mbarq

 Please enter a commit message to explain why this merge is necessary,
  • Loading branch information
Anna Sintsova committed Feb 9, 2024
2 parents ceae7bf + adb9057 commit 4d0514c
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 9 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/ci-with-conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Python Package using Conda

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 5

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: '3.10'
- 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 install -c conda-forge mamba
mamba env update --file mbarq_environment.yaml --name base
pip install .
- 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
14 changes: 8 additions & 6 deletions mbarq/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']]
Expand Down
6 changes: 3 additions & 3 deletions mbarq_environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ channels:
- defaults
dependencies:
- mageck
- python==3.8.*
- python>=3.8
- blast==2.9.*
- bedtools==2.30.*
- biopython==1.79
- numpy=1.22.1
- pandas==1.3.3
- numpy=1.22
- pandas
- pytest
- click
- pip
Expand Down

0 comments on commit 4d0514c

Please sign in to comment.