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

Implement nox #51

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
de53ea4
Update params `CRISPResso_reference_info.txt` due to printing numpy a…
Colelyman Jun 17, 2024
8a692c0
Merge branch 'master' into cole/fix-cython
Colelyman Sep 3, 2024
ae19e2d
Make the gap_incentive a list instead of a numpy array
Colelyman Sep 3, 2024
44a07c6
Add working noxfile
Colelyman Oct 8, 2024
2ee668f
Add common arguments to each test case
Colelyman Oct 9, 2024
86df7a4
Extract numpy versions as variable
Colelyman Oct 9, 2024
785ad68
Remove CONDA_ENVIRONMENTS (create CondaEnv manually)
Colelyman Oct 9, 2024
ae61162
Update the name of the basic test case
Colelyman Oct 9, 2024
cc3ed3f
Allow the update command to be run in nox
Colelyman Oct 9, 2024
a26fd96
Implement the `print` posarg
Colelyman Oct 9, 2024
db056d1
Add Python parameters and add force posarg for conda envs
Colelyman Oct 9, 2024
e9a6aad
Rename prime_editor to prime-editor
Colelyman Oct 9, 2024
10fb050
Update pooled-prime-editing test case
Colelyman Oct 10, 2024
1130e40
Add additional test commands to test_config.yml
Colelyman Oct 10, 2024
d71c347
Merge branch 'master' into cole/fix-cython
Colelyman Oct 10, 2024
eef99ca
Merge branch 'cole/fix-cython' into cole/implement-nox
Colelyman Oct 10, 2024
6697300
Have ydiff always output color
Colelyman Oct 11, 2024
15e474a
Fix indentation
Colelyman Oct 11, 2024
25921f0
Add pooled-mixed-mode and pooled-mixed-mode-genome-demux
Colelyman Oct 11, 2024
1637d85
Move package versions to yaml file
Colelyman Oct 18, 2024
7102674
Modify adding tests to new format
Colelyman Oct 18, 2024
6888566
Fix bugs in adding a command
Colelyman Oct 18, 2024
43dba7e
Update README.md with nox commands
Colelyman Oct 18, 2024
0a8fbca
Add clean target to nox file and web_ui and stress tests
Colelyman Oct 18, 2024
ccb6220
Delete Makefile
Colelyman Oct 18, 2024
670b1c4
Comment out other python and numpy versions
Colelyman Oct 18, 2024
f50afcb
Copy over COMMON_ARGS instead of trying to import them
Colelyman Oct 18, 2024
3e9b03e
Rename batch test case
Colelyman Oct 18, 2024
ce07529
Rename pooled test case
Colelyman Oct 18, 2024
ebddd4e
Remove WGS actual files
Colelyman Oct 29, 2024
25ee2f3
Update aggregate because of changing the names of batch runs
Colelyman Oct 29, 2024
aaa21f1
Update CRISPRessoCompare expected results with name change
Colelyman Oct 30, 2024
a1f257c
Add documentation about conda envs to README
Colelyman Oct 30, 2024
0b5a698
Add new expected batche files
Colelyman Oct 30, 2024
1ea3fea
Add new WGS expected files
Colelyman Oct 30, 2024
5e8fb9f
Update WGS expected results html file
Colelyman Oct 30, 2024
cb54dde
Add ability to run unit tests
Colelyman Oct 30, 2024
3b7def5
Add support for parameterizing pandas
Colelyman Oct 31, 2024
9de76c5
Implement caching of CRISPResso install
Colelyman Oct 31, 2024
0846684
Update fastp version to 0.24.0
Colelyman Nov 12, 2024
b7d255f
Improve documentation of the Cache
Colelyman Nov 12, 2024
c4dead8
Add dependencies to README
Colelyman Nov 12, 2024
d24b3f3
- added micromamba support
mbowcut2 Nov 16, 2024
5e493e3
Add pip to nox
Snicker7 Nov 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
cli_integration_tests/CRISPResso_on_FANC.Cas9*
cli_integration_tests/CRISPResso_on_bam*
cli_integration_tests/CRISPResso_on_params*
cli_integration_tests/CRISPRessoBatch_on_FANC*
cli_integration_tests/CRISPRessoBatch_on_batch*
cli_integration_tests/CRISPRessoPooled_on_Both.Cas9*
cli_integration_tests/CRISPRessoWGS_on_Both.Cas9.fastq.smallGenome*
cli_integration_tests/CRISPRessoCompare_on_Cas9_VS_Untreated*
cli_integration_tests/CRISPRessoWGS_on_wgs*
cli_integration_tests/CRISPRessoCompare_on_compare*
cli_integration_tests/CRISPRessoPooled_on_prime.editing*
cli_integration_tests/CRISPResso_on_basic-write-bam-out*
cli_integration_tests/CRISPResso_on_basic-write-bam-out-parallel*
Expand Down
215 changes: 0 additions & 215 deletions Makefile

This file was deleted.

52 changes: 43 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,87 @@
# CRISPResso2_tests

A repository for testing that is too large (or too private) to be kept in their respective repositories.
A repository for testing that is too large to be kept in their respective repositories.

## `CRISPResso2` Thorough Integration Tests

To run the integration tests for `CRISPResso2` make sure that the `CRISPRESSO2_DIR` variable in the `Makefile` is set to the correct directory where the `CRISPResso2` repository is (by default it is set to `../CRISPResso2`).
Then to run only the integration tests you can issue `make all test` and it will run the tests and compare the output.
To run the integration tests for `CRISPResso2` make sure that the `CRISPRESSO2_DIR` variable in the `noxfile.py` is set to the correct directory (or you have a `CRISPRESSO2_DIR` environment variable set) where the `CRISPResso2` repository is (by default it is set to `../CRISPResso2`).
Then to run only the integration tests you can issue `nox -- test` and it will run the tests and compare the output.

Furthermore, the running times of each integration test will be checked and if there is a difference > 10% in the two times, it will be reported.

For improved diff output, run `pip install ydiff` and the diffs will be colorized and side by side.

## Dependencies

Install the following dependencies to run the tests:

- `nox`
- `pyyaml`
- `ydiff` (optional)

### How can I run a test?

As explained above, to run all of the tests use:

``` shell
make all
nox
```

To run all the tests and check all files for differences use the `test` option:

```shell
make all test
nox -- test
```

You can also select a single command to run, like this:

``` shell
make basic
nox -s basic
```

**Note:** this will only run the CRISPResso command, it will not check the output files for differences.

If you want to run a single command *and* check it for differences, use the `test` option, like this:

``` shell
make basic test
nox -s basic -- test
```

By default, tests will only print command output in the case of an error. To force print output for any test use the `print` option, like this:

``` shell
make basic print
nox -s basic -- print
```

Note that `test` and `print` can be combined, like this:

``` shell
nox -s basic -- print test
```

### Nox conda environments and package version management

Nox will automatically create a number of conda environments based on the parameters of the packages that are specified in the `test_config.yaml` file. This happens if you run `nox`. To make tests run faster, the conda environments are cached (it checks if `samtools` is accessible, and if so it skips installing all of the packages) and there may be times if you need to manually trigger the creation of the conda environments.

To initially create the conda environments you can run:

``` shell
nox -s conda_env
```

This will create conda environments with the specified versions in the `.nox` directory. If there are already conda environments and you would like to update them, then you should add the `force` argument like this: `nox -c conda_env -- force`.

If you are running on Apple Silicon, you most likely want to run the above command like `CONDA_SUBDIR="osx-64" nox -s conda_env -- force` so that the x86 versions of the packages are installed.

### How can I update the expected results for a test?

If you run a test and there are differences, you can run the command:
If you run a test and there are differences that you want to update the expected results files, you can run the command:

``` shell
nox -s basic -- update
```

Which will run the command:

```shell
python test_manager.py update <actual CRISPResso results directory> <expected CRISPResso results directory>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
{
"running_info": {
"version": "2.3.2",
"args": {
"_type": "argparse.Namespace",
"value": {
"amplicon_seq": "CGGATGTTCCAATCAGTACGCAGAGAGTCGCCGTCTCCAAGGTGAAAGCGGAAGTAGGGCCTTCGCGCACCTCATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAGCTTCTGGCGGTCTCAAGCACTACCTACGTCAGCACCTGGGACCCCGCCACCGTGCGCCGGGCCTTGCAGTGGGCGCGCTACCTGCGCCACATCCATCGGCGCTTTGGTCGG",
"amplicon_name": "Reference",
"amplicon_min_alignment_score": "",
"default_min_aln_score": 60,
"expand_ambiguous_alignments": false,
"assign_ambiguous_alignments_to_first_reference": false,
"guide_seq": "GGAATCCCTTCTGCAGCACC",
"guide_name": "",
"flexiguide_seq": "None",
"flexiguide_homology": 80,
"flexiguide_name": "",
"flexiguide_gap_open_penalty": -20,
"flexiguide_gap_extend_penalty": -2,
"discard_guide_positions_overhanging_amplicon_edge": false,
"expected_hdr_amplicon_seq": "",
"coding_seq": "",
"config_file": "None",
"min_average_read_quality": 0,
"min_single_bp_quality": 0,
"min_bp_quality_or_N": 0,
"file_prefix": "",
"name": "batch",
"suppress_amplicon_name_truncation": false,
"output_folder": "",
"verbosity": 3,
"split_interleaved_input": false,
"trim_sequences": false,
"trimmomatic_command": "None",
"trimmomatic_options_string": "",
"flash_command": "None",
"fastp_command": "fastp",
"fastp_options_string": "",
"min_paired_end_reads_overlap": 10,
"max_paired_end_reads_overlap": "None",
"stringent_flash_merging": false,
"force_merge_pairs": false,
"quantification_window_size": "1",
"quantification_window_center": "-3",
"exclude_bp_from_left": 15,
"exclude_bp_from_right": 15,
"use_legacy_insertion_quantification": false,
"ignore_substitutions": false,
"ignore_insertions": false,
"ignore_deletions": false,
"discard_indel_reads": false,
"needleman_wunsch_gap_open": -20,
"needleman_wunsch_gap_extend": -2,
"needleman_wunsch_gap_incentive": 1,
"needleman_wunsch_aln_matrix_loc": "EDNAFULL",
"aln_seed_count": 5,
"aln_seed_len": 10,
"aln_seed_min": 2,
"plot_histogram_outliers": false,
"plot_window_size": 20,
"min_frequency_alleles_around_cut_to_plot": 0.2,
"expand_allele_plots_by_quantification": false,
"allele_plot_pcts_only_for_assigned_reference": false,
"quantification_window_coordinates": null,
"annotate_wildtype_allele": "",
"keep_intermediate": false,
"dump": false,
"write_detailed_allele_table": false,
"fastq_output": false,
"bam_output": false,
"bowtie2_index": "",
"zip_output": false,
"max_rows_alleles_around_cut_to_plot": 50,
"suppress_report": false,
"place_report_in_output_folder": true,
"suppress_plots": false,
"write_cleaned_report": false,
"base_editor_output": true,
"conversion_nuc_from": "C",
"conversion_nuc_to": "T",
"prime_editing_pegRNA_spacer_seq": "",
"prime_editing_pegRNA_extension_seq": "",
"prime_editing_pegRNA_extension_quantification_window_size": 5,
"prime_editing_pegRNA_scaffold_seq": "",
"prime_editing_pegRNA_scaffold_min_match_length": 1,
"prime_editing_nicking_guide_seq": "",
"prime_editing_override_prime_edited_ref_seq": "",
"prime_editing_override_sequence_checks": false,
"prime_editing_gap_open_penalty": -50,
"prime_editing_gap_extend_penalty": 0,
"crispresso1_mode": false,
"dsODN": "",
"auto": false,
"debug": true,
"no_rerun": false,
"n_processes": "1",
"bam_input": "",
"bam_chr_loc": "",
"save_also_png": false,
"batch_settings": "inputs/FANC.batch",
"skip_failed": false,
"min_reads_for_inclusion": 0,
"batch_output_folder": "",
"suppress_batch_summary_plots": false,
"crispresso_command": "CRISPResso",
"disable_guardrails": false,
"use_matplotlib": false,
"halt_on_plot_fail": true
}
},
"log_filename": "CRISPRessoBatch_RUNNING_LOG.txt",
"command_used": "/Users/cole/code/edilytics/CRISPResso2_tests/.nox/conda_env-python-3-13-numpy-2-1-1/bin/CRISPRessoBatch -bs inputs/FANC.batch -a CGGATGTTCCAATCAGTACGCAGAGAGTCGCCGTCTCCAAGGTGAAAGCGGAAGTAGGGCCTTCGCGCACCTCATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAGCTTCTGGCGGTCTCAAGCACTACCTACGTCAGCACCTGGGACCCCGCCACCGTGCGCCGGGCCTTGCAGTGGGCGCGCTACCTGCGCCACATCCATCGGCGCTTTGGTCGG -g GGAATCCCTTCTGCAGCACC --base_editor -n batch --place_report_in_output_folder --halt_on_plot_fail --debug",
"report_location": "/Users/cole/code/edilytics/CRISPResso2_tests/cli_integration_tests/CRISPRessoBatch_on_batch/CRISPResso2Batch_report.html",
"report_filename": "CRISPResso2Batch_report.html",
"start_time": {
"_type": "datetime.datetime",
"value": "2024-10-18 14:31:51.473299"
},
"start_time_string": "2024-10-18 14:31:51",
"end_time": {
"_type": "datetime.datetime",
"value": "2024-10-18 14:32:21.058728"
},
"end_time_string": "2024-10-18 14:32:21",
"running_time": {
"_type": "datetime.timedelta",
"value": {
"days": 0,
"seconds": 29,
"microseconds": 585429
}
},
"running_time_string": "0:00:29.585429"
},
"results": {
"alignment_stats": {},
"general_plots": {
"summary_plot_titles": {
"Nucleotide_percentage_quilt_around_sgRNA_GGAATCCCTTCTGCAGCACC": "sgRNA: GGAATCCCTTCTGCAGCACC Amplicon: Reference",
"Nucleotide_conversion_map_around_sgRNA_GGAATCCCTTCTGCAGCACC": "",
"Nucleotide_percentage_quilt": "",
"Nucleotide_conversion_map": ""
},
"summary_plot_labels": {
"Nucleotide_percentage_quilt_around_sgRNA_GGAATCCCTTCTGCAGCACC": "Composition of each base around the guide GGAATCCCTTCTGCAGCACC for the amplicon Reference",
"Nucleotide_conversion_map_around_sgRNA_GGAATCCCTTCTGCAGCACC": "C->T conversion rates around the guide GGAATCCCTTCTGCAGCACC for the amplicon Reference",
"Nucleotide_percentage_quilt": "Composition of each base for the amplicon Reference",
"Nucleotide_conversion_map": "C->T conversion rates for the amplicon Reference"
},
"summary_plot_datas": {
"Nucleotide_percentage_quilt_around_sgRNA_GGAATCCCTTCTGCAGCACC": [
[
"Nucleotide frequencies",
"Nucleotide_frequency_summary.txt"
],
[
"Modification frequencies",
"MODIFICATION_FREQUENCY_SUMMARY.txt"
]
],
"Nucleotide_conversion_map_around_sgRNA_GGAATCCCTTCTGCAGCACC": [
[
"Nucleotide frequencies around sgRNA",
"Nucleotide_frequency_summary_around_sgRNA_GGAATCCCTTCTGCAGCACC.txt"
],
[
"Nucleotide percentages around sgRNA",
"Nucleotide_percentage_summary_around_sgRNA_GGAATCCCTTCTGCAGCACC.txt"
]
],
"Nucleotide_percentage_quilt": [
[
"Nucleotide frequencies",
"Nucleotide_frequency_summary.txt"
],
[
"Modification frequencies",
"MODIFICATION_FREQUENCY_SUMMARY.txt"
]
],
"Nucleotide_conversion_map": [
[
"Nucleotide frequencies",
"Nucleotide_frequency_summary.txt"
],
[
"Modification frequencies",
"MODIFICATION_FREQUENCY_SUMMARY.txt"
]
]
},
"allele_modification_heatmap_plot_names": [],
"allele_modification_heatmap_plot_paths": {},
"allele_modification_heatmap_plot_titles": {},
"allele_modification_heatmap_plot_labels": {},
"allele_modification_heatmap_plot_datas": {},
"allele_modification_heatmap_plot_divs": {},
"allele_modification_line_plot_names": [],
"allele_modification_line_plot_paths": {},
"allele_modification_line_plot_titles": {},
"allele_modification_line_plot_labels": {},
"allele_modification_line_plot_datas": {},
"allele_modification_line_plot_divs": {},
"window_nuc_pct_quilt_plot_names": [
"Nucleotide_percentage_quilt_around_sgRNA_GGAATCCCTTCTGCAGCACC"
],
"nuc_pct_quilt_plot_names": [
"Nucleotide_percentage_quilt"
],
"window_nuc_conv_plot_names": [
"Nucleotide_conversion_map_around_sgRNA_GGAATCCCTTCTGCAGCACC"
],
"nuc_conv_plot_names": [
"Nucleotide_conversion_map"
]
},
"batch_names_arr": [
"Untreated",
"Cas9"
],
"batch_input_names": {
"Untreated": "Untreated",
"Cas9": "Cas9"
},
"failed_batch_arr": [],
"failed_batch_arr_desc": [],
"completed_batch_arr": [
"Untreated",
"Cas9"
],
"nucleotide_frequency_summary_filename": "Nucleotide_frequency_summary.txt",
"nucleotide_percentage_summary_filename": "Nucleotide_percentage_summary.txt",
"modification_frequency_summary_filename": "MODIFICATION_FREQUENCY_SUMMARY.txt",
"modification_percentage_summary_filename": "MODIFICATION_PERCENTAGE_SUMMARY.txt"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
<div class="row pb-2">
<div class="col-sm-1"></div>

<div class="col-sm-3 crispresso_cup"> <a href='https://crispresso2.pinellolab.org'><img class='img-fluid' src="http://crispresso.pinellolab.org/static/imgs/CRISPResso_justcup.png" width="80%"></a>
<div class="col-sm-3 crispresso_cup"> <a href='https://crispresso2.pinellolab.org'><img class='img-fluid' src="https://crispresso.pinellolab.partners.org/static/imgs/CRISPResso_justcup.png" width="80%"></a>

</div>
<div class="col-sm-7" >
Expand Down Expand Up @@ -159,7 +159,7 @@ <h3 style="margin-top: -0.5em;padding-right: 2em;">Analysis of genome editing ou

<div class='card text-center mb-2'>
<div class='card-header'>
<h5 id="CRISPResso2_Batch_Output">CRISPResso Batch Output</h5>
<h5 id="CRISPResso2_Batch_Output">CRISPResso Batch Output<br/>batch</h5>
</div>
<div class='card-body p-0'>
<div class="list-group list-group-flush" style="max-height: 25vh; overflow-y: scroll;">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Command used]:
/Users/cole/code/edilytics/CRISPResso2_tests/.nox/conda_env-python-3-13-numpy-2-1-1/bin/CRISPRessoBatch -bs inputs/FANC.batch -a CGGATGTTCCAATCAGTACGCAGAGAGTCGCCGTCTCCAAGGTGAAAGCGGAAGTAGGGCCTTCGCGCACCTCATGGAATCCCTTCTGCAGCACCTGGATCGCTTTTCCGAGCTTCTGGCGGTCTCAAGCACTACCTACGTCAGCACCTGGGACCCCGCCACCGTGCGCCGGGCCTTGCAGTGGGCGCGCTACCTGCGCCACATCCATCGGCGCTTTGGTCGG -g GGAATCCCTTCTGCAGCACC --base_editor -n batch --place_report_in_output_folder --halt_on_plot_fail --debug

[Execution log]:
Running CRISPResso with 1 processes
Completed 1/2 runs
Completed 2/2 runs
Finished all batches
Reporting summary for amplicon: "Reference"
All guides are equal. Performing comparison of batches for amplicon 'Reference'
Plotting nucleotide percentage quilt for amplicon Reference, sgRNA GGAATCCCTTCTGCAGCACC
Plotting nucleotide conversion map for amplicon Reference, sgRNA GGAATCCCTTCTGCAGCACC
Plotting nucleotide quilt for Reference
Plotting nucleotide conversion map for Reference
Analysis Complete!
Loading