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

Feat/rt cetsa #541

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
18597dc
feat: added plate extraction tool
nishaq503 May 8, 2024
b058e2a
feat: added intensity extraction tool
nishaq503 May 8, 2024
df1b7d8
fix: plate extraction tool
agerardin May 10, 2024
f4dc409
fix: rt_cetsa intensity extraction tool.
agerardin May 10, 2024
2ee3cf5
fix: rt_cetsa intensity extraction
agerardin May 13, 2024
7657bde
fix: rt_cetsa segmentation.
agerardin May 13, 2024
f11ce9d
fix: intensity extraction. Filepattern provides lexicographic ordering.
agerardin May 13, 2024
fb6ecad
feat: containerized and make intensity extraction runnable in a cwl w…
agerardin May 14, 2024
052d189
feat: save plate params when extracting plates.
agerardin May 19, 2024
2550cdf
dev: faster intensity extraction.
agerardin May 19, 2024
ad82637
fix: cropped plate params.
agerardin May 19, 2024
618cd30
fix: intensity extraction: fast implementation based on plate params.
agerardin May 19, 2024
a6a9b28
fix: intensity extraction. Now extract a larger area to get close to …
agerardin May 20, 2024
7140088
dev: cleanup how segmentation mask is generated.
agerardin May 20, 2024
9fcde28
dev: replace tifffile by bfio. Stored roi_radius in plate_params.
agerardin May 21, 2024
d813629
dev: improve cli. Sorting now available from package methods.
agerardin May 21, 2024
cdd1662
feat: updated intensity extraction tool.
agerardin May 21, 2024
2d2b4c1
Bump version: 0.1.0 → 0.2.0-dev0
agerardin May 21, 2024
d6c8c37
feat: update extraction tool.
agerardin May 21, 2024
f3849c3
Bump version: 0.1.0 → 0.2.0-dev0
agerardin May 21, 2024
3345e3d
fix: return extract signal df. optional temp in cwl
agerardin May 21, 2024
c884aec
fix: package dependencies.
agerardin May 21, 2024
ece52fc
chore: cleanup before PR.
agerardin May 21, 2024
82362f5
fix dependency on plate extraction to fix docker build.
agerardin May 22, 2024
bf32f5c
chore: add dummy tests to pacify git actions.
agerardin May 22, 2024
9ba335b
fix: remove bfio and use tifffile for docker integration.
agerardin May 22, 2024
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
33 changes: 33 additions & 0 deletions features/rt-cetsa-intensity-extraction-tool/.bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[bumpversion]
current_version = 0.2.0-dev0
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<dev>\d+))?
serialize =
{major}.{minor}.{patch}-{release}{dev}
{major}.{minor}.{patch}

[bumpversion:part:release]
optional_value = _
first_value = dev
values =
dev
_

[bumpversion:part:dev]

[bumpversion:file:pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"

[bumpversion:file:plugin.json]

[bumpversion:file:VERSION]

[bumpversion:file:README.md]

[bumpversion:file:src/polus/images/features/rt_cetsa_intensity_extraction/__init__.py]

[bumpversion:file:ict.yml]

[bumpversion:file:rt_cetsa_intensity_extraction.cwl]
23 changes: 23 additions & 0 deletions features/rt-cetsa-intensity-extraction-tool/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM polusai/bfio:2.1.9

# environment variables defined in polusai/bfio
ENV EXEC_DIR="/opt/executables"
ENV POLUS_IMG_EXT=".ome.tif"
ENV POLUS_TAB_EXT=".csv"
ENV POLUS_LOG="INFO"

# Work directory defined in the base container
WORKDIR ${EXEC_DIR}

COPY pyproject.toml ${EXEC_DIR}
COPY VERSION ${EXEC_DIR}
COPY README.md ${EXEC_DIR}
COPY src ${EXEC_DIR}/src

RUN apt-get -y update
RUN apt-get -y install git

RUN pip3 install ${EXEC_DIR} --no-cache-dir

ENTRYPOINT ["python3", "-m", "polus.images.features.rt_cetsa_intensity_extraction"]
CMD ["--help"]
25 changes: 25 additions & 0 deletions features/rt-cetsa-intensity-extraction-tool/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# RT_CETSA Intensity Extraction Tool (v0.2.0-dev0)

This tool runs well intensities extraction for the RT-CETSA pipeline.

## Building

To build the Docker image for the conversion plugin, run
`./build-docker.sh`.

## Install WIPP Plugin

If WIPP is running, navigate to the plugins page and add a new plugin. Paste the contents of `plugin.json` into the pop-up window and submit.

## Options

This plugin takes eight input argument and one output argument:

| Name | Description | I/O | Type |
|-----------------|----------------------------------------------------|--------|-------------|
| `--inpDir` | Input data collection to be processed by this tool | Input | genericData |
| `--filePattern` | Pattern to parse input files | Input | string |
| `--outDir` | Output file | Output | genericData |
| `--preview` | Generate JSON file with outputs | Output | JSON | Optional
| `--params` | Plate params to use | Output | JSON | Optional
| `--temp` | Temperature range. Default to [37,90] | Output | JSON | Optional
Comment on lines +23 to +25
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These three lines need an additional column in the table.

1 change: 1 addition & 0 deletions features/rt-cetsa-intensity-extraction-tool/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.2.0-dev0
4 changes: 4 additions & 0 deletions features/rt-cetsa-intensity-extraction-tool/build-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

version=$(<VERSION)
docker build . -t polusai/rt-cetsa-intensity-extraction-tool:"${version}"
72 changes: 72 additions & 0 deletions features/rt-cetsa-intensity-extraction-tool/ict.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
author:
- Nick Schaub
- Antoine Gerardin
- Najib Ishaq
contact: [email protected]
container: polusai/rt-cetsa-intensity-extraction-tool:0.2.0-dev0
description: Extract well intensities from RT-CETSA plate images and masks.
entrypoint: python3 -m polus.images.features.rt_cetsa_intensity_extraction
inputs:
- description: Input data collection to be processed by this tool
format:
- inpDir
name: inpDir
required: true
type: path
- description: filename of the plate params
format:
- params
name: params
required: false
type: string
- description: temp interval on which to collect intensities
format:
- temp
name: temp
required: false
type: array[int]
- description: Filepattern to parse input files
format:
- filePattern
name: filePattern
required: false
type: string
- description: Generate an output preview.
format:
- preview
name: preview
required: false
type: boolean
name: polusai/RTCETSAIntensityExtraction
outputs:
- description: Output data
format:
- outDir
name: outDir
required: true
type: path
repository: https://github.com/PolusAI/image-tools
specVersion: 1.0.0
title: RT-CETSA Intensity Extraction
ui:
- description: Input data collection
key: inputs.inpDir
title: Input data collection
type: path
- description: Filepattern to parse input files
key: inputs.pattern
title: pattern
type: text
- description: Plate params to use
key: inputs.params
title: Plate Params
type: text
- description: Temperature interval
key: inputs.temp
title: Temperature interval
type: text
- description: Generate an output preview.
key: inputs.preview
title: Preview example output of this plugin
type: checkbox
version: 0.2.0-dev0
85 changes: 85 additions & 0 deletions features/rt-cetsa-intensity-extraction-tool/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"name": "RT-CETSA Intensity Extraction",
"version": "0.2.0-dev0",
"title": "RT-CETSA Intensity Extraction",
"description": "Extract well intensities from RT-CETSA images and masks.",
"author": "Nicholas Schaub ([email protected]), Antoine Gerardin ([email protected]), Najib Ishaq ([email protected])",
"institution": "National Center for Advancing Translational Sciences, National Institutes of Health",
"repository": "https://github.com/PolusAI/image-tools",
"website": "https://ncats.nih.gov/preclinical/core/informatics",
"citation": "",
"containerId": "polusai/rt-cetsa-intensity-extraction-tool:0.2.0-dev0",
"baseCommand": [
"python3",
"-m",
"polus.images.features.rt_cetsa_intensity_extraction"
],
"inputs": [
{
"name": "inpDir",
"type": "genericData",
"description": "RT_Cetsa image collection to be processed by this tool.",
"required": true
},
{
"name": "filePattern",
"type": "string",
"description": "filePattern to parse input files.",
"default": ".+",
"required": false
},
{
"name": "preview",
"type": "boolean",
"description": "Generate preview of outputs.",
"required": false
},
{
"name": "params",
"type": "boolean",
"description": "Plate params to use.",
"required": false
},
{
"name": "temp",
"type": "boolean",
"description": "Temperature range. Default to [37,90].",
"required": false
}
Comment on lines +37 to +48
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The types for these are listed as JSON in the README, string in the ICT and boolean here. What is the actual type?

],
"outputs": [
{
"name": "outDir",
"type": "genericData",
"description": "Output data collection."
}
],
"ui": [
{
"key": "inputs.inpDir",
"title": "Input collection",
"description": "Input data collection to be processed by this plugin."
},
{
"key": "inputs.mask",
"title": "Mask",
"description": "Mask to process plate image."
},
{
"key": "inputs.filePattern",
"title": "FilePattern",
"description": "File Pattern to parse input files.",
"default": ".+"
},
{
"name": "inputs.params",
"title": "Params",
"description": "Plate params to use."
},
{
"name": "inputs.temp",
"title": "Temp",
"description": "Temperature range. Default to [37,90]."
}
]
}
85 changes: 85 additions & 0 deletions features/rt-cetsa-intensity-extraction-tool/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
[tool.poetry]
name = "polus_images_features_rt_cetsa_intensity_extraction"
version = "0.2.0-dev0"
description = "Extract well intensities from RT-CETSA plate images."
authors = [
"Nick Schaub <[email protected]>",
"Antoine Gerardin <[email protected]>",
"Najib Ishaq <[email protected]>",
]
readme = "README.md"
packages = [{include = "polus", from = "src"}]

[tool.poetry.dependencies]
python = ">=3.9,<3.12"
typer = "^0.7.0"
filepattern = "^2.0.5"
pandas = "^2.2.2"
numpy = "^1.26.4"
bfio = "^2.3.6"
scikit-image = "^0.22.0"
imagecodecs = "^2024.1.1"
polus-images-segmentation-rt-cetsa-plate-extraction = {git = "https://github.com/agerardin/image-tools.git", branch = "feat/rt_cetsa", subdirectory = "segmentation/rt-cetsa-plate-extraction-tool"}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This git link will need to be updated to either use the main repo from polusai and the master branch, or it should be changed to a local path dependency



[tool.poetry.group.dev.dependencies]
bump2version = "^1.0.1"
pre-commit = "^3.1.0"
pytest = "^7.2.1"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.ruff]
extend = "../../ruff.toml"
extend-ignore = [
"RET505", # Unnecessary `else` after `return` statement
"E501", # Line too long
"ANN001", # Missing type annotation
"D102", # Missing docstring in public method
"ANN201", # Missing return type annotation
"N806", # Variable in function should be lowercase
"D205", # 1 blank line required between summary line and description
"N803", # Argument name should be lowercase
"PLR0913", # Too many arguments
"D415", # First line should end with a period, question mark, or exclamation point
"PLR2004", # Magic value used in comparison
"B006", # Do not use mutable default arguments
"D107", # Missing docstring
"D101", # Missing docstring
"E731", # Do not assign a lambda expression, use a def
"E402", # Module level import not at top of file
"PTH123", # `open()` should be replaced with `Path.open()`
"PTH118", # `os.path.join()` should be replaced with `/` operator
"PTH100", # `os.path.abspath()` should be replaced with `Path.resolve()`
"PLR0915", # Too many statements
"PLR0912", # Too many branches
"C901", # Function is too complex
"T201", # `print` used
"E722", # Do not use bare 'except'
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
"ANN202", # Missing return type annotation for private function
"ARG002", # Unused method argument
"N802", # Function name should be lowercase
"PTH103", # `os.makedirs()` should be replaced with `Path.mkdir(parents=True)`
"ANN003", # Missing type annotation for `**kwargs`
"B007", # Loop control variable not used within the loop body
"ANN204", # Missing return type annotation for magic method
"D417", # Missing argument descriptions in the docstring
"ANN205", # Missing return type annotation for static method
"PLR5501", # Use `elif` instead of `else` following `if` condition to avoid unnecessary indentation
"EM102", # Exception must not use an f-string literal
"D414", # Section has no content
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"A001", # Variable `input` is shadowing a Python builtin
"A002", # Argument `input` is shadowing a Python builtin
"E741", # Ambiguous variable name: `l`
"PTH120", # `os.path.dirname()` should be replaced by `Path.parent`
"N816", # Variable `cfFilename` in global scope should not be mixedCase
"PTH109", # `os.getcwd()` should be replaced by `Path.cwd()`
"ARG001", # Unused function argument
"S101", # Use of assert detected
"D103", # Missing docstring in public function
"D100", # Missing docstring in public module
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
class: CommandLineTool
cwlVersion: v1.2
inputs:
inpDir:
inputBinding:
prefix: --inpDir
type: Directory
mask:
inputBinding:
prefix: --mask
type: string?
filePattern:
inputBinding:
prefix: --filePattern
type: string?
outDir:
inputBinding:
prefix: --outDir
type: Directory
params:
inputBinding:
prefix: --params
type: string?
temp:
type: int[]?
inputBinding:
prefix: -temp=
itemSeparator: " "
separate: false
preview:
inputBinding:
prefix: --preview
type: boolean?
outputs:
outDir:
outputBinding:
glob: $(inputs.outDir.basename)
type: Directory
requirements:
DockerRequirement:
dockerPull: polusai/rt-cetsa-intensity-extraction-tool:0.2.0-dev0
InitialWorkDirRequirement:
listing:
- entry: $(inputs.outDir)
writable: true
InlineJavascriptRequirement: {}
Loading
Loading