Skip to content

Commit

Permalink
Adding new/updated DL4MicEverywhere_frunet-tem-exosomes-sev-external_…
Browse files Browse the repository at this point in the history
…1.0.0
  • Loading branch information
IvanHCenalmor committed Dec 16, 2024
1 parent 6e8bf39 commit 115b8a8
Show file tree
Hide file tree
Showing 4 changed files with 185 additions and 0 deletions.
Binary file modified album_catalog_index.db
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog
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).

## [1.0.0] - 2024-12-16

Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
###album catalog: cellcanvas

# Based on https://github.com/HenriquesLab/DL4MicEverywhere/blob/main/notebooks/ZeroCostDL4Mic_notebooks/FRUNet-Exosomes/configuration.yaml
# and https://github.com/betaseg/solutions/blob/main/solutions/io.github.betaseg/cellsketch-plot/solution.py

from album.runner.api import setup
import subprocess

try:
subprocess.check_output('nvidia-smi')
gpu_access = True
except Exception:
gpu_access = False

def install():
from album.runner.api import get_app_path
from git import Repo
import subprocess
import requests
import shutil
import os

# Clone the DL4MicEverywhere repository
clone_url = "https://github.com/HenriquesLab/DL4MicEverywhere"
repository_path = get_app_path().joinpath("DL4MicEverywhere")
Repo.clone_from(clone_url, repository_path)
assert (repository_path.exists())

# URL of the notebook you want to download
notebook_url = "https://raw.githubusercontent.com/BSEL-UC3M/FRU-Net-TEM-segmentation/main/FRUnet_TEM_Exosomes_sEV.ipynb"

notebook_path = get_app_path().joinpath("FRUnet_TEM_Exosomes_sEV.ipynb")
notebook_path.parent.mkdir(parents=True, exist_ok=True)

response = requests.get(notebook_url)
response.raise_for_status()

with open(notebook_path, 'wb') as notebook_file:
notebook_file.write(response.content)

assert notebook_path.exists(), "Notebook download failed"

# Convert the notebook to its colabless form
section_to_remove = "None"
section_to_remove = section_to_remove.split(' ')

python_command = ["python", ".tools/notebook_autoconversion/transform.py", "-p", f"{get_app_path()}", "-n", "FRUnet_TEM_Exosomes_sEV.ipynb", "-s"]
python_command += section_to_remove

subprocess.run(python_command, cwd=repository_path)
subprocess.run(["mv", get_app_path().joinpath("colabless_FRUnet_TEM_Exosomes_sEV.ipynb"), get_app_path().joinpath("FRUnet_TEM_Exosomes_sEV.ipynb")])

# Remove the cloned DL4MicEverywhere repository
if os.name == 'nt':
os.system(f'rmdir /s /q "{to}"')
else:
# rmtree has no permission to do this on Windows
shutil.rmtree(repository_path)

def run():
from album.runner.api import get_args, get_app_path
import subprocess
import os

# Fetch arguments and paths
args = get_args()
app_path = get_app_path()

# Path to the downloaded notebook
notebook_path = app_path.joinpath("FRUnet_TEM_Exosomes_sEV.ipynb")

# Ensure the notebook exists
assert notebook_path.exists(), "Notebook does not exist"

# Output path for running the notebook
output_path = args.path
os.makedirs(output_path, exist_ok=True)
print(f"Saving output to {output_path}")

# Set the LD_LIBRARY_PATH to allow TensorFlow to find the CUDA libraries
global gpu_access
if gpu_access:
os.environ["LD_LIBRARY_PATH"] = f"{os.environ['LD_LIBRARY_PATH']}:{os.environ['CONDA_PREFIX']}/lib"

# Optionally, launch the Jupyter notebook to show the results
subprocess.run(["jupyter", "lab", str(notebook_path)], cwd=str(output_path))

if gpu_access:
channels = """
- conda-forge
- nvidia
- anaconda
- defaults
"""
dependencies = """
- python=3.6
- cudatoolkit=11.2.2
- cudnn=8.9.2
- pip
- pkg-config
"""
else:
channels = """
- conda-forge
- defaults
"""
dependencies = f"""
- python=3.6
- pip
- pkg-config
"""

env_file = f"""
channels:
{channels}
dependencies:
{dependencies}
- pip:
- GitPython==3.1.43
- tensorflow==1.12.0
- keras==1.2.2
- SimpleITK==1.1
- Pillow==4.3.0
- scikit-image==0.14.0
- scikit-learn==0.19.2
- scipy==1.1.0
- nbformat==5.0.2
- ipywidgets==8.0.0a0
- jupyterlab==2.3.2
"""

setup(
group="DL4MicEverywhere",
name="frunet-tem-exosomes-sev-external",
version="1.0.0",
solution_creators=["DL4MicEverywhere team", "album team"],
title="frunet-tem-exosomes-sev-external implementation.",
description="",
documentation="https://raw.githubusercontent.com/HenriquesLab/ZeroCostDL4Mic/master/BioimageModelZoo/README.md",
tags=['ARM64'],
args=[{
"name": "path",
"type": "string",
"default": ".",
"description": "What is your working path?"
}],
cite=[{'doi': 'https://doi.org/10.1038/s41598-019-49431-3', 'text': 'Gómez-de-Mariscal, E. et al., Deep-Learning-Based Segmentation of SmallExtracellular Vesicles in Transmission Electron Microscopy Images Scientific Reports, (2019)'}],
album_api_version="0.5.1",
covers=[],
run=run,
install=install,
dependencies={"environment_file": env_file},
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
album_api_version: 0.5.1
args:
- default: .
description: What is your working path?
name: path
type: string
changelog: null
cite:
- doi: https://doi.org/10.1038/s41598-019-49431-3
text: "G\xF3mez-de-Mariscal, E. et al., Deep-Learning-Based Segmentation of SmallExtracellular\
\ Vesicles in Transmission Electron Microscopy Images Scientific Reports, (2019)"
covers: []
description: ''
documentation: https://raw.githubusercontent.com/HenriquesLab/ZeroCostDL4Mic/master/BioimageModelZoo/README.md
group: DL4MicEverywhere
name: frunet-tem-exosomes-sev-external
solution_creators:
- DL4MicEverywhere team
- album team
tags:
- ARM64
timestamp: '2024-12-16T21:17:54.259920'
title: frunet-tem-exosomes-sev-external implementation.
version: 1.0.0

0 comments on commit 115b8a8

Please sign in to comment.