Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamaedler committed May 31, 2023
0 parents commit 2df5b09
Show file tree
Hide file tree
Showing 169 changed files with 25,131 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
assignees:
- "sophiamaedler"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
assignees:
- "sophiamaedler"
19 changes: 19 additions & 0 deletions .github/workflows/dependatbot-validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: dependabot validate

on:
pull_request:
paths:
- '.github/dependabot.yml'
- '.github/workflows/dependabot-validate.yml'
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: marocchino/validate-dependabot@v2
id: validate
- uses: marocchino/sticky-pull-request-comment@v2
if: always()
with:
header: validate-dependabot
message: ${{ steps.validate.outputs.markdown }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.ipynb_checkpoints
.DS_store
vipertools.egg-info
src/vipertools/__pycache__
src/vipertools.egg-info
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Sophia Mädler

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPARCStools

documentation can be found at: https://mannlabs.github.io/SPARCStools/html/index.html

## Installation

Clone the github repository and navigate to the main directory:

git clone https://github.com/MannLabs/SPARCStools.git
cd SPARCStools

Create a conda environment and activate it

conda create -n stitching python=3.10
conda activate stitching

Install Java using conda

conda install -c conda-forge openjdk

Install package via pip. This should install all dependencies as well.

pip install .
Empty file added docs/.nojekyll
Empty file.
Binary file added docs/doctrees/environment.pickle
Binary file not shown.
Binary file added docs/doctrees/index.doctree
Binary file not shown.

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/doctrees/pages/modules.doctree
Binary file not shown.
Binary file not shown.
Binary file added docs/doctrees/pages/tutorials.doctree
Binary file not shown.
4 changes: 4 additions & 0 deletions docs/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 58447cc7763988a8e2886fa512125b6f
tags: 645f666f9bcd5a90fca523b33c5a78b7
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/html/_images/stitched_channels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
70 changes: 70 additions & 0 deletions docs/html/_sources/index.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
.. sparcstools documentation master file

Welcome to SPARCStools documentation!
=======================================

This python module contains wrapper functions to perform stitching with the `Ashlar API <https://labsyspharm.github.io/ashlar/>`_. In addition it contains
data parsing functions to make imaging data aquired with the `Perkinelmer Opera Phenix Microscope <https://www.perkinelmer.com/uk/product/opera-phenix-plus-system-hh14001000>`_ accessible Ashlar
or also to other downstream applications.

The generated stitched images can then be used for downstream applications, for example the `SPARCSpy <link URL>`_ workflow or other analysis frameworks.

Installation
------------

SPARCStools has been tested using python >= 3.8 on Linux and MacOS. Currently to run on Windows please utilize a Linux Virtual Machine.

Clone the github repository and navigate to the main directory:

.. code::

git clone https://github.com/MannLabs/SPARCStools.git
cd SPARCStools

Create a conda environment and activate it

.. code::

conda create -n stitching python=3.10
conda activate stitching

Install Java using conda

.. code::

conda install -c conda-forge openjdk

Install package via pip. This should install all dependencies as well.

.. code::

pip install .

Citing our Work
----------------

This code was developed by Sophia Maedler and Niklas Schmacke in the labs of Matthias Mann and Veit Hornung.

If you use our work please cite the following manuscript:

INSERT CITATION HERE

.. toctree::
:maxdepth: 3
:caption: Modules:

pages/modules.rst

.. toctree::
:maxdepth: 3
:numbered:
:caption: Tutorials:

pages/tutorials

.. toctree::
:maxdepth: 3
:numbered:
:caption: Example Notebooks:

pages/notebooks/example_stitching_notebook
16 changes: 16 additions & 0 deletions docs/html/_sources/pages/modules.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*******************
Modules
*******************

.. automodule:: sparcstools.parse
:members:

.. automodule:: sparcstools.stitch
:members:

.. automodule:: sparcstools.image_processing
:members:

.. toctree::
:maxdepth: 5
:caption: Contents:

Large diffs are not rendered by default.

106 changes: 106 additions & 0 deletions docs/html/_sources/pages/tutorials.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
*******************
Tutorials
*******************

Parsing and Stitching Data from Opera Phenix
============================================

First you need to export your data from Harmony and rename the path to eliminate any spaces in the name.
Then you can run the following script to parses and stitch your data.

.. code-block:: python
:caption: example script for parsing and stitching phenix data

#import relevant libraries
import os
from sparcstools.parse import parse_phenix
from sparcstools.stitch import generate_stitched

#parse image data
path = "path to exported harmony project without any spaces"
parse_phenix(path, flatfield_exported = True, export_as_symlink = True) #export as symlink true enabled for better speed and to not duplicate data, set to False if you want to work with hardcopies or plan on accessing the data from multiple OS

#define important information for your slide that you want to stitch

# the code below needs to be run for each slide contained in the imaging experiment!
# Can be put into a loop for example to automate this or also can be subset to seperate
# jobs when running on a HPC

input_dir = os.path.join(path, "parsed_images")
slidename = "Slide1"
outdir = os.path.join(path, "stitched", slidename)
overlap = 0.1 #adjust in case your data was aquired with another overlap

#define parameters to find correct slide in experiment folder
row = 1
well = 1
zstack_value = 1
timepoint = str(1)

#define on which channel should be stitched
stitching_channel = "Alexa647"
output_filetype = [".tif", "ome.zarr"] #one of .tif, .ome.tif, .ome.zarr (can pass several if you want to generate all filetypes)

#adjust cropping parameter
crop = {'top':0, 'bottom':0, 'left':0, 'right':0} #this does no cropping
#crop = {'top':72, 'bottom':52, 'left':48, 'right':58} #this is good default values for an entire PPS slide with cell culture samples imaged with the SPARCSpy protocol

#create output directory if it does not exist
if not os.path.exists(outdir):
os.makedirs(outdir)

#define pattern to recognize which slide should be stitched
#remember to adjust the zstack value if you aquired zstacks and want to stitch a speciifc one in the parameters above

pattern = "Timepoint"+str(timepoint.zfill(3) +"_Row"+ str(row).zfill(2) + "_" + "Well" + str(well).zfill(2) + "_{channel}_"+"zstack"+str(zstack_value).zfill(3)+"_r{row:03}_c{col:03}.tif")
generate_stitched(input_dir,
slidename,
pattern,
outdir,
overlap,
crop = crop ,
stitching_channel = stitching_channel,
filetype = output_filetype)

Generated output
------------------

The stitching script will generate the following files:

.. code::

.
├── QC_edge_quality.pdf
├── QC_edge_scatter.pdf
├── stitching_test.XML
├── stitching_test_Alexa488.tif
├── stitching_test_DAPI.tif
├── stitching_test_mCherry.tif
└── stitching_test_tile_positions.tsv


.. list-table:: Generated Files
:widths: 25 70
:header-rows: 1

* - FileName
- Contents
* - `QC_edge_quality.pdf`
- This plot shows which tiles are connected with one another.
* - `QC_edge_scatter.pdf`
- Plots the alignment quality against each other
* - `stitching_test.XML`
- contains the required input for reading the stitched files into BIAS
* - `<slidename>_<channel_name>.tif`
- stitched image for the given channel
* - `stitching_test_tile_positions.tsv`
- coordinate position of where each tile is located


Example Results
---------------

.. image:: ../_static/stitched_channels.png
:width: 100 %


Loading

0 comments on commit 2df5b09

Please sign in to comment.