Skip to content

Commit

Permalink
Squashed 'CRISPResso2/CRISPRessoReports/' changes from 7d9b4e5..e18807d
Browse files Browse the repository at this point in the history
e18807d Merge remote-tracking branch 'origin/githubActions' into fig_name_fix
c3ac8f4 Merge remote-tracking branch 'origin/Reports_refactor' into fig_name_fix
c0fdbfa Update README.md
efc3b73 Fix 10f and 10g not showing up error
f793516 Use --fail-under
68668c3 Print score alone
8a7f387 Print score
83cce0b Add print statement
145b47e Alternate fix for comparison
c07c509 Fix comparison statement
317852b Print report score
f9b4cb1 Lower bound
ab25d2e Prevent pylint from failing
b77b6df Fail if pylint score is below 9
276f3fa Pylint fixes: unused variables
ed5be7a Dangerous defaults fix
63d7333 Pylint fixes
f7a1596 Loosen restrictions on local variables and arguments
27baaa3 Fix tab issue
87aa300 Change failure to warning
78ae177 Add custom configurations
67f4a3e path fix
e6cc4a2 print working directory
38a8155 Another path fix
7c677c4 Fix pylintrc path
e424e7f Update to use .pylintrc
6275e3a Create .pylintrc
3c2ee52 Update to only use python 3.10
1f290fc Create pylint.yml
f3c325f Merge pull request #6 from edilytics/print_styles
8e3dbf5 Remove borders when printing
f215d74 Fix div issue, breakinpage at all points
dcef278 Debugging for error
8cbafda Spacing fix for empty page problem
e1652ab Restore block statement
4fe3bc3 Remove some page breaks
a8fa963 Increase the size of the center column when printing
f462bfd Working in docker
c38a1b4 Switch reports branch
418d811 Fix command used and parameters elements. Increase print width and height to 100%
40330d5 Adding styling for print-only and screen only
57d910f Load favicon from web server
598d03d Indentation and parenthesis
21f63d0 Replace tabs with spaces and reindent template files
a3bcfeb Fix hamburger menu and add -bs- to data-target and data-toggle
bd0c0f1 Resize images and fix filepath
02f94fd Add spacing around body and footer tags
e514cdc Final style fixes, color circles for style files
a6700c0 Merge commit '90392b44c4bf86da0940887f85401072f4190428' as 'CRISPRessoWEB/CRISPRessoReports'
1343942 Removing CRISPRessoReport files
17d9ead Radio buttons, center buttons and inputs (login, register, new password), new div name for style dropdown fixes
9ebd458 Squashed 'CRISPRessoWEB/CRISPRessoReports/' content from commit 7d9b4e5
04558fb Remove extra files
8e3a590 Spacing changes, submission_compared fix, and submission_wgs file upload fix
980fdc4 Styling and bootstrap changes
9d40474 Centering issue and submit button fix
4cbbda7 Subtree working
35741c3 Jinja choice loader
e30fc40 Path correction
89864b1 Bootstrap 5 and partials changes
6740185 Layout.html for C2WEB and CLI
61f5287 Fix error when rendering multi reports
240e910 summaries partials and html updates
bc7535f fig_reports and replacement
dd02b44 Added a few changes from the selenium-tests branch on C2Web
c1e572a Update indentation in report.html and extract log params into partial
c7a6974 Update path to template directory to include `CRISPRessoReports`
90108fa Use the `render_template` function for each report
125e989 Add function to render template partials without using Flask
56b1d26 Web updates refactoring done
40ac3cb Adding files
ef333f0 Removing reports found in subtree
1bae0df Commit before adding subtree
1fbb427 Add server file to render js
d1d6fdf Move styling to main.css file
1241569 Jinja partials for all submissions
0534637 New submission.js template file
c5406d1 Changes to submission.js for bootstrap 5 and load file upload partial
ecd03f6 Working file upload in partial.
ce5d20f Working, missing custom label
6ba73e7 Bootstrap 5 changes
e05d146 Layout and report update
517e9f8 Replace sub, ins, del with Substitution, Insertion, Deletion
ea44128 Move where the style files are stored in Docker
7f03e98 Implement creating styles from the admin panel
9b27a2e Rename style_file references to style
a233d10 Add some default styles and rename the default to "Original"
43a8d29 Remove style file card from admin index page
1a8f332 Refactor saving style files when there is no name specified
64a7b1c Implement color pickers in style admin view
17c93c1 Succesfully implemented selecting default style
fd79cdd Restyle the colors in the admin view
3cd94b8 Fix error when the default style can't be read from the database
5e626bd Refactor `style_handler` to read the style from the database
0f66d4a Refactor styles to be part of the database instead of files
6c7d3c8 Move style folder inside of server folder
9f71f21 Add margins around style file elements
2a28549 Restyle the color pickers
2c82c08 DEFAULTUSER can't see style_dropdown and variable for ALLOW_USER_STYLE_UPLOAD for users to upload style files
dc4f2c7 Style dropdown - allow save json only for admin
15e7483 Style file check
7bd0e91 Remove style from Compare
0ab45f5 Colors function refactored and working for all types
2e24f8b Adding styling
d6621f1 Debuging
ed00c82 Merge with master
5150f9b Adding style_files to partial
957a9ca Add style files to pooled and wgs
66dc2d3 Changes to pooled and wgs, reset Dockerfile
fa6b1cf Updated Docker file and style_files.html
ee0fcfc Optional save file
229e21d Checkbox for custom colors that shows and hides color selectors, box on home page for style folder
0f26e2c Working style FileAdmin, access button, and further partial refactoring
b3b70bd Rough framework for style admin page
e4731d7 Style menu completed
1bb37bc New style menu with tabs
58f7e56 Tabs for different style options
3de893d Compare (#34)
e66bef1 Update AWS EB instructions.docx
658a218 Fix bug when trying to send recovery password with bad email creds
ee32e36 Adding color-picker partial to wgs and pooled
34ea688 Fix for responsiveness on cup and title
f0c4d07 Adding color routes to other versions
110fe14 Color picker input added to cmd_to_run
e732478 Names for color fields
2934631 Jinja partial for color picker and pip install in dockerfile
48bbf9c Cup animation (#33)
2905248 Selenium tests (#31)
5641fd3 Merge pull request #32 from edilytics/multi-amplicon-guides
570e42a Don't remove commas from amplicons or guides
0d70425 Add smallGenome.fa
fc33197 Writing text for pooled
dccfcb3 Files for testing
4cea67c Changes for WGS selenium tests. All tests functional.
ff05713 Changes for WGS selenium test file loading
495a98d Changes for pooled testing
0ad86a5 Merge pull request pinellolab#30 from edilytics/pooled-upload-fix
127eb8f PopulatePooled error
30ff7a7 Merge remote-tracking branch 'origin/pooled-upload-fix' into selenium_tests
7847687 Add link to CRISPRessoWGS from profile page and change header
666f73b Remove example block from CRISPRessoWGS submission page
27fcc13 Fix bug where amplicon file isn't being uploaded properly in CRISPRessoPooled
8d979a4 Fix bug where files_to_delete was being replaced and standardize append
09e55fc Changes to make interleaved and pooled tests possible
f89eca8 Changes necessary for selenium tests
3efe4f9 Clean up test files
a696363 Merge pull request #28 from edilytics/s3
dcef708 Remove changes for CRISPRessoCompare
e0c79cf Add demo config file for eb
03aba8e Update AWS EB instructions.docx
a671c4e Set version to 2.6.3
3bb3a8d Pull out s3 javascript for use in crispresso and crispressopooled
da5b15b Timezone for history is displayed in user local timezone
e11691f Update history to show time of previous run
be675fb Update pooled with s3
4c7d429 Add data links to pooled report
353e88f Update admin portal landing page
712e828 Show run type in history
2802252 s3 and user updates
efc3ed8 S3 error catching
af68341 New S3 Validation
f7d64e0 AWS validation before submission
8446093 Update s3 for batch and paired modes
0e7d327 S3_Upload function imrpvoed -JF
b48e0dc Merge branch 's3' of https://github.com/edilytics/C2Web into s3
c991d52 added s3 user database model
ab4aa54 add model for s3 bucket
853cda9 S3_Functionality improved -JF
2f060a6 Implemented front-end s3 browsing
e082a5f stub out viewing method
c5b6d13 Merge pull request #7 from edilytics/check-amplicon-length
c85a93f Merge pull request #15 from edilytics/wgs-interface
712270a Add support for CRISPRessoWGS
deaacee Extract out function to get server files in submit_routes
151eb15 Update crispresso2_info object fields
b2a974d Bump CRISPResso verion to 2.2.4
58ae313 Merge pull request #10 from edilytics/update-to-crispresso-2.2.2
7f2dc1c Stop trimming json error messages, fix #11
d28c03b Update reporting logic to use the new CRISPResso2_info schema
03ee46f Bump CRISPResso version in Dockerfile and download release from Github
9151c5d Add CRISPRessoPooled report template
25a6e37 Merge pull request #6 from edilytics/pooled-interface
b47d288 Check length of amplicons for hosted version, closes #4
54c28b6 Update submission file extension check
8fcadee Add a link to CRISPRessoPooled interface in user dashboard
7fd0283 Implement CRISPRessoPooled backend and report functionality
4063eb3 Modify submission.js to accept .txt and .tsv files
b770323 Create template file for CRISPRessoPooled submission interface
d4f2ed0 Merge pull request #5 from edilytics/flask-modularization
8527384 Convert some celery configurations settings to new format
962a209 Install less and vim in Dockerfile
c693668 Read CRISPResso2_info from json files instead of pickle files
a469e08 Move LoginManager to user_routes.py
f62e67a Create db tables in init_db.py
0d85c90 Move login_required to user_routes
6f5e33e Reformatting of remaining __init__.py
e615c0b Extract report routes out of __init__.py
20f2601 Extract user routes out from __init__.py
5582612 Extract status routes out from __init__.py
2406a10 Extract submit routes out from __init__.py
b562fcd Extract celery tasks from __init__.py
faa785d Extract views out from __init__.py
ff44576 Extract model classes out from __init__.py
914498f Merge pull request #3 from edilytics/2to3
86ea7da Replace RabbitMQ with Redis
adca9fb Upgrade celery to version 5.0.5
244ec33 Convert from Python 2 to Python 3
28b4f37 Refactor Docker image to use Python 3 via micromamba
2359800 Allow interleaved batches
428720b Add features: Allow admin init, server discovery depth
11df5d8 Client and server-side checks for invalid characters on sgRNA and amplicon
5062365 Update README.md
51e02f4 Update README.md
ac4a6d5 delete other images
4f3ad88 Update README.md
fc0de1d Update README.md
08defa1 Update README.md
9604983 Trycatch pickle loads
c1facd7 get rid of debug print of email
d699d4d crispresso2.0.45
e7ff079 Update param descriptions
1f12d59 2.0.44
b81febe crispresso to 2.0.42
1a967a8 update report
178c56d 2.4
e41076d Job expiration
41d1a4c check progress on setinterval
756e488 server-side files
ad19c3c Update to crispresso 2.0.40 prime editing
e3a194a update errors and ignore email config
2efb0bb Update README.md
58844a6 initial commit
8ff1878 Initial commit

git-subtree-dir: CRISPResso2/CRISPRessoReports
git-subtree-split: e18807d9d287f583d7176a668d12590f69cdf78a
  • Loading branch information
Snicker7 committed Jul 27, 2023
1 parent 7d9b4e5 commit 57a540d
Show file tree
Hide file tree
Showing 8 changed files with 440 additions and 308 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/.pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[FORMAT]
max-line-length=150
max-args=15
max-locals=40

[MESSAGES CONTROL]
disable = E0401, W0719
26 changes: 26 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Pylint

on:
push:
branches:
- '*'

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint --fail-under=9 $(git ls-files '*.py') --rcfile=/home/runner/work/CRISPRessoReports/CRISPRessoReports/.github/workflows/.pylintrc
103 changes: 57 additions & 46 deletions CRISPRessoReport.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,17 @@ def add_fig_if_exists(fig_name, fig_root, fig_title, fig_caption, fig_data,
if os.path.exists(os.path.join(crispresso_folder, data_file)):
amplicon_figures['datas'][fig_name].append((data_caption, data_file))
if os.path.exists(htmlfullpath):
with open(htmlfullpath) as html:
with open(htmlfullpath, encoding="utf-8") as html:
html_string = "<div align='center'>"
html_string += html.read()
html_string += "</div>"
amplicon_figures['htmls'][fig_name] = html_string


def assemble_figs(run_data, crispresso_folder):
"""
Helper function create the data structre for the figures
"""
figures = {'names': {}, 'locs': {}, 'titles': {}, 'captions': {}, 'datas': {}, 'htmls': {}, 'sgRNA_based_names': {}}

global_fig_names = []
Expand Down Expand Up @@ -138,7 +141,7 @@ def assemble_figs(run_data, crispresso_folder):
return data


def make_report(run_data, crispresso_report_file, crispresso_folder, _ROOT, web_version=False):
def make_report(run_data, crispresso_report_file, crispresso_folder, _ROOT):
# dicts for each amplicon fig_names[amp_name] = [list of fig names]
# fig_locs[amp_name][fig_name] = figure location
# print('crispresso_report file: ' + crispresso_report_file + ' crispresso_folder : ' + crispresso_folder + ' root: ' + _ROOT)
Expand Down Expand Up @@ -169,7 +172,7 @@ def make_report(run_data, crispresso_report_file, crispresso_folder, _ROOT, web_
# shutil.copy2(os.path.join(_ROOT,'templates','CRISPResso_justcup.png'),dest_dir)
# shutil.copy2(os.path.join(_ROOT,'templates','favicon.ico'),dest_dir)

with open(crispresso_report_file, 'w') as outfile:
with open(crispresso_report_file, 'w', encoding="utf-8") as outfile:
outfile.write(render_template(
'report.html', j2_env, report_data=report_data,
))
Expand Down Expand Up @@ -244,20 +247,20 @@ def make_batch_report_from_folder(crispressoBatch_report_file, crispresso2_info,

allele_modification_heatmap_plot['htmls'] = {}
for heatmap_plot_name, heatmap_plot_path in allele_modification_heatmap_plot['paths'].items():
with open(heatmap_plot_path) as fh:
with open(heatmap_plot_path, encoding="utf-8") as fh:
allele_modification_heatmap_plot['htmls'][heatmap_plot_name] = fh.read()

allele_modification_line_plot['htmls'] = {}
for line_plot_name, line_plot_path in allele_modification_line_plot['paths'].items():
with open(line_plot_path) as fh:
with open(line_plot_path, encoding="utf-8") as fh:
allele_modification_line_plot['htmls'][line_plot_name] = fh.read()

#find path between the report and the data (if the report is in another directory vs in the same directory as the data)
crispresso_data_path = os.path.relpath(batch_folder, os.path.dirname(crispressoBatch_report_file))
if crispresso_data_path == ".":
crispresso_data_path = ""
else:
crispresso_data_path += "/";
crispresso_data_path += "/"

sub_html_files = {}
run_names = []
Expand All @@ -267,7 +270,7 @@ def make_batch_report_from_folder(crispressoBatch_report_file, crispresso2_info,
crispresso_folder = os.path.join(batch_folder, sub_folder)
run_data = CRISPRessoShared.load_crispresso_info(crispresso_folder)
if 'running_info' not in run_data:
raise Exception('CRISPResso run %s has no report. Cannot add to batch report.' % sub_folder)
raise Exception(f'CRISPResso run {sub_folder} has no report. Cannot add to batch report.')

this_sub_html_file = sub_folder + ".html"
if run_data['running_info']['args'].place_report_in_output_folder:
Expand All @@ -278,7 +281,7 @@ def make_batch_report_from_folder(crispressoBatch_report_file, crispresso2_info,

output_title = 'CRISPResso Batch Output'
if crispresso2_info['running_info']['args'].name != '':
output_title += '<br/>{0}'.format(crispresso2_info['running_info']['args'].name)
output_title += f"<br/>{crispresso2_info['running_info']['args'].name}"

make_multi_report(
run_names,
Expand Down Expand Up @@ -307,15 +310,15 @@ def make_pooled_report_from_folder(crispresso_report_file, crispresso2_info, fol
names_arr = crispresso2_info['results']['good_region_names']
output_title = 'CRISPResso Pooled Output'
if crispresso2_info['running_info']['args'].name != '':
output_title += '<br/>{0}'.format(crispresso2_info['running_info']['args'].name)
output_title += f"<br/>{crispresso2_info['running_info']['args'].name}"
make_multi_report_from_folder(crispresso2_info, names_arr, output_title, crispresso_report_file, folder, _ROOT, 'pooled')


def make_compare_report_from_folder(crispresso_report_file, crispresso2_info, folder, _ROOT):
names_arr = []
output_title = 'CRISPResso Compare Output'
if crispresso2_info['running_info']['args'].name != '':
output_title += '<br/>{0}'.format(crispresso2_info['running_info']['args'].name)
output_title += "<br/>{crispresso2_info['running_info']['args'].name}"
make_multi_report_from_folder(crispresso2_info, names_arr, output_title, crispresso_report_file, folder, _ROOT, 'compare')


Expand All @@ -324,7 +327,7 @@ def make_meta_report_from_folder(crispresso_report_file, crispresso2_info, folde
input_names = crispresso2_info['meta_input_names']
output_title = 'CRISPresso Meta Output'
if crispresso2_info['running_info']['args'].name != '':
output_title += '<br/>{0}'.format(crispresso2_info['running_info']['args'].name)
output_title += "<br/>{crispresso2_info['running_info']['args'].name}"
make_multi_report_from_folder(crispresso2_info, names_arr, output_title, crispresso_report_file, folder, _ROOT, 'meta',
display_names=input_names)

Expand All @@ -333,7 +336,7 @@ def make_wgs_report_from_folder(crispresso_report_file, crispresso2_info, folder
names_arr = crispresso2_info['results']['good_region_names']
output_title = 'CRISPResso WGS Output'
if crispresso2_info['running_info']['args'].name != '':
output_title += '<br/>{0}'.format(crispresso2_info['running_info']['args'].name)
output_title += "<br/>{crispresso2_info['running_info']['args'].name}"
make_multi_report_from_folder(crispresso2_info, names_arr, output_title, crispresso_report_file, folder, _ROOT, 'wgs')


Expand All @@ -349,10 +352,11 @@ def make_multi_report_from_folder(crispresso2_info, names_arr, report_name, cris
crispresso_report_file (string): path to write report to
folder (string): folder containing crispresso runs
_ROOT (string): location of crispresso assets (images, templates, etc)
display_names (dict): report_name->display_name; Titles to be shown for crispresso runs (if different from names_arr, e.g. if display_names have spaces or bad chars, they won't be the same as names_arr)
display_names (dict): report_name->display_name; Titles to be shown for crispresso runs
(if different from names_arr, e.g. if display_names have spaces or bad chars, they won't be the same as names_arr)
Returns:
Nothin
Nothing
"""

summary_plot_names = []
Expand All @@ -378,11 +382,11 @@ def make_multi_report_from_folder(crispresso2_info, names_arr, report_name, cris
if display_names is not None:
display_name = display_names[name]

folder_name = 'CRISPResso_on_%s' % name
folder_name = f'CRISPResso_on_{name}'
sub_folder = os.path.join(folder, folder_name)
run_data = CRISPRessoShared.load_crispresso_info(sub_folder)
if 'running_info' not in run_data:
raise Exception('CRISPResso run %s has no report. Cannot add to report.' % sub_folder)
raise Exception(f'CRISPResso run {sub_folder} has no report. Cannot add to report.')

run_names.append(display_name)

Expand Down Expand Up @@ -428,19 +432,14 @@ def make_multi_report(
_ROOT,
report_name,
crispresso_tool,
window_nuc_pct_quilts=[],
nuc_pct_quilts=[],
window_nuc_conv_plots=[],
nuc_conv_plots=[],
summary_plots={
'names': [],
'titles': [],
'labels': [],
'datas': [],
},
compact_plots_to_show={},
allele_modification_heatmap_plot={},
allele_modification_line_plot={},
window_nuc_pct_quilts=None,
nuc_pct_quilts=None,
window_nuc_conv_plots=None,
nuc_conv_plots=None,
summary_plots=None,
compact_plots_to_show=None,
allele_modification_heatmap_plot=None,
allele_modification_line_plot=None,
):
"""
Makes an HTML report for a run containing multiple crispresso runs
Expand Down Expand Up @@ -494,6 +493,10 @@ def fill_default(dictionary, key, default_type=list):
else:
crispresso_data_path += "/"

if allele_modification_heatmap_plot is None:
allele_modification_heatmap_plot = {}
if allele_modification_line_plot is None:
allele_modification_line_plot = {}
dictionaries = [
allele_modification_heatmap_plot, allele_modification_line_plot,
]
Expand All @@ -511,18 +514,24 @@ def fill_default(dictionary, key, default_type=list):
key,
default_type,
)
web = False
if not web:
for html in sub_html_files:
sub_html_files[html] = crispresso_data_path + sub_html_files[html]
with open(crispresso_multi_report_file, 'w') as outfile:
if summary_plots is None:
summary_plots={
'names': [],
'titles': [],
'labels': [],
'datas': [],
}

for html in sub_html_files:
sub_html_files[html] = crispresso_data_path + sub_html_files[html]
with open(crispresso_multi_report_file, 'w', encoding="utf-8") as outfile:
outfile.write(render_template(
template,
j2_env,
window_nuc_pct_quilts=window_nuc_pct_quilts,
nuc_pct_quilts=nuc_pct_quilts,
window_nuc_conv_plots=window_nuc_conv_plots,
nuc_conv_plots=nuc_conv_plots,
window_nuc_pct_quilts=[] if window_nuc_pct_quilts is None else window_nuc_pct_quilts,
nuc_pct_quilts=[] if nuc_pct_quilts is None else nuc_pct_quilts,
window_nuc_conv_plots=[] if window_nuc_conv_plots is None else window_nuc_conv_plots,
nuc_conv_plots=[] if nuc_conv_plots is None else nuc_conv_plots,
crispresso_data_path=crispresso_data_path,
report_data={
'names': summary_plots['names'],
Expand All @@ -535,7 +544,7 @@ def fill_default(dictionary, key, default_type=list):
run_names=run_names,
sub_html_files=sub_html_files,
report_name=report_name,
compact_plots_to_show=compact_plots_to_show,
compact_plots_to_show=[] if compact_plots_to_show is None else compact_plots_to_show,
allele_modification_heatmap_plot_names=allele_modification_heatmap_plot['names'],
allele_modification_heatmap_plot_htmls=allele_modification_heatmap_plot['htmls'],
allele_modification_heatmap_plot_titles=allele_modification_heatmap_plot['titles'],
Expand All @@ -557,7 +566,7 @@ def make_aggregate_report(
_ROOT,
folder_arr,
crispresso_html_reports,
compact_plots_to_show={},
compact_plots_to_show=None,
display_names=None,
):
"""
Expand All @@ -572,10 +581,11 @@ def make_aggregate_report(
folder_arr (arr of strings): paths to the aggregated crispresso folders
crispresso_html_reports (dict): folder->html_path; Paths to the aggregated crispresso run html reports
compact_plots_to_show (dict): name=>{'href': path to target(report) when user clicks on image, 'img': path to png image to show}
display_names (dict): folder->display_name; Titles to be shown for crispresso runs (if different from names_arr, e.g. if display_names have spaces or bad chars, they won't be the same as names_arr)
display_names (dict): folder->display_name; Titles to be shown for crispresso runs
(if different from names_arr, e.g. if display_names have spaces or bad chars, they won't be the same as names_arr)
Returns:
Nothin
Nothing
"""
summary_plots = {}
if 'summary_plot_names' in crispresso2_info['results']['general_plots']:
Expand Down Expand Up @@ -649,15 +659,16 @@ def make_aggregate_report(
run_names = []
sub_html_files = {}

for idx, folder in enumerate(folder_arr):
for folder in folder_arr:
display_name = folder
if display_names is not None:
display_name = display_names[folder]

run_names.append(display_name)
sub_html_file = os.path.relpath(crispresso_html_reports[folder], crispresso_report_folder)
sub_html_files[display_name] = sub_html_file

if compact_plots_to_show is None:
compact_plots_to_show = {}
for compact_plot in compact_plots_to_show:
old_href = compact_plots_to_show[compact_plot]['href']
compact_plots_to_show[compact_plot]['href'] = os.path.relpath(old_href, crispresso_report_folder)
Expand All @@ -666,12 +677,12 @@ def make_aggregate_report(

allele_modification_heatmap_plot['htmls'] = {}
for heatmap_plot_name, heatmap_plot_path in allele_modification_heatmap_plot['paths'].items():
with open(heatmap_plot_path) as fh:
with open(heatmap_plot_path, encoding="utf-8") as fh:
allele_modification_heatmap_plot['htmls'][heatmap_plot_name] = fh.read()

allele_modification_line_plot['htmls'] = {}
for line_plot_name, line_plot_path in allele_modification_line_plot['paths'].items():
with open(line_plot_path) as fh:
with open(line_plot_path, encoding="utf-8") as fh:
allele_modification_line_plot['htmls'][line_plot_name] = fh.read()

make_multi_report(
Expand Down
49 changes: 49 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,50 @@
# CRISPRessoReports
Git Subtree Standard Operating Procedure (SOP)

Created: February 3, 2023

Introduction
In a few of our repositories we use git subtrees to share common files shared across multiple repositories. The goal of using subtrees is to reduce duplicated code.

Process
If you have a repository where you would like to add a subtree, run the following command from the parent repo (wherein you would like the external child repo to be stored).

git subtree add --prefix {path to where subtree will be stored} --squash {url of child repo} {branch of child repo}

Some notes about the above command:
- You can’t add a subtree to an empty repo.
- If you don’t specify the --squash parameter then all of the commits from the child repo will be brought into the parent repo history.
- When you do specify the --squash parameter then there will be two commits in the parent repo history.
- If you have the url of the child repo added as a remote, you can use that instead.
- You should now see the files in the child repo at the path you specified in the parent repo.

If you edit the files in the child repo (from within the parent repo), you can push the changes you have made up to the child repo with this command.

git subtree push --prefix {path to where subtree is stored} --rejoin {url of child repo} {branch of child repo}

Some notes about the above command:
- You should separate your commits such that there are not files staged in both child and parent.
- If there are commits in the child repo that you need in the parent repo, you can use this command.

git subtree pull --prefix {path to where subtree is stored} --squash {url of child repo} {branch of child repo}

Some notes about the above command:
- A merge conflict can happen here, so be warned!

If you are doing this regularly, the commands above can be cumbersome. You can create an alias in git to make these commands easier! Edit the .git/config file in your repo and add the following lines to it.

[alias]

The acronym stands for "CrispressoReports Add"

cra = "!f() { git subtree add --prefix CRISPRessoWEB/CRISPRessoReports https://github.com/edilytics/CRISPRessoReports.git $1 --squash; }; f"

The acronym stands for "CrispressoReports Update"

cru = "!f() { git subtree pull --prefix CRISPRessoWEB/CRISPRessoReports https://github.com/edilytics/CRISPRessoReports.git $1 --squash; }; f"

The acronym stands for "CrispressoReports Push"

crp = "!f() { git subtree push --prefix CRISPRessoWEB/CRISPRessoReports https://github.com/edilytics/CRISPRessoReports.git $1; }; f"


2 changes: 1 addition & 1 deletion templates/batchReport.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ <h5>{{report_data['titles'][plot_name]}}</h5>

{# data bit for web version: #}
{#
<p class="m-0"><small>Data: <a href="{{report_data['crispresso_data_path']}}{{data_path}}">{{data_label}}</a> <a href="{{report_data['crispresso_data_path']}}{{data_path}}" title="{{data_label}}" download> <span class="fas fa-download" data-toggle='tooltip' title='Download {{data_label}}'><span></a></small></p>
<p class="m-0"><small>Data: <a href="{{report_data['crispresso_data_path']}}{{data_path}}">{{data_label}}</a> <a href="{{report_data['crispresso_data_path']}}{{data_path}}" title="{{data_label}}" download> <span class="fas fa-download" data-bs-toggle='tooltip' title='Download {{data_label}}'><span></a></small></p>
#}
</div> {# jumbotron_content #} <!-- end jumbotron_content -->
</div> {# jumbrotron #} <!-- end jumbotron -->
Expand Down

0 comments on commit 57a540d

Please sign in to comment.