-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from zivy/updateUtilities
Update utilities
- Loading branch information
Showing
10 changed files
with
312 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta" | |
|
||
[project] | ||
name = "ibex_imaging_knowledge_base_utilities" | ||
version = "0.2.0" | ||
version = "0.3.0" | ||
authors = [{ name="Ziv Yaniv", email="[email protected]" }, | ||
] | ||
description = "Utility scripts used for maintaining the IBEX Imaging Community Knowledge-Base" | ||
|
@@ -30,5 +30,6 @@ dependencies = [ | |
[project.scripts] | ||
bib2md = "ibex_imaging_knowledge_base_utilities.bib2md:main" | ||
reagent_resources_csv_2_md_url = "ibex_imaging_knowledge_base_utilities.reagent_resources_csv_2_md_url:main" | ||
fluorescent_probes_csv_2_md = "ibex_imaging_knowledge_base_utilities.fluorescent_probes_csv_2_md:main" | ||
update_index_md_stats = "ibex_imaging_knowledge_base_utilities.update_index_md_stats:main" | ||
validate_zenodo_json = "ibex_imaging_knowledge_base_utilities.validate_zenodo_json:main" |
89 changes: 89 additions & 0 deletions
89
src/ibex_imaging_knowledge_base_utilities/fluorescent_probes_csv_2_md.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# ========================================================================= | ||
# | ||
# Copyright Ziv Yaniv | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0.txt | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# ========================================================================= | ||
|
||
import pandas as pd | ||
import argparse | ||
import sys | ||
from .argparse_types import file_path, dir_path | ||
|
||
|
||
""" | ||
This script converts the IBEX knowledge-base fluorescent_probes.csv file to markdown. | ||
This script is automatically run when modifications to the fluorescent_probes.csv file is merged | ||
into the main branch of the ibex_knowledge_base repository (see .github/workflows/data2md.yml). | ||
Assumption: The fluorescent_probes.csv file is valid. It conforms to the expected format (empty entries denoted | ||
by the string "NA"). | ||
""" | ||
|
||
|
||
def fluorescent_probe_csv_to_md(template_file_path, csv_file_path, output_dir): | ||
""" | ||
Convert the IBEX knowledge-base fluorescent probe csv file to markdown. Output is written to a | ||
file named fluorescent_probes.md in the output directory. The template_file_path file is expected | ||
to contain the string | ||
{probe_table} which is replaced with the contents of the actual table. | ||
""" | ||
# Read the dataframe and keep entries that are "NA", don't convert to nan | ||
df = pd.read_csv(csv_file_path, dtype=str, keep_default_na=False) | ||
df.sort_values(by=["Excitation Max (nm)", "Emission Max (nm)"], inplace=True) | ||
with open(template_file_path, "r") as fp: | ||
input_md_str = fp.read() | ||
with open(output_dir / "fluorescent_probes.md", "w") as fp: | ||
fp.write(input_md_str.format(probe_table=df.to_markdown(index=False))) | ||
|
||
|
||
def main(argv=None): | ||
if argv is None: # script was invoked from commandline | ||
argv = sys.argv[1:] | ||
parser = argparse.ArgumentParser( | ||
description="Convert knowledge-base fluorescent probes file from csv to md and sort according to excitation and emission." # noqa E501 | ||
) | ||
parser.add_argument( | ||
"md_template_file", | ||
type=file_path, | ||
help='Path to template markdown file which contains the string "{probe_table}".', | ||
) | ||
parser.add_argument( | ||
"csv_file", type=file_path, help="Path to the fluorescent_probes.csv file." | ||
) | ||
parser.add_argument( | ||
"output_dir", | ||
type=dir_path, | ||
help="Path to the output directory (the fluorescent_probes.md file is written to this directory).", | ||
) | ||
args = parser.parse_args(argv) | ||
|
||
try: | ||
return fluorescent_probe_csv_to_md( | ||
template_file_path=args.md_template_file, | ||
csv_file_path=args.csv_file, | ||
output_dir=args.output_dir, | ||
) | ||
except Exception as e: | ||
print( | ||
f"{e}", | ||
file=sys.stderr, | ||
) | ||
return 1 | ||
return 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
Fluorescent Probe,Excitation Max (nm),Emission Max (nm),Signal Inactivation Conditions IBEX2D Manual | ||
Hoechst,350,461,Does not bleach | ||
VioGreen,388,520,1 mg/ml LiBH4 15 minutes | ||
VioBlue,400,452,1 mg/ml LiBH4 15 minutes | ||
Spark Violet 538,400,538,1 mg/ml LiBH4 15 minutes | ||
StarBright Violet 670,401,667,Does not bleach within 15 minutes of 1 mg/ml LiBH4 treatment | ||
StarBright Violet 710,402,713,Does not bleach within 15 minutes of 1 mg/ml LiBH4 treatment | ||
BV421,405,421,1 mg/ml LiBH4 15 minutes + Light | ||
eF450,405,450,1 mg/ml LiBH4 15 minutes | ||
BV510,405,510,1 mg/ml LiBH4 15 minutes + Light | ||
BV570,405,570,Does not bleach within 15 minutes of 1 mg/ml LiBH4 treatment | ||
Pacific Blue,410,455,1 mg/ml LiBH4 15 minutes | ||
Cyan Fluorescent Protein (CFP),435,485,Does not bleach | ||
StarBright Blue 700,473,703,Does not bleach within 15 minutes of 1 mg/ml LiBH4 treatment | ||
PerCP-Vio 700,482,704,Not tested | ||
Green Fluorescent Protein (GFP),488,510,Does not bleach | ||
iF488,488,530,1 mg/ml LiBH4 15 minutes | ||
AF488,490,525,1 mg/ml LiBH4 15 minutes | ||
AF488 (Plus),490,525,1 mg/ml LiBH4 15 minutes | ||
FITC,490,525,1 mg/ml LiBH4 30 minutes | ||
CL490,491,515,1 mg/ml LiBH4 15 minutes | ||
Spark Blue 574,506,574,1 mg/ml LiBH4 15 minutes | ||
iF514,511,527,Does not bleach within 15 minutes of 1 mg/ml LiBH4 treatment | ||
Yellow Fluorescent Protein (YFP),513,527,Does not bleach | ||
JOJO-1,530,544,Does not bleach | ||
AF532,532,554,1 mg/ml LiBH4 15 minutes | ||
iF532,537,560,1 mg/ml LiBH4 15 minutes | ||
CL550,550,575,1 mg/ml LiBH4 15 minutes | ||
AF555,555,580,1 mg/ml LiBH4 15 minutes | ||
AF555 (Plus),555,580,1 mg/ml LiBH4 15 minutes | ||
Spark YG 570,555,570,Does not bleach within 15 minutes of 1 mg/ml LiBH4 treatment | ||
Red Fluorescent Protein (RFP),555,584,Does not bleach | ||
AF546,556,573,Does not bleach within 15 minutes of 1 mg/ml LiBH4 treatment | ||
eF570,556,569,1 mg/ml LiBH4 15 minutes | ||
iF555,557,570,1 mg/ml LiBH4 15 minutes | ||
PE,565,578,1 mg/ml LiBH4 15 minutes | ||
RY586,565,586,Not tested | ||
PE/iF594,565,606,1 mg/ml LiBH4 15 minutes | ||
PE/Dazzle AF594,565,610,Does not bleach within 15 minutes of 1 mg/ml LiBH4 treatment | ||
PE-Vio 615,565,619,Does not bleach within 15 minutes of 1 mg/ml LiBH4 treatment | ||
PE-Vio 770,565,775,1 mg/ml LiBH4 15 minutes | ||
AF568,578,603,Does not bleach within 15 minutes of 1 mg/ml LiBH4 treatment | ||
iF594,588,604,1 mg/ml LiBH4 15 minutes | ||
AF594,590,617,Does not bleach within 15 minutes of 1 mg/ml LiBH4 treatment. | ||
CL594,593,614,Does not bleach within 15 minutes of 1 mg/ml LiBH4 treatment | ||
CF594,593,615,Does not bleach within 15 minutes of 1 mg/ml LiBH4 treatment | ||
eF615,595,615,Does not bleach within 15 minutes of 1 mg/ml LiBH4 treatment | ||
Texas Red,596,615,Does not bleach within 15 minutes of 1 mg/ml LiBH4 treatment | ||
AF633,631,650,1 mg/ml LiBH4 15 minutes | ||
eF660,633,669,1 mg/ml LiBH4 15 minutes | ||
AF647,650,665,1 mg/ml LiBH4 15 minutes | ||
AF647 (Plus),650,665,1 mg/ml LiBH4 15 minutes | ||
APC-Vio 770,652,775,Not tested | ||
CL650,655,676,1 mg/ml LiBH4 15 minutes | ||
iF647,656,670,1 mg/ml LiBH4 15 minutes | ||
AF660,662,690,1 mg/ml LiBH4 15 minutes | ||
AF680,679,702,1 mg/ml LiBH4 15 minutes | ||
iF680,684,701,1 mg/ml LiBH4 15 minutes | ||
Spark Red 718,687,718,1 mg/ml LiBH4 15 minutes | ||
Vio Bright R720,695,720,1 mg/ml LiBH4 15 minutes | ||
AF700,702,723,1 mg/ml LiBH4 15 minutes | ||
AF750,749,775,1 mg/ml LiBH4 15 minutes | ||
iF750,757,779,1 mg/ml LiBH4 15 minutes | ||
BL759/780,759,780,1 mg/ml LiBH4 15 minutes | ||
DL755,776,754,1 mg/ml LiBH4 15 minutes | ||
AF790,784,814,1 mg/ml LiBH4 15 minutes | ||
AF800 (Plus),786,790,1 mg/ml LiBH4 15 minutes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Fluorescent Probes Tested by the IBEX Imaging Community | ||
|
||
<!-- Do NOT edit this file. It is automatically generated from the fluorescent_probes.md.in and fluorescent_probes.csv files. --> | ||
|
||
Summary of fluorescent probes tested by the IBEX Imaging Community. Inactivation conditions are method specific. | ||
|
||
For the original IBEX2D manual method that uses 1 mg/ml of LiBH4. The time, concentration of LiBH4, and method (continuous exchange, bleaching in the presence of light) may vary by user. | ||
|
||
|
||
{probe_table} |
Oops, something went wrong.