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

Add jupyter notebooks for code instruction #72

Merged
merged 19 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
136 changes: 136 additions & 0 deletions notebooks/MultipleDicotPipeline.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"from sleap_roots.series import find_all_series, Series\n",
"from sleap_roots.trait_pipelines import MultipleDicotPipeline, Pipeline\n",
"\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"import json\n",
"import os\n",
"\n",
"from typing import List\n",
"from pathlib import Path"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Current directory: C:\\repos\\sleap-roots\n"
]
}
],
"source": [
"# Get the current working directory\n",
"current_directory = os.getcwd()\n",
"\n",
"# Print the current working directory\n",
"print(\"Current directory:\", current_directory)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Updated current directory: C:\\repos\\sleap-roots\n"
]
}
],
"source": [
"# Use this cell when you want to change the current working directory\n",
"\n",
"# Define the directory you want to change to\n",
"new_directory = \"C:/repos/sleap-roots\"\n",
"\n",
"# Change the current working directory\n",
"os.chdir(new_directory)\n",
"\n",
"# Get the updated current working directory\n",
"updated_directory = os.getcwd()\n",
"\n",
"# Print the updated current working directory\n",
"print(\"Updated current directory:\", updated_directory)\n"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"# Change these variables for your own data\n",
"csv_path = \"tests/data/multiple_arabidopsis_11do/merged_proofread_samples_03122024.csv\" # For sample information (count, group)\n",
"folder_path = \"tests/data/multiple_arabidopsis_11do\" # Location of h5 files and predictions\n",
"primary_name = \"primary\" # For loading primary root predictions\n",
"lateral_name = \"lateral\" # For loading lateral root predictions"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Find all h5 files in the folder\n",
"all_h5s = find_all_series(folder_path)\n",
"all_h5s"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "sleap_roots",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ dynamic = ["version", "readme"]
version = {attr = "sleap_roots.__version__"}
readme = {file = ["README.md"], content-type="text/markdown"}

[tool.setuptools.packages.find]
include = ["sleap_roots"] # Include only the sleap_roots package
exclude = ["notebooks"] # Exclude the notebooks directory
namespaces = false

[project.optional-dependencies]
dev = [
"pytest",
Expand Down