Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move documentation and add support for the survival screens #20

Merged
merged 86 commits into from
Mar 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
c4df38a
update documentation
jykr Mar 30, 2024
ce22f2d
test doc
jykr Mar 30, 2024
4f11b82
test doc
jykr Mar 30, 2024
d7eaa05
move files
jykr Mar 30, 2024
2bf56a7
add Sphinx dependencies
jykr Mar 30, 2024
f5ee597
add Sphinx dependencies
jykr Mar 30, 2024
4be0796
fix main parser
jykr Mar 30, 2024
9982896
work under docs/
jykr Mar 30, 2024
3cf9777
work under docs/
jykr Mar 30, 2024
995faed
move requirements
jykr Mar 30, 2024
e7e22c7
update test arguments
jykr Mar 30, 2024
932dba4
try sphinx doc
jykr Mar 30, 2024
4338d5e
try sphinx doc edit
jykr Mar 30, 2024
c488dd4
fix doc
jykr Mar 30, 2024
426a4f8
fix command
jykr Mar 30, 2024
232a25b
Update documentation.yml
jykr Mar 30, 2024
085fee2
Update documentation.yml
jykr Mar 30, 2024
6dd11e1
Update documentation.yml
jykr Mar 30, 2024
882271a
changed
jykr Mar 30, 2024
7996d2b
try torch 2
jykr Mar 30, 2024
31a79f7
try torch 2
jykr Mar 30, 2024
2d983fc
move parser to not require import
jykr Mar 30, 2024
22858cd
remove bean dependency
jykr Mar 30, 2024
f026a07
update dependency
jykr Mar 30, 2024
90683be
update dependency
jykr Mar 30, 2024
b529340
update dependency
jykr Mar 30, 2024
920d937
remove dependency of distutils
jykr Mar 30, 2024
e241fa9
remove 3.8 requirement
jykr Mar 30, 2024
59dc74e
deploy
jykr Mar 30, 2024
affb805
change deploy dif
jykr Mar 30, 2024
c778ac0
update directory
jykr Mar 30, 2024
5d722a1
require pyro version that supports Torch2
jykr Mar 30, 2024
b5a7fb4
try different working directory
jykr Mar 30, 2024
0abcb2f
try different working directory
jykr Mar 30, 2024
98b748f
try different working directory
jykr Mar 30, 2024
3a292d7
try push
jykr Mar 30, 2024
e8a6df1
Require Pyro-ppl >= 1.8.5
jykr Mar 30, 2024
4949246
fix push
jykr Mar 30, 2024
3c88eb1
change scope of checkout
jykr Mar 30, 2024
86aa671
Documentation generated
your-username Mar 30, 2024
b954a94
remove incorrect import
jykr Mar 30, 2024
2519ccf
deploy artifact
jykr Mar 30, 2024
661bb43
Merge branch 'doc' of https://github.com/pinellolab/crispr-bean into doc
jykr Mar 30, 2024
a3fcae3
add permission
jykr Mar 30, 2024
15c7cc2
change name of the artifact
jykr Mar 30, 2024
45e5ebb
unify version
jykr Mar 30, 2024
4e9d6ba
add permission
jykr Mar 30, 2024
be458a2
edit
jykr Mar 30, 2024
4ba1960
use correct page artifact
jykr Mar 30, 2024
c7beb55
roll back to deploy-pages v3
jykr Mar 30, 2024
d29be47
return state instead of paramStore
jykr Mar 30, 2024
f075ba0
back to v4
jykr Mar 30, 2024
78295c3
remove build file
jykr Mar 30, 2024
65ad2cb
remove duplicate index
jykr Mar 30, 2024
8314104
use separate save and param dict
jykr Mar 30, 2024
86e910a
fix key for paramStore writing
jykr Mar 30, 2024
1dc0593
add images to docs
jykr Mar 30, 2024
fb92a65
add negctrl as separate arg
jykr Mar 30, 2024
cde6b27
add doc
jykr Mar 30, 2024
8fec7ea
add doc
jykr Mar 30, 2024
076679e
change title
jykr Mar 30, 2024
a51d1ba
fix unbounderror
jykr Mar 30, 2024
d242944
Update README.md
jykr Mar 30, 2024
360acb3
add data structure
jykr Mar 30, 2024
620a855
add data structure
jykr Mar 30, 2024
1dcc3ca
Merge branch 'doc' of https://github.com/pinellolab/crispr-bean into doc
jykr Mar 30, 2024
148957a
change images
jykr Mar 30, 2024
8ea81a2
update docs
jykr Mar 30, 2024
16e3b5d
add tutorial for survival screen
jykr Mar 30, 2024
1174c70
remove copying img directory
jykr Mar 30, 2024
217a317
remove copying img directory
jykr Mar 30, 2024
78193f7
add copy again
jykr Mar 30, 2024
d9445ab
change copy dir
jykr Mar 30, 2024
2ac37dc
add missing files
jykr Mar 30, 2024
03d093e
prioritize rst
jykr Mar 30, 2024
a099341
disamgibuagte names
jykr Mar 30, 2024
d29e73d
remove old files
jykr Mar 30, 2024
c3cee14
remove old files
jykr Mar 30, 2024
4bb61aa
add intro
jykr Mar 30, 2024
749df5f
add image
jykr Mar 30, 2024
0140a47
add test data
jykr Mar 30, 2024
05899a8
fix filtering qc
jykr Mar 30, 2024
f52937c
Fix QC notebook
jykr Mar 30, 2024
4d4791d
change intro message
jykr Mar 30, 2024
6efb8d3
fix qc error message
jykr Mar 30, 2024
2ecc9b5
fix typo
jykr Mar 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.8'
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install torch==1.12.1+cpu torchvision==0.13.1+cpu torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cpu
pip install torch torchvision torchaudio
pip install -r requirements.txt
pip install -e .
- name: Test with pytest
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Sphinx: Render docs"

on: push

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: Install Sphinx & Dependencies
run: |
pip install sphinx sphinx_markdown_builder sphinx_rtd_theme sphinx-argparse m2r pandas bio
sudo apt-get install python3-distutils
- name: Build Documentation
working-directory: docs
run: sphinx-build . _build
- name: copy image files
run: cp -r docs/assets docs/_build/
- uses: actions/upload-pages-artifact@v3
with:
name: github-pages
path: docs/_build/

deploy:
needs: build
permissions:
id-token: write
pages: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.pyc
*.fastq
Empty file modified LICENSE
100644 → 100755
Empty file.
Empty file modified MANIFEST.in
100644 → 100755
Empty file.
490 changes: 37 additions & 453 deletions README.md
100644 → 100755

Large diffs are not rendered by default.

Empty file modified bean/__init__.py
100644 → 100755
Empty file.
Empty file modified bean/annotate/__init__.py
100644 → 100755
Empty file.
Empty file modified bean/annotate/_supporting_fn.py
100644 → 100755
Empty file.
Empty file modified bean/annotate/filter_alleles.py
100644 → 100755
Empty file.
Empty file modified bean/annotate/ldlr_exons.fa
100644 → 100755
Empty file.
Empty file modified bean/annotate/translate_allele.py
100644 → 100755
Empty file.
24 changes: 7 additions & 17 deletions bean/annotate/utils.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -218,22 +218,12 @@ def get_cds_seq_pos_from_gene_name(gene_name: str, ref_version: str = "GRCh38"):
return cds_chrom, cds_seq, cds_pos, strand


def parse_args():
"""Get the input arguments"""
print(
r"""
_ _
/ \ '\ __ _ _ _
| \ \ / _(_) | |_ ___ _ _
\ \ | | _| | | _/ -_) '_|
`.__|/ |_| |_|_|\__\___|_|
"""
)
print("bean-filter: filter alleles")
parser = argparse.ArgumentParser(
prog="allele_filter",
description="Filter alleles based on edit position in spacer and frequency across samples.",
)
def parse_args(parser=None):
if parser is None:
parser = argparse.ArgumentParser(
prog="allele_filter",
description="Filter alleles based on edit position in spacer and frequency across samples.",
)
parser.add_argument(
"bdata_path",
type=str,
Expand Down Expand Up @@ -349,7 +339,7 @@ def parse_args():
action="store_true",
help="Load temporary file and work from there.",
)
return parser.parse_args()
return parser


def check_args(args):
Expand Down
Empty file added bean/cli/__init__.py
Empty file.
195 changes: 90 additions & 105 deletions bin/bean-count → bean/cli/count.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,105 +1,90 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Count guides, optionally with reporter and alleles of a single sequencing sample."""

import logging
import os
import sys

import bean
from bean.mapping.utils import (
_check_arguments,
_get_input_parser,
_check_file,
_get_first_read_length,
_check_read_length,
)

logging.basicConfig(
level=logging.INFO,
format="%(levelname)-5s @ %(asctime)s:\n\t %(message)s \n",
datefmt="%a, %d %b %Y %H:%M:%S",
stream=sys.stderr,
filemode="w",
)
error = logging.critical
warn = logging.warning
debug = logging.debug
info = logging.info


_ROOT = os.path.abspath(os.path.dirname(__file__))


def get_input_parser():
"""Get single-sample specific argument parser."""
parser = _get_input_parser()
parser.add_argument(
"--R1",
type=str,
help="fastq file for read 1",
required=True,
default="Fastq filename",
)
parser.add_argument(
"--R2",
type=str,
help="fastq file for read 2, sorted as the same name order as in --R1 file.",
required=True,
default="Fastq filename",
)
return parser


def check_arguments(args, info_logger, warn_logger, error_logger):
args = _check_arguments(
args, info_logger=info, warn_logger=warn, error_logger=error
)
_check_file(args.R1)
_check_file(args.R2)
read_length = _get_first_read_length(args.R1)
_check_read_length(args, read_length, warn)
return args


def main():
parser = get_input_parser()
args = parser.parse_args()

args = check_arguments(args, info_logger=info, warn_logger=warn, error_logger=error)
args_dict = vars(args)

edited_from = args_dict["edited_base"]
match_target_pos = args_dict["match_target_pos"]

counter = bean.mp.GuideEditCounter(**args_dict)
counter.check_filter_fastq()

counter.get_counts()
if counter.count_reporter_edits:
counter.screen.uns["allele_counts"] = counter.screen.uns["allele_counts"].loc[
counter.screen.uns["allele_counts"].allele.map(str) != "", :
]
if match_target_pos:
base_editing_map = {"A": "G", "C": "T"}
edited_to = base_editing_map[edited_from]
counter.screen.get_edit_mat_from_uns(
edited_from, edited_to, match_target_pos
)
counter.screen.write(f"{counter.output_dir}.h5ad")
counter.screen.to_Excel(f"{counter.output_dir}.xlsx")
info(f"Output written at:\n {counter.output_dir}.h5ad,\n {counter.output_dir}.xlsx")
info("All Done!")
print(
r"""
_ _
/ \ '\ _
| \ \ __ ___ _ _ _ _| |_
\ \ | / _/ _ \ || | ' \ _|
`.__|/ \__\___/\_,_|_||_\__|
"""
)


if __name__ == "__main__":
main()
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Count guides, optionally with reporter and alleles of a single sequencing sample."""

import logging
import os
import sys

import bean
from bean.mapping.utils import (
_check_arguments,
_check_file,
_get_first_read_length,
_check_read_length,
)

logging.basicConfig(
level=logging.INFO,
format="%(levelname)-5s @ %(asctime)s:\n\t %(message)s \n",
datefmt="%a, %d %b %Y %H:%M:%S",
stream=sys.stderr,
filemode="w",
)
error = logging.critical
warn = logging.warning
debug = logging.debug
info = logging.info


_ROOT = os.path.abspath(os.path.dirname(__file__))





def check_arguments(args, info_logger, warn_logger, error_logger):
args = _check_arguments(
args, info_logger=info, warn_logger=warn, error_logger=error
)
_check_file(args.R1)
_check_file(args.R2)
read_length = _get_first_read_length(args.R1)
_check_read_length(args, read_length, warn)
return args


def main(args):
"""Get the input data"""
print(
r"""
_ _
/ \ '\ _
| \ \ __ ___ _ _ _ _| |_
\ \ | / _/ _ \ || | ' \ _|
`.__|/ \__\___/\_,_|_||_\__|
"""
)
args = check_arguments(args, info_logger=info, warn_logger=warn, error_logger=error)
args_dict = vars(args)

edited_from = args_dict["edited_base"]
match_target_pos = args_dict["match_target_pos"]

counter = bean.mp.GuideEditCounter(**args_dict)
counter.check_filter_fastq()

counter.get_counts()
if counter.count_reporter_edits:
counter.screen.uns["allele_counts"] = counter.screen.uns["allele_counts"].loc[
counter.screen.uns["allele_counts"].allele.map(str) != "", :
]
if match_target_pos:
base_editing_map = {"A": "G", "C": "T"}
edited_to = base_editing_map[edited_from]
counter.screen.get_edit_mat_from_uns(
edited_from, edited_to, match_target_pos
)
counter.screen.write(f"{counter.output_dir}.h5ad")
counter.screen.to_Excel(f"{counter.output_dir}.xlsx")
info(f"Output written at:\n {counter.output_dir}.h5ad,\n {counter.output_dir}.xlsx")
info("All Done!")
print(
r"""
_ _
/ \ '\ _
| \ \ __ ___ _ _ _ _| |_
\ \ | / _/ _ \ || | ' \ _|
`.__|/ \__\___/\_,_|_||_\__|
"""
)
Loading
Loading