Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.14.10
rev: v0.14.14
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 25.12.0
rev: 26.1.0
hooks:
- id: black
types: [python]
Expand All @@ -59,12 +59,12 @@ repos:
- id: codespell

- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.7.4
rev: v3.8.1
hooks:
- id: prettier

- repo: https://github.com/kynan/nbstripout
rev: 0.8.2
rev: 0.9.0
hooks:
- id: nbstripout

Expand Down
36 changes: 12 additions & 24 deletions notebooks/contributing_to_topostats.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@

@app.cell
def _(mo):
mo.md(
r"""
mo.md(r"""
#Making use of TopoStats outputs
Running TopoStats from the command line produces a .topostats file for each processed image. This file contains all of the data used at different stages within the TopoStats pipeline including filtered images, grain masks, and traces. These files are a really useful resource for using TopoStats outputs to develop new functions for your own analyses. Here we show one example of using the .topostats file to create a height profile of a DNA minicircle, enabling us to measure the distance between helices.
"""
)
""")
return


Expand Down Expand Up @@ -45,11 +43,9 @@ def _():

@app.cell
def _(mo):
mo.md(
r"""
mo.md(r"""
First we read in the .topostats file and convert it to a usable dictionary format.
"""
)
""")
return


Expand All @@ -67,11 +63,9 @@ def _(Path, h5py, hdf5_to_dict):

@app.cell(hide_code=True)
def _(mo):
mo.md(
r"""
mo.md(r"""
Printing the `data_dict` allows us to see what is contained within our .topostats file, including all of the file's metadata and other data generated through TopoStats.
"""
)
""")
return


Expand All @@ -83,11 +77,9 @@ def _(data_dict, pprint):

@app.cell(hide_code=True)
def _(mo):
mo.md(
r"""
mo.md(r"""
Below is a helper function used to enable visualisation of plots within marimo. We can use it to plot our TopoStats processed image which is stored in `data_dict["image"]`. Note you could also view the raw image using `data_dict[image_original]`.
"""
)
""")
return


Expand Down Expand Up @@ -134,13 +126,11 @@ def show_image(

@app.cell
def _(mo):
mo.md(
r"""
mo.md(r"""
In the code below, we use the bounding box information for grain 0, stored in `data_dict["ordered_traces"]["above"]["grain_0"]["mol_0"]["bbox"]` to crop the image and centre the grain of interest.

We can then extract the height values, provided in `data_dict["ordered_traces"]["above"]["grain_0"]["mol_0"]["heights"]` as well as distances along the trace, provided in `data_dict["ordered_traces"]["above"]["grain_0"]["mol_0"]["distances"]`.
"""
)
""")
return


Expand All @@ -164,11 +154,9 @@ def _(data_dict, np, show_image):

@app.cell
def _(mo):
mo.md(
r"""
mo.md(r"""
We can use the height trace profiles to count the number of helices within our grain, and to measure the distance between helices. By using a threshold of 4nm, we see that DNA helices are shown as equidistant peaks within the height profile plot.
"""
)
""")
return


Expand Down
Loading
Loading