Skip to content

Commit

Permalink
Merge branch 'master' into mckay/halt_on_plot_fail
Browse files Browse the repository at this point in the history
  • Loading branch information
Colelyman committed Sep 30, 2024
2 parents 2bb9ae5 + 855813c commit bd4c378
Show file tree
Hide file tree
Showing 7 changed files with 409 additions and 273 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Run Pytest

on:
push:

pull_request:
types: [opened, reopened]

Expand All @@ -20,9 +20,8 @@ jobs:
- uses: actions/checkout@v3

- name: Set up Conda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
mamba-version: "*"
channels: conda-forge,bioconda,defaults
auto-activate-base: false
activate-environment: test_env
Expand All @@ -32,15 +31,15 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y gcc g++ bowtie2 samtools libsys-hostname-long-perl
- name: Install Pytest
run: |
pip install pytest pytest-cov
- name: Install CRISPResso
run: |
pip install -e .
- name: Run Pytest
run: |
run: |
pytest tests --cov CRISPResso2
13 changes: 7 additions & 6 deletions CRISPResso2/CRISPRessoCORE.py
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,11 @@ def print_stacktrace_if_debug():

logger.addHandler(CRISPRessoShared.StatusHandler(os.path.join(OUTPUT_DIRECTORY, 'CRISPResso_status.json')))

if C2PRO_INSTALLED:
debug(f'CRISPRessoPro v{CRISPRessoProVersion} installed', {'percent_complete': 0.5})
else:
debug(f'CRISPRessoPro not installed', {'percent_complete': 0.5})

aln_matrix_loc = os.path.join(_ROOT, "EDNAFULL")
CRISPRessoShared.check_file(aln_matrix_loc)
aln_matrix = CRISPResso2Align.read_matrix(aln_matrix_loc)
Expand Down Expand Up @@ -1978,10 +1983,6 @@ def get_prime_editing_guides(this_amp_seq, this_amp_name, ref0_seq, prime_edited

#now that we're done with adding possible guides and amplicons, go through each amplicon and compute quantification windows
info('Computing quantification windows', {'percent_complete': 2})
if C2PRO_INSTALLED:
info(f'CRISPRessoPro v{CRISPRessoProVersion} installed', {'percent_complete': 3})
else:
info(f'CRISPRessoPro not installed', {'percent_complete': 3})

found_guide_seq = [False]*len(guides)
found_coding_seq = [False]*len(coding_seqs)
Expand Down Expand Up @@ -2021,14 +2022,14 @@ def get_prime_editing_guides(this_amp_seq, this_amp_name, ref0_seq, prime_edited
#for all amps in forward and reverse complement amps:
for amp_seq in [this_seq, CRISPRessoShared.reverse_complement(this_seq)]:
ref_incentive = np.zeros(len(amp_seq)+1, dtype=int)
s1, s2, score=CRISPResso2Align.global_align(guide, amp_seq, matrix=aln_matrix, gap_incentive=ref_incentive, gap_open=args.needleman_wunsch_gap_open, gap_extend=args.needleman_wunsch_gap_extend,)
s1, s2, score=CRISPResso2Align.global_align(guide, amp_seq, matrix=aln_matrix, gap_incentive=ref_incentive, gap_open=args.flexiguide_gap_open_penalty, gap_extend=args.flexiguide_gap_extend_penalty)
potential_guide = s1.strip("-")
if abs(len(potential_guide) - len(guide)) < 2: #if length of putative guide is off by less than 2, keep it (allows 1 gap)
loc = s1.find(potential_guide)
potential_ref = amp_seq[loc:loc+len(potential_guide)]
#realign to test for number of mismatches
ref_incentive = np.zeros(len(potential_ref)+1, dtype=int)
sub_s1, sub_s2, sub_score=CRISPResso2Align.global_align(guide, potential_ref, matrix=aln_matrix, gap_incentive=ref_incentive, gap_open=args.needleman_wunsch_gap_open, gap_extend=args.needleman_wunsch_gap_extend,)
sub_s1, sub_s2, sub_score=CRISPResso2Align.global_align(guide, potential_ref, matrix=aln_matrix, gap_incentive=ref_incentive, gap_open=args.flexiguide_gap_open_penalty, gap_extend=args.flexiguide_gap_extend_penalty)
mismatches = []
for i in range(len(sub_s1)):
if sub_s1[i] != sub_s2[i]:
Expand Down
Loading

0 comments on commit bd4c378

Please sign in to comment.