Skip to content

Commit

Permalink
Updating changelog before release.
Browse files Browse the repository at this point in the history
  • Loading branch information
zivy committed Jan 20, 2023
1 parent dc7136f commit a1b18ee
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 28 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ needed. This is equivalent to summarizing all activity on a feature branch versu

## Unreleased

## v0.3.0

### Added
* fluorescent_probes_csv_2_md - script for creating the knowledge-base fluorescent_probes markdown page from the fluorescent_probes.csv.

### Changed
* reagent_resources_csv_2_md_url - In addition to the reagent_resources.csv we now use a template file into which the table is written. Allows us to modify the descriptive text without modifying code. Additionally, the table is sorted on the "Target Name / Protein Biomarker" column.
* update_index_md_stats - Change the computed statistics to:
1. number_of_contributors - count both original contributors and folks that replicated the work.
1. number_of_validated_reagents - count rows in the reagent_resources.csv.
1. number_of_fluorescent_probes - count number of unique entries in conjugate column of the reagent_resources.csv (ignoring NA, Unconjugated, Biotin, HRP, UT014, UT015, UT016, UT019).
1. number_of_tissues - count unique combinations of Target_Species-Target_Tissue-Tissue_State.

## v0.2.0

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,21 @@
import pandas as pd
import argparse
import sys
import pathlib
from .argparse_types import file_path
import json
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
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
):

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
Expand All @@ -50,16 +46,14 @@ def fluorescent_probe_csv_to_md(
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))
)
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."
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",
Expand All @@ -80,7 +74,7 @@ def main(argv=None):
return fluorescent_probe_csv_to_md(
template_file_path=args.md_template_file,
csv_file_path=args.csv_file,
output_dir=args.output_dir
output_dir=args.output_dir,
)
except Exception as e:
print(
Expand Down
25 changes: 11 additions & 14 deletions tests/test_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
from ibex_imaging_knowledge_base_utilities.reagent_resources_csv_2_md_url import (
csv_to_md_with_url,
)
from ibex_imaging_knowledge_base_utilities.fluorescent_probes_csv_2_md import fluorescent_probe_csv_to_md
from ibex_imaging_knowledge_base_utilities.fluorescent_probes_csv_2_md import (
fluorescent_probe_csv_to_md,
)

from ibex_imaging_knowledge_base_utilities.bib2md import bibfile2md
from ibex_imaging_knowledge_base_utilities.update_index_md_stats import (
Expand Down Expand Up @@ -35,7 +37,7 @@ def files_md5(self, file_path_list):

class TestCSV2MD(BaseTest):
@pytest.mark.parametrize(
"md_template_file_name, csv_file_name, supporting_material_root_dir, vendor_to_website_json_file_path, result_md5hash",
"md_template_file_name, csv_file_name, supporting_material_root_dir, vendor_to_website_json_file_path, result_md5hash", # noqa E501
[
(
"reagent_resources.md.in",
Expand Down Expand Up @@ -66,6 +68,7 @@ def test_csv_2_md_with_url(
== result_md5hash
)


class TestFluorescentProbesCSV2MD(BaseTest):
@pytest.mark.parametrize(
"md_template_file_name, csv_file_name, result_md5hash",
Expand All @@ -78,21 +81,15 @@ class TestFluorescentProbesCSV2MD(BaseTest):
],
)
def test_fluorescent_probe_csv_to_md(
self,
md_template_file_name,
csv_file_name,
result_md5hash,
tmp_path
self, md_template_file_name, csv_file_name, result_md5hash, tmp_path
):
fluorescent_probe_csv_to_md(
template_file_path = self.data_path / md_template_file_name,
csv_file_path = self.data_path / csv_file_name,
output_dir = tmp_path
)
assert (
self.files_md5([tmp_path / "fluorescent_probes.md"])
== result_md5hash
template_file_path=self.data_path / md_template_file_name,
csv_file_path=self.data_path / csv_file_name,
output_dir=tmp_path,
)
assert self.files_md5([tmp_path / "fluorescent_probes.md"]) == result_md5hash


class TestBib2MD(BaseTest):
@pytest.mark.parametrize(
Expand Down

0 comments on commit a1b18ee

Please sign in to comment.