From 0dd84495dab65895468389abff7dd4aca1fe2840 Mon Sep 17 00:00:00 2001 From: Federica Brando Date: Tue, 12 Mar 2024 12:55:39 +0100 Subject: [PATCH 1/9] add: function to load expected environment variables. - set `OPENVAR_PLUGIN`to `$HOME/.local/share/openvariant` - check if environment variable are not in the env otherwise adds them - check if path extists already, otherwise create directory - update requiremente with appdir package --- openvariant/commands/openvar.py | 7 ++++--- openvariant/utils/utils.py | 17 +++++++++++++++++ setup.py | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/openvariant/commands/openvar.py b/openvariant/commands/openvar.py index 0150818..1950a94 100644 --- a/openvariant/commands/openvar.py +++ b/openvariant/commands/openvar.py @@ -6,6 +6,7 @@ from openvariant.tasks.count import count as count_task from openvariant.tasks.groupby import group_by as group_by_task from openvariant.tasks.plugin import PluginActions +from openvariant.utils.utils import loadEnvironmentVariables @click.group(context_settings={'help_option_names': ['-h', '--help']}) @@ -13,6 +14,7 @@ def openvar(): """'openvar' is the command-line interface of OpenVariant. Parsing and data transformation of multiple input formats.""" + loadEnvironmentVariables() pass @@ -106,10 +108,9 @@ def groupby(input_path: str, script: str, where: str, group_by: str, cores: int, @openvar.command(name="plugin", short_help='Actions to execute for a plugin: create.') @click.argument('action', type=click.Choice(['create'])) @click.option('--name', '-n', type=click.STRING, help="Name of the plugin.") -@click.option('--directory', '-d', type=click.STRING, help="Directory to reach the plugin.") -def plugin(action, name: str or None, directory: str or None): +def plugin(action, name: str or None): """Actions to apply on the plugin system.""" - PluginActions[action.upper()].value(name, directory) + PluginActions[action.upper()].value(name) if __name__ == "__main__": diff --git a/openvariant/utils/utils.py b/openvariant/utils/utils.py index 2e9364b..6d355a2 100644 --- a/openvariant/utils/utils.py +++ b/openvariant/utils/utils.py @@ -1,8 +1,25 @@ import re +import os +from appdirs import user_data_dir from fnmatch import fnmatch from os.path import basename +ENV_VAR = { + 'OPENVAR_PLUGIN': user_data_dir('openvariant', 'bbglab') + } + +def loadEnvironmentVariables(): + """Load environment variable into the environment.""" + + missing_vars = set(ENV_VAR.keys()).difference(set(os.environ)) + + for env_var in missing_vars: + os.environ[env_var] = ENV_VAR[env_var] + os.makedirs(ENV_VAR[env_var], exist_ok=True) + + return + def check_extension(ext: str, path: str) -> bool: """Check if file matches with the annotation pattern""" return fnmatch(basename(path), ext) if ext[0] == '*' else re.match(ext, basename(path)) is not None diff --git a/setup.py b/setup.py index c3a6fe4..0355448 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ keywords='bioinformatics,openvariant,openvar,bbglab', packages=find_packages(exclude=["tests.*", "tests"]), include_package_data=True, - install_requires=['pyyaml', 'tqdm', 'click', 'pyliftover'], + install_requires=['pyyaml', 'tqdm', 'click', 'pyliftover', 'appdirs'], entry_points={ 'console_scripts': [ 'openvar = openvariant.commands.openvar:openvar', From 7b5cb717daa494d59330b726a6aabac23721016d Mon Sep 17 00:00:00 2001 From: Federica Brando Date: Tue, 12 Mar 2024 12:58:55 +0100 Subject: [PATCH 2/9] update: builder func and create plugin func with env var - update plugin builder to look for external plugin in `OPENVAR_PLUGIN` - update create plugin function to use env_var by default - Add `loadEnvironmentVariables()` so plugin tests do not fail. --- openvariant/annotation/builder.py | 6 +++--- openvariant/tasks/plugin.py | 4 ++-- tests/__init__.py | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/openvariant/annotation/builder.py b/openvariant/annotation/builder.py index 2e6a3c0..206ff7f 100644 --- a/openvariant/annotation/builder.py +++ b/openvariant/annotation/builder.py @@ -249,9 +249,9 @@ def _plugin_builder(x: dict, base_path: str = None) -> PluginBuilder: ctxt = _get_plugin_context(mod) except ModuleNotFoundError: try: - files = list(glob.iglob(f"{os.getcwd()}/**/{x[AnnotationTypes.PLUGIN.value]}", recursive=True)) + files = list(glob.iglob(f"{os.environ['OPENVAR_PLUGIN']}/**/{x[AnnotationTypes.PLUGIN.value]}", recursive=True)) if len(files) == 0: - raise FileNotFoundError(f"Unable to find '{x[AnnotationTypes.PLUGIN.value]}' plugin in '{os.getcwd()}'") + raise FileNotFoundError(f"Unable to find '{x[AnnotationTypes.PLUGIN.value]}' plugin in '{os.environ['OPENVAR_PLUGIN']}'") else: try: for package in files: @@ -263,7 +263,7 @@ def _plugin_builder(x: dict, base_path: str = None) -> PluginBuilder: func = _get_plugin_function(mod) ctxt = _get_plugin_context(mod) except (ImportError, AttributeError): - raise ImportError(f"Unable to import 'run' on the plugin.") + raise ImportError("Unable to import 'run' on the plugin.") except ModuleNotFoundError: raise ModuleNotFoundError(f"Unable to found '{x[AnnotationTypes.PLUGIN.value]}' plugin.") except (ImportError, AttributeError) as e: diff --git a/openvariant/tasks/plugin.py b/openvariant/tasks/plugin.py index 9c2f1e9..163471e 100644 --- a/openvariant/tasks/plugin.py +++ b/openvariant/tasks/plugin.py @@ -8,7 +8,7 @@ from functools import partial -def _add_action(name: str, directory: str = None) -> None: +def _add_action(name: str) -> None: """Create a new plugin It will generate all the required structure for a new plugin (files and folders). @@ -20,7 +20,7 @@ def _add_action(name: str, directory: str = None) -> None: directory : str The path to create the plugin. """ - path = directory if directory is not None else os.getcwd() + path = os.environ['OPENVAR_PLUGIN'] if os.path.exists(f"{path}/{name}"): raise FileExistsError(f"Directory {path}/{name} already exists.") os.mkdir(f"{path}/{name}") diff --git a/tests/__init__.py b/tests/__init__.py index e69de29..1cbff9a 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -0,0 +1,3 @@ +from openvariant.utils.utils import loadEnvironmentVariables + +loadEnvironmentVariables() \ No newline at end of file From 51689e5a427fc3dea1b741d112da9513a023eb3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20L=C3=B3pez-Elorduy?= <107858804+CarlosLopezElorduy@users.noreply.github.com> Date: Wed, 13 Mar 2024 15:52:22 +0100 Subject: [PATCH 3/9] add: return type hinting of loadEnvironmentVariables --- openvariant/utils/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openvariant/utils/utils.py b/openvariant/utils/utils.py index 6d355a2..7fc5e2d 100644 --- a/openvariant/utils/utils.py +++ b/openvariant/utils/utils.py @@ -7,9 +7,9 @@ ENV_VAR = { 'OPENVAR_PLUGIN': user_data_dir('openvariant', 'bbglab') - } +} -def loadEnvironmentVariables(): +def loadEnvironmentVariables() -> None: """Load environment variable into the environment.""" missing_vars = set(ENV_VAR.keys()).difference(set(os.environ)) From 2cd73d2ded3a3a207a9c089e232af08a0b244f39 Mon Sep 17 00:00:00 2001 From: Federica Brando Date: Mon, 18 Mar 2024 12:25:11 +0100 Subject: [PATCH 4/9] add: documentation for new plugin system --- docs/examples/cli/main_cli.ipynb | 228 ++++++++++++++++-------------- docs/user_guide/cli.rst | 4 +- docs/user_guide/plugin_system.rst | 5 +- 3 files changed, 126 insertions(+), 111 deletions(-) diff --git a/docs/examples/cli/main_cli.ipynb b/docs/examples/cli/main_cli.ipynb index f599f3d..dd58f6b 100644 --- a/docs/examples/cli/main_cli.ipynb +++ b/docs/examples/cli/main_cli.ipynb @@ -2,49 +2,55 @@ "cells": [ { "cell_type": "markdown", - "source": [ - "# Main tasks" - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "# Main tasks" + ] }, { "cell_type": "markdown", + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%% md\n" + } + }, "source": [ "We can run the main tasks that **OpenVariant** offers as a Python package, also, with a shell command. In [Introduction section](./introduction_cli.ipynb) you can check which are the different commands and their options.\n", "\n", "In the following examples we will see a little snip on these tasks.\n", "\n", "--------" - ], + ] + }, + { + "cell_type": "markdown", "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } - }, - { - "cell_type": "markdown", + }, "source": [ "### ***Cat*** command\n", "\n", "A simple case of the command:" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%% md\n" - } - } + ] }, { "cell_type": "code", "execution_count": 1, + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stdout", @@ -74,58 +80,58 @@ "source": [ "%%bash\n", "openvar cat ../datasets/sample2" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "Using it with some flags:" - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "Using it with some flags:" + ] }, { "cell_type": "code", "execution_count": 2, - "outputs": [], - "source": [ - "%%bash\n", - "openvar cat ../datasets/sample2 --output ./output_cat_cmd.tsv --header" - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%%\n" } - } + }, + "outputs": [], + "source": [ + "%%bash\n", + "openvar cat ../datasets/sample2 --output ./output_cat_cmd.tsv --header" + ] }, { "cell_type": "markdown", - "source": [ - "### ***Count*** command\n", - "\n", - "A simple case of the command:" - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### ***Count*** command\n", + "\n", + "A simple case of the command:" + ] }, { "cell_type": "code", "execution_count": 3, + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stdout", @@ -138,29 +144,29 @@ "source": [ "%%bash\n", "openvar count ../datasets/sample2 -q" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "Using it with some flags:" - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "Using it with some flags:" + ] }, { "cell_type": "code", "execution_count": 4, + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stdout", @@ -182,17 +188,17 @@ "source": [ "%%bash\n", "openvar count ../datasets/sample2 --group_by \"SYMBOL\" --cores 4 -q" - ], + ] + }, + { + "cell_type": "code", + "execution_count": 5, "metadata": { "collapsed": false, "pycharm": { "name": "#%%\n" } - } - }, - { - "cell_type": "code", - "execution_count": 5, + }, "outputs": [ { "name": "stdout", @@ -214,31 +220,31 @@ "source": [ "%%bash\n", "openvar count ../datasets/sample2 --group_by \"SYMBOL\" --where \"CANCER == 'ACC'\" --cores 4 -q" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### ***Group by*** command\n", - "\n", - "A simple case of the command:" - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### ***Group by*** command\n", + "\n", + "A simple case of the command:" + ] }, { "cell_type": "code", "execution_count": 6, + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stdout", @@ -270,29 +276,29 @@ "source": [ "%%bash\n", "openvar groupby ../datasets/sample2 -g \"CANCER\" --show --header -q" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "Using it with some flags:" - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "Using it with some flags:" + ] }, { "cell_type": "code", "execution_count": 7, + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stdout", @@ -306,17 +312,17 @@ "source": [ "%%bash\n", "openvar groupby ../datasets/sample2 -g \"CANCER\" --where \"SYMBOL == 'ATAD3C'\" --cores 4 --show -q" - ], + ] + }, + { + "cell_type": "code", + "execution_count": 8, "metadata": { "collapsed": false, "pycharm": { "name": "#%%\n" } - } - }, - { - "cell_type": "code", - "execution_count": 8, + }, "outputs": [ { "name": "stdout", @@ -336,45 +342,53 @@ "source": [ "%%bash\n", "openvar groupby ../datasets/sample2 -g \"CANCER\" --script \"grep -E -i '^(B3|ATA)'\" --show --cores 4 -q" - ], + ] + }, + { + "cell_type": "markdown", "metadata": { "collapsed": false, "pycharm": { - "name": "#%%\n" + "name": "#%% md\n" } - } - }, - { - "cell_type": "markdown", + }, "source": [ "\n", "### ***Plugin*** command\n", "\n", "_Plugin_ is slightly different than the others commands.\n", "\n", - "On this one we have only one single action: `create`." - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%% md\n" - } - } + "On this one we have only one single action: `create`. \n", + "The plugin will use the environment variable `OPENVAR_PLUGIN` directory where to store new plugins.\n", + "\n", + "by default:\n", + "\n", + "```sh\n", + "OPENVAR_PLUGIN=/home/user/.local/share/openvariant\n", + "```\n", + "\n", + "default directory can be changed by exporting a new path to OPENVAR_PLUGIN variable.\n", + "\n", + "i.e.\n", + "```sh\n", + "export OPENVAR_PLUGIN=/my/plugin/path/\n", + "```" + ] }, { "cell_type": "code", "execution_count": null, - "outputs": [], - "source": [ - "%%bash\n", - "openvar plugin create --name add_date --directory ../plugin_system" - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%%\n" } - } + }, + "outputs": [], + "source": [ + "%%bash\n", + "openvar plugin create --name add_date" + ] } ], "metadata": { @@ -398,4 +412,4 @@ }, "nbformat": 4, "nbformat_minor": 0 -} \ No newline at end of file +} diff --git a/docs/user_guide/cli.rst b/docs/user_guide/cli.rst index 7df0326..a9a743e 100644 --- a/docs/user_guide/cli.rst +++ b/docs/user_guide/cli.rst @@ -97,11 +97,11 @@ Create -------- It will generate the template with required files to apply and run a new plugin with the name stipulated and in the -corresponding directory. +default directory. .. code-block:: bash # Example - openvar plugin create -n reverse_value -d /my_plugins + openvar plugin create -n reverse_value For further details, check :ref:`Command-line interface examples` and you will have a clearer picture on how to use CLI tasks. \ No newline at end of file diff --git a/docs/user_guide/plugin_system.rst b/docs/user_guide/plugin_system.rst index 5e0d920..e0fbb41 100644 --- a/docs/user_guide/plugin_system.rst +++ b/docs/user_guide/plugin_system.rst @@ -19,8 +19,9 @@ visualize how the different classes are connected and composed with **OpenVarian | -As we have mentioned before, the plugin has to be present on the `annotation` file in order to be used. Plugins can be -distributed on different folders where `Builder` will manage to find them and apply the data transformation. +As we have mentioned before, the plugin has to be present on the `annotation` file in order to be used. Custom plugins will be placed in the +folder where the environment variable `OPENVAR_PLUGIN` points (`/home/user/.local/openvariant/` by default). +The `Builder` will manage to find them and apply the data transformation. Plugins will inherit `Context` and `Plugin` as base classes for each plugin. These classes are described as it follows: **Context** From 4b13fe2a0338f2146882c18948aaa802c12b720f Mon Sep 17 00:00:00 2001 From: Federica Brando Date: Thu, 21 Mar 2024 12:20:08 +0100 Subject: [PATCH 5/9] add: yaml for readthedocs --- .readthedocs.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .readthedocs.yaml diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..78598a2 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,15 @@ +version: 2 + +build: + os: "ubuntu-22.04" + tools: + python: "3.12" + +# Build from the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Explicitly set the version of Python and its requirements +python: + install: + - requirements: requirements-docs.txt \ No newline at end of file From 9b7d354fd396f404f6959348c764a16e85644003 Mon Sep 17 00:00:00 2001 From: Federica Brando Date: Thu, 21 Mar 2024 12:25:53 +0100 Subject: [PATCH 6/9] fix: update PyYAML so it does not break - fix `AttributeError: cython_source` --- requirements-docs.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-docs.txt b/requirements-docs.txt index 5e4ed10..d9aabbb 100644 --- a/requirements-docs.txt +++ b/requirements-docs.txt @@ -42,7 +42,7 @@ pyparsing==3.0.9 pyrsistent==0.18.1 python-dateutil==2.8.2 pytz==2022.1 -PyYAML==6.0 +PyYAML==6.0.1 pyzmq==23.2.0 requests==2.28.1 ruamel.yaml==0.16.13 From 3155df7a7f3083fbc7e668450b6783810ec606cb Mon Sep 17 00:00:00 2001 From: Federica Brando <52486325+FedericaBrando@users.noreply.github.com> Date: Thu, 21 Mar 2024 13:00:53 +0100 Subject: [PATCH 7/9] fix: ReadTheDocs documentation build (#24) * add: gcc and downgrade python to 3.7 * fix: docs plugin explanation * fix: typo in docs --- .readthedocs.yaml | 4 +++- docs/user_guide/plugin_system.rst | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 78598a2..b4788e8 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -3,7 +3,9 @@ version: 2 build: os: "ubuntu-22.04" tools: - python: "3.12" + python: "3.7" + apt_packages: + - gcc # Build from the docs/ directory with Sphinx sphinx: diff --git a/docs/user_guide/plugin_system.rst b/docs/user_guide/plugin_system.rst index e0fbb41..572caae 100644 --- a/docs/user_guide/plugin_system.rst +++ b/docs/user_guide/plugin_system.rst @@ -20,7 +20,7 @@ visualize how the different classes are connected and composed with **OpenVarian | As we have mentioned before, the plugin has to be present on the `annotation` file in order to be used. Custom plugins will be placed in the -folder where the environment variable `OPENVAR_PLUGIN` points (`/home/user/.local/openvariant/` by default). +folder where the environment variable :bash:`OPENVAR_PLUGIN` points (:bash:`/home/user/.local/share/openvariant/` by default). The `Builder` will manage to find them and apply the data transformation. Plugins will inherit `Context` and `Plugin` as base classes for each plugin. These classes are described as it follows: From dc192d4940d28c5da514fba5f6e2226427b984ee Mon Sep 17 00:00:00 2001 From: Federica Brando Date: Wed, 24 Jul 2024 16:03:31 +0200 Subject: [PATCH 8/9] update: version to 1.0.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0355448..0517345 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setup( name="open-variant", - version="0.7.6", + version="1.0.0", author="BBGLab - Barcelona Biomedical Genomics Lab", author_email='bbglab@irbbarcelona.org', description="OpenVariant provides different functionalities to read, parse and operate different multiple input " From d92507943fe788b0157ec26ad4bba533fac84f8a Mon Sep 17 00:00:00 2001 From: Federica Brando Date: Thu, 25 Jul 2024 15:30:06 +0200 Subject: [PATCH 9/9] update: docs with new release notes + fix typo --- docs/examples/cli/introduction_cli.ipynb | 124 +++++++++++------------ docs/examples/cli/main_cli.ipynb | 8 +- docs/examples/tasks/count.ipynb | 86 ++++++++-------- docs/release_notes.rst | 26 +++-- examples/tasks/count.ipynb | 86 ++++++++-------- 5 files changed, 170 insertions(+), 160 deletions(-) diff --git a/docs/examples/cli/introduction_cli.ipynb b/docs/examples/cli/introduction_cli.ipynb index 9df6a01..37df136 100644 --- a/docs/examples/cli/introduction_cli.ipynb +++ b/docs/examples/cli/introduction_cli.ipynb @@ -2,33 +2,39 @@ "cells": [ { "cell_type": "markdown", - "source": [ - "# Introduction" - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "# Introduction" + ] }, { "cell_type": "markdown", - "source": [ - "**OpenVariant** offers a command-line interface (CLI) with the main tasks that also can be applied in Python scripts.\n", - "\n", - "On the following command you can check the different options that `openvar` can run." - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "**OpenVariant** offers a command-line interface (CLI) with the main tasks that also can be applied in Python scripts.\n", + "\n", + "On the following command you can check the different options that `openvar` can run." + ] }, { "cell_type": "code", "execution_count": 1, + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stdout", @@ -55,29 +61,29 @@ "source": [ "%%bash\n", "openvar --help" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### ***Cat*** command" - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### **Cat** command" + ] }, { "cell_type": "code", "execution_count": 2, + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stdout", @@ -99,29 +105,29 @@ "source": [ "%%bash\n", "openvar cat --help" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### ***Count*** command" - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### **Count** command" + ] }, { "cell_type": "code", "execution_count": 3, + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stdout", @@ -145,29 +151,29 @@ "source": [ "%%bash\n", "openvar count --help" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### ***Group by*** command" - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### **Group by** command" + ] }, { "cell_type": "code", "execution_count": 4, + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stdout", @@ -195,29 +201,29 @@ "source": [ "%%bash\n", "openvar groupby --help" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] }, { "cell_type": "markdown", - "source": [ - "### ***Plugin*** command" - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "### **Plugin** command" + ] }, { "cell_type": "code", "execution_count": 5, + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stdout", @@ -237,13 +243,7 @@ "source": [ "%%bash\n", "openvar plugin --help" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] } ], "metadata": { @@ -267,4 +267,4 @@ }, "nbformat": 4, "nbformat_minor": 0 -} \ No newline at end of file +} diff --git a/docs/examples/cli/main_cli.ipynb b/docs/examples/cli/main_cli.ipynb index dd58f6b..2d476e6 100644 --- a/docs/examples/cli/main_cli.ipynb +++ b/docs/examples/cli/main_cli.ipynb @@ -37,7 +37,7 @@ } }, "source": [ - "### ***Cat*** command\n", + "### **Cat** command\n", "\n", "A simple case of the command:" ] @@ -118,7 +118,7 @@ } }, "source": [ - "### ***Count*** command\n", + "### **Count** command\n", "\n", "A simple case of the command:" ] @@ -231,7 +231,7 @@ } }, "source": [ - "### ***Group by*** command\n", + "### **Group by** command\n", "\n", "A simple case of the command:" ] @@ -354,7 +354,7 @@ }, "source": [ "\n", - "### ***Plugin*** command\n", + "### **Plugin** command\n", "\n", "_Plugin_ is slightly different than the others commands.\n", "\n", diff --git a/docs/examples/tasks/count.ipynb b/docs/examples/tasks/count.ipynb index 15957ef..cd9c55a 100644 --- a/docs/examples/tasks/count.ipynb +++ b/docs/examples/tasks/count.ipynb @@ -2,31 +2,37 @@ "cells": [ { "cell_type": "markdown", - "source": [ - "# _Count_" - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "# _Count_" + ] }, { "cell_type": "markdown", - "source": [ - "A simple example where we can find how **count** task works. This task is able with command-line." - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "A simple example where we can find how **count** task works. This task is able with command-line." + ] }, { "cell_type": "code", "execution_count": 1, + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "from os import getcwd\n", @@ -35,16 +41,16 @@ "\n", "dataset_folder = f'{dirname(getcwd())}/datasets/sample2'\n", "annotation_path = f'{dirname(getcwd())}/datasets/sample2/annotation.yaml'" - ], + ] + }, + { + "cell_type": "markdown", "metadata": { "collapsed": false, "pycharm": { - "name": "#%%\n" + "name": "#%% md\n" } - } - }, - { - "cell_type": "markdown", + }, "source": [ "`count` task allows us to count the number of rows that result has. It has the following parameters:\n", "\n", @@ -56,17 +62,17 @@ "- `quite` - Do not show the progress meanwhile the parsing is running.\n", "\n", "On the following example we can see a general case of `count` task:" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%% md\n" - } - } + ] }, { "cell_type": "code", "execution_count": 2, + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stdout", @@ -79,16 +85,16 @@ "source": [ "result = count(base_path=dataset_folder, annotation_path=annotation_path, quite=True)\n", "print(f\"Total: {result[0]}\")" - ], + ] + }, + { + "cell_type": "markdown", "metadata": { "collapsed": false, "pycharm": { - "name": "#%%\n" + "name": "#%% md\n" } - } - }, - { - "cell_type": "markdown", + }, "source": [ "One of the parameter on `count` task is `where`. You will be able to apply a conditional filter. The possible operations can be:\n", "\n", @@ -99,18 +105,18 @@ "+ `>=` - More or equal than.\n", "+ `>` - More than.\n", "\n", - "Also, `gropu_by` to group rows on different values of this key. An example of these parameters is the following one:" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%% md\n" - } - } + "Also, `group_by` to group rows on different values of this key. An example of these parameters is the following one:" + ] }, { "cell_type": "code", "execution_count": 3, + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stdout", @@ -125,13 +131,7 @@ "result = count(base_path=dataset_folder, annotation_path=annotation_path, where=\"SYMBOL == 'ATAD3C'\", group_by=\"CANCER\", quite=True)\n", "print(f\"Total: {result[0]}\")\n", "print(f\"Groups and count: {result[1]}\")" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] } ], "metadata": { @@ -155,4 +155,4 @@ }, "nbformat": 4, "nbformat_minor": 0 -} \ No newline at end of file +} diff --git a/docs/release_notes.rst b/docs/release_notes.rst index 311d6a4..5da280c 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -1,11 +1,21 @@ +============= +Release Notes +============= -********************* -Release notes -********************* +Version history +-------------------- -Version 0.1 -=============================== ++------------+----------+----------------------------------------+----------------------+ +| **Date** | **Ver.** | **Author** | **Comment** | ++------------+----------+----------------------------------------+----------------------+ +| 2024-07-25 | 1.0.0 | `@bbglab `_ | First stable release | +| | | | | ++------------+----------+----------------------------------------+----------------------+ -Version 0.X -=============================== -gfrfrfr \ No newline at end of file +OpenVariant v1.0.0 +================== + +First stable release of OpenVariant. This version includes the following features: + +* Tasks: **find** files, **cat** operation and **group-by**. +* Plugin system: classification of **alteration type**, **alternate allele frequency** getter and **LiftOver** operation. \ No newline at end of file diff --git a/examples/tasks/count.ipynb b/examples/tasks/count.ipynb index 15957ef..cd9c55a 100644 --- a/examples/tasks/count.ipynb +++ b/examples/tasks/count.ipynb @@ -2,31 +2,37 @@ "cells": [ { "cell_type": "markdown", - "source": [ - "# _Count_" - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "# _Count_" + ] }, { "cell_type": "markdown", - "source": [ - "A simple example where we can find how **count** task works. This task is able with command-line." - ], "metadata": { "collapsed": false, "pycharm": { "name": "#%% md\n" } - } + }, + "source": [ + "A simple example where we can find how **count** task works. This task is able with command-line." + ] }, { "cell_type": "code", "execution_count": 1, + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "from os import getcwd\n", @@ -35,16 +41,16 @@ "\n", "dataset_folder = f'{dirname(getcwd())}/datasets/sample2'\n", "annotation_path = f'{dirname(getcwd())}/datasets/sample2/annotation.yaml'" - ], + ] + }, + { + "cell_type": "markdown", "metadata": { "collapsed": false, "pycharm": { - "name": "#%%\n" + "name": "#%% md\n" } - } - }, - { - "cell_type": "markdown", + }, "source": [ "`count` task allows us to count the number of rows that result has. It has the following parameters:\n", "\n", @@ -56,17 +62,17 @@ "- `quite` - Do not show the progress meanwhile the parsing is running.\n", "\n", "On the following example we can see a general case of `count` task:" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%% md\n" - } - } + ] }, { "cell_type": "code", "execution_count": 2, + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stdout", @@ -79,16 +85,16 @@ "source": [ "result = count(base_path=dataset_folder, annotation_path=annotation_path, quite=True)\n", "print(f\"Total: {result[0]}\")" - ], + ] + }, + { + "cell_type": "markdown", "metadata": { "collapsed": false, "pycharm": { - "name": "#%%\n" + "name": "#%% md\n" } - } - }, - { - "cell_type": "markdown", + }, "source": [ "One of the parameter on `count` task is `where`. You will be able to apply a conditional filter. The possible operations can be:\n", "\n", @@ -99,18 +105,18 @@ "+ `>=` - More or equal than.\n", "+ `>` - More than.\n", "\n", - "Also, `gropu_by` to group rows on different values of this key. An example of these parameters is the following one:" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%% md\n" - } - } + "Also, `group_by` to group rows on different values of this key. An example of these parameters is the following one:" + ] }, { "cell_type": "code", "execution_count": 3, + "metadata": { + "collapsed": false, + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "name": "stdout", @@ -125,13 +131,7 @@ "result = count(base_path=dataset_folder, annotation_path=annotation_path, where=\"SYMBOL == 'ATAD3C'\", group_by=\"CANCER\", quite=True)\n", "print(f\"Total: {result[0]}\")\n", "print(f\"Groups and count: {result[1]}\")" - ], - "metadata": { - "collapsed": false, - "pycharm": { - "name": "#%%\n" - } - } + ] } ], "metadata": { @@ -155,4 +155,4 @@ }, "nbformat": 4, "nbformat_minor": 0 -} \ No newline at end of file +}