Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Commit

Permalink
- Fix: broken assertion (#110).
Browse files Browse the repository at this point in the history
- Fix: ome2histocat stripps .tiff file ending from masks (#111).
  • Loading branch information
plankter committed May 21, 2021
1 parent e546bd3 commit 4b58bf6
Show file tree
Hide file tree
Showing 10 changed files with 315 additions and 366 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
with:
docs-folder: docs/
build-command: make html
pre-build-command: python -m pip install --upgrade pip && pip install poetry==1.1.5 && poetry config virtualenvs.create false && poetry install
pre-build-command: python -m pip install --upgrade pip && pip install poetry==1.1.6 && poetry config virtualenvs.create false && poetry install
- name: Commit documentation changes
run: |
cp -r docs/build/html/* gh-pages/
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry==1.1.5
pip install poetry==1.1.6
poetry install
env:
POETRY_VIRTUALENVS_CREATE: false
Expand All @@ -55,7 +55,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry==1.1.5
pip install poetry==1.1.6
poetry install --no-dev
env:
POETRY_VIRTUALENVS_CREATE: false
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.1.7] - 2021-05-21
- Fix: broken assertion (#110).
- Fix: ome2histocat stripps .tiff file ending from masks (#111).

## [2.1.6] - 2021-03-16
- Allows `mcdfolder_to_imcfolder` to convert data from sub-folders in zip file.

Expand Down
2 changes: 1 addition & 1 deletion docs/source/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Version 1.x documentation (deprecated): https://imctools.readthedocs.io

Preferable way to install `imctools` is via official PyPI registry. Please define package version explicitly in order to avoid incompatibilities between v1.x and v2.x versions:
```
pip install imctools==2.1.4
pip install imctools==2.1.7
```
In old IMC segmentation pipelines versions 1.x should be used!
```
Expand Down
2 changes: 1 addition & 1 deletion imctools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

__author__ = """Vito Zanotelli, Anton Rau"""
__email__ = "[email protected], [email protected]"
__version__ = "2.1.6"
__version__ = "2.1.7"
4 changes: 2 additions & 2 deletions imctools/converters/mcdfolder2imcfolder.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ def mcdfolder_to_imcfolder(
tic = timeit.default_timer()

mcdfolder_to_imcfolder(
# Path("/home/anton/Downloads/20170905_Fluidigmworkshopfinal_SEAJa.zip"),
Path("/home/anton/Data/ImcSegmentationPipelineV2/20191202_HuBMAP_LympNode_ED.zip"),
# "/home/anton/Downloads/20170905_Fluidigmworkshopfinal_SEAJa",
# "/home/anton/Data/forAnton_MCD/6505_Lympho",
"/home/anton/Downloads/IMMUcan_Batch20201113_10042702-GU-VAR-TIS-01-IMC-01.zip",
# "/home/anton/Downloads/IMMUcan_Batch20201113_10042702-GU-VAR-TIS-01-IMC-01.zip",
# "/home/anton/Documents/merrick/IMC/20200904_MS_XRF_epithelial_panel_4_titration.zip",
# "/home/anton/Documents/IMC Workshop 2019/Data/iMC_workshop_2019/20190919_FluidigmBrCa_SE",
# "/home/anton/Downloads/test",
Expand Down
16 changes: 8 additions & 8 deletions imctools/converters/ome2analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ def get_metals_from_panel(

if panel_csv_file is not None:

pannel = pd.read_csv(panel_csv_file)
if pannel.shape[1] > 1:
selected = pannel[usedcolumn]
assert selected.any() == 0 or selected.any() == 1, f"Values in 'usedcolumn' column should contain only 0/1"
metals = [str(n) for s, n in zip(selected, pannel[metalcolumn]) if s]
panel = pd.read_csv(panel_csv_file)
if panel.shape[1] > 1:
selected = panel[usedcolumn]
assert selected.isin((0, 1)).all(), f"Values in 'usedcolumn' column should contain only 0/1"
metals = panel.loc[selected == 1, metalcolumn].tolist()
else:
metals = [pannel.columns[0]] + pannel.iloc[:, 0].tolist()
metals = [panel.columns[0]] + panel.iloc[:, 0].tolist()

if sort_channels:
if metals is not None:
Expand Down Expand Up @@ -187,9 +187,9 @@ def omefolder_to_analysisfolder(
# )

omefolder_to_analysisfolder(
"/home/anton/Downloads/imc_folder",
"/home/anton/Downloads/imc_folder_v2",
"/home/anton/Downloads/analysis_folder",
"/home/anton/Downloads/example_panel.csv",
"/home/anton/Data/ImcSegmentationPipelineV2/hubmap_processed_v2/panel.csv",
[("ilastik", "_ilastik", True), ("full", "_full", False)],
metalcolumn="Metal Tag",
)
Expand Down
7 changes: 3 additions & 4 deletions imctools/converters/ome2histocat.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ def omefile_to_histocatfolder(
if mask_file is not None:
if isinstance(mask_file, str):
mask_file = Path(mask_file)
fn_mask_base = mask_file.stem
fn_mask_new = output_folder / fn_mask_base
shutil.copy2(mask_file, fn_mask_new)
shutil.copy2(mask_file, output_folder)


def omefolder_to_histocatfolder(
Expand Down Expand Up @@ -127,8 +125,9 @@ def omefolder_to_histocatfolder(
tic = timeit.default_timer()

omefolder_to_histocatfolder(
Path("/home/anton/Downloads/imc_folder/20170905_Fluidigmworkshopfinal_SEAJa"),
Path("/home/anton/Downloads/imc_folder_v2/20191203_HuBMAP_LN"),
Path("/home/anton/Downloads/tiff_folder"),
mask_folder="/home/anton/Data/ImcSegmentationPipelineV2/hubmap_processed_v2/masks",
)

print(timeit.default_timer() - tic)
Loading

0 comments on commit 4b58bf6

Please sign in to comment.