diff --git a/docs/assets/primalpage.png b/docs/assets/primalpage.png new file mode 100644 index 0000000..9919508 Binary files /dev/null and b/docs/assets/primalpage.png differ diff --git a/docs/assets/primalscheme1bed.png b/docs/assets/primalscheme1bed.png new file mode 100644 index 0000000..b95735d Binary files /dev/null and b/docs/assets/primalscheme1bed.png differ diff --git a/docs/cli.md b/docs/cli.md new file mode 100644 index 0000000..6164368 --- /dev/null +++ b/docs/cli.md @@ -0,0 +1,556 @@ +# `primal-page` + +**Usage**: + +```console +$ primal-page [OPTIONS] COMMAND [ARGS]... +``` + +**Options**: + +* `--version` +* `--install-completion`: Install completion for the current shell. +* `--show-completion`: Show completion for the current shell, to copy it or customize the installation. +* `--help`: Show this message and exit. + +**Commands**: + +* `aliases`: Manage aliases +* `build-index`: Build an index.json file from all schemes... +* `create`: Create a new scheme in the required format +* `dev`: Development commands +* `download`: Download schemes from the index.json +* `modify`: Modify an existing scheme's metadata... +* `remove`: Remove a scheme's version from the repo,... + +## `primal-page aliases` + +Manage aliases + +**Usage**: + +```console +$ primal-page aliases [OPTIONS] COMMAND [ARGS]... +``` + +**Options**: + +* `--help`: Show this message and exit. + +**Commands**: + +* `add`: Add an alias:schemename to the alias file +* `remove`: Remove an alias from the alias file. + +### `primal-page aliases add` + +Add an alias:schemename to the alias file + +**Usage**: + +```console +$ primal-page aliases add [OPTIONS] ALIASES_FILE ALIAS SCHEMENAME +``` + +**Arguments**: + +* `ALIASES_FILE`: The path to the alias file to write to [required] +* `ALIAS`: The alias to add [required] +* `SCHEMENAME`: The schemename the alias refers to [required] + +**Options**: + +* `--help`: Show this message and exit. + +### `primal-page aliases remove` + +Remove an alias from the alias file. Does nothing if the alias does not exist + +**Usage**: + +```console +$ primal-page aliases remove [OPTIONS] ALIASES_FILE ALIAS +``` + +**Arguments**: + +* `ALIASES_FILE`: The path to the alias file to write to [required] +* `ALIAS`: The alias to add [required] + +**Options**: + +* `--help`: Show this message and exit. + +## `primal-page build-index` + +Build an index.json file from all schemes in the directory + +**Usage**: + +```console +$ primal-page build-index [OPTIONS] +``` + +**Options**: + +* `--gitaccount TEXT`: The name of the github account [default: quick-lab] +* `--gitserver TEXT`: The name of the github server [default: https://github.com/] +* `--parentdir PATH`: The parent directory [default: .] +* `--git-commit-sha TEXT`: The git commit +* `--force / --no-force`: Force the creation of the index.json [default: no-force] +* `--help`: Show this message and exit. + +## `primal-page create` + +Create a new scheme in the required format + +**Usage**: + +```console +$ primal-page create [OPTIONS] SCHEMEPATH +``` + +**Arguments**: + +* `SCHEMEPATH`: The path to the primerscheme directory [required] + +**Options**: + +* `--schemename TEXT`: The name of the scheme [required] +* `--ampliconsize INTEGER RANGE`: Amplicon size [x>=100; required] +* `--schemeversion TEXT`: Scheme version, default is parsed from config.json [required] +* `--species INTEGER`: The species this scheme targets. Please use NCBI taxonomy ids [required] +* `--authors TEXT`: Any authors [required] +* `--schemestatus [withdrawn|deprecated|autogenerated|draft|tested|validated]`: Scheme status [default: draft] +* `--citations TEXT`: Any associated citations. Please use DOI +* `--primerbed PATH`: Manually specify the primer bed file, default is *primer.bed +* `--reference PATH`: Manually specify the reference.fasta file, default is *.fasta +* `--output PATH`: Where to output the scheme [default: primerschemes] +* `--configpath PATH`: Where the config.json file is located +* `--algorithmversion TEXT`: The version of primalscheme or other +* `--description TEXT`: A description of the scheme +* `--derivedfrom TEXT`: Which scheme has this scheme been derived from +* `--primerclass [primerschemes]`: The primer class [default: primerschemes] +* `--collection [ARTIC|MODJADJI|QUICK-LAB|COMMUNITY|WASTE-WATER|CLINICAL-ISOLATES|WHOLE-GENOME|PANEL|MULTI-TARGET]`: The collection +* `--link-protocol TEXT`: Optional link to protocol +* `--link-validation TEXT`: Optional link to validation data +* `--links-homepage TEXT`: Optional link to homepage +* `--link-vendor TEXT`: Optional link to vendors +* `--link-misc TEXT`: Optional miscellaneous link +* `--fix / --no-fix`: Attempt to fix the scheme [default: no-fix] +* `--help`: Show this message and exit. + +## `primal-page download` + +Download schemes from the index.json + +**Usage**: + +```console +$ primal-page download [OPTIONS] COMMAND [ARGS]... +``` + +**Options**: + +* `--help`: Show this message and exit. + +**Commands**: + +* `all`: Download all schemes from the index.json +* `scheme`: Download a scheme from the index.json + +### `primal-page download all` + +Download all schemes from the index.json + +**Usage**: + +```console +$ primal-page download all [OPTIONS] +``` + +**Options**: + +* `--output PATH`: The directory the primerschemes dir will be created in [required] +* `--index-url TEXT`: The URL to the index.json [default: https://raw.githubusercontent.com/quick-lab/primerschemes/main/index.json] +* `--help`: Show this message and exit. + +### `primal-page download scheme` + +Download a scheme from the index.json + +**Usage**: + +```console +$ primal-page download scheme [OPTIONS] SCHEMENAME AMPLICONSIZE SCHEMEVERSION +``` + +**Arguments**: + +* `SCHEMENAME`: The name of the scheme [required] +* `AMPLICONSIZE`: Amplicon size [required] +* `SCHEMEVERSION`: Scheme version [required] + +**Options**: + +* `--output PATH`: The directory the primerschemes dir will be created in [required] +* `--index-url TEXT`: The URL to the index.json [default: https://raw.githubusercontent.com/quick-lab/primerschemes/main/index.json] +* `--help`: Show this message and exit. + +## `primal-page modify` + +Modify an existing scheme's metadata (info.json) + +**Usage**: + +```console +$ primal-page modify [OPTIONS] COMMAND [ARGS]... +``` + +**Options**: + +* `--help`: Show this message and exit. + +**Commands**: + +* `add-author`: Append an author to the authors list in... +* `add-citation`: Append an citation to the authors list in... +* `add-collection`: Add a Collection to the Collection list in... +* `add-link`: Add a link to the selected link field to... +* `change-contactinfo`: Change the contactinfo field in the info.json +* `change-derivedfrom`: Replaces the derivedfrom in the info.json... +* `change-description`: Replaces the description in the info.json... +* `change-license`: Replaces the license in the info.json file +* `change-primerclass`: Change the primerclass field in the info.json +* `change-status`: Change the status field in the info.json +* `regenerate`: Validates the info.json and regenerate the... +* `remove-author`: Remove an author from the authors list in... +* `remove-citation`: Remove an citation form the authors list... +* `remove-collection`: Remove an Collection from the Collection... +* `remove-link`: Add a link to the selected link field to... +* `reorder-authors`: Reorder the authors in the info.json file + +### `primal-page modify add-author` + +Append an author to the authors list in the info.json file + +**Usage**: + +```console +$ primal-page modify add-author [OPTIONS] SCHEMEINFO AUTHOR +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] +* `AUTHOR`: The author to add [required] + +**Options**: + +* `--author-index INTEGER`: The 0-based index to insert the author at. Default is the end [required] +* `--help`: Show this message and exit. + +### `primal-page modify add-citation` + +Append an citation to the authors list in the info.json file + +**Usage**: + +```console +$ primal-page modify add-citation [OPTIONS] SCHEMEINFO CITATION +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] +* `CITATION`: The citation to add [required] + +**Options**: + +* `--help`: Show this message and exit. + +### `primal-page modify add-collection` + +Add a Collection to the Collection list in the info.json file + +**Usage**: + +```console +$ primal-page modify add-collection [OPTIONS] SCHEMEINFO COLLECTION:{ARTIC|MODJADJI|QUICK-LAB|COMMUNITY|WASTE-WATER|CLINICAL-ISOLATES|WHOLE-GENOME|PANEL|MULTI-TARGET} +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] +* `COLLECTION:{ARTIC|MODJADJI|QUICK-LAB|COMMUNITY|WASTE-WATER|CLINICAL-ISOLATES|WHOLE-GENOME|PANEL|MULTI-TARGET}`: The Collection to add [required] + +**Options**: + +* `--help`: Show this message and exit. + +### `primal-page modify add-link` + +Add a link to the selected link field to the info.json + +**Usage**: + +```console +$ primal-page modify add-link [OPTIONS] SCHEMEINFO LINKFIELD LINK +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] +* `LINKFIELD`: The link field to add to. protocols, validation, homepage, vendors, misc [required] +* `LINK`: The link to add. [required] + +**Options**: + +* `--help`: Show this message and exit. + +### `primal-page modify change-contactinfo` + +Change the contactinfo field in the info.json + +**Usage**: + +```console +$ primal-page modify change-contactinfo [OPTIONS] SCHEMEINFO CONTACTINFO +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] +* `CONTACTINFO`: The contact information for this scheme. Use 'None' to remove the contact info [required] + +**Options**: + +* `--help`: Show this message and exit. + +### `primal-page modify change-derivedfrom` + +Replaces the derivedfrom in the info.json file + +**Usage**: + +```console +$ primal-page modify change-derivedfrom [OPTIONS] SCHEMEINFO DERIVEDFROM +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] +* `DERIVEDFROM`: The new derivedfrom. Use 'None' to remove the derivedfrom [required] + +**Options**: + +* `--help`: Show this message and exit. + +### `primal-page modify change-description` + +Replaces the description in the info.json file + +**Usage**: + +```console +$ primal-page modify change-description [OPTIONS] SCHEMEINFO DESCRIPTION +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] +* `DESCRIPTION`: The new description. Use 'None' to remove the description [required] + +**Options**: + +* `--help`: Show this message and exit. + +### `primal-page modify change-license` + +Replaces the license in the info.json file + +**Usage**: + +```console +$ primal-page modify change-license [OPTIONS] SCHEMEINFO LICENSE +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] +* `LICENSE`: The new license. Use 'None' show the work is not licensed (Not recommended) [required] + +**Options**: + +* `--help`: Show this message and exit. + +### `primal-page modify change-primerclass` + +Change the primerclass field in the info.json + +**Usage**: + +```console +$ primal-page modify change-primerclass [OPTIONS] SCHEMEINFO PRIMERCLASS:{primerschemes} +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] +* `PRIMERCLASS:{primerschemes}`: The primerclass to change to [required] + +**Options**: + +* `--help`: Show this message and exit. + +### `primal-page modify change-status` + +Change the status field in the info.json + +**Usage**: + +```console +$ primal-page modify change-status [OPTIONS] SCHEMEINFO [SCHEMESTATUS]:[withdrawn|deprecated|autogenerated|draft|tested|validated] +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] +* `[SCHEMESTATUS]:[withdrawn|deprecated|autogenerated|draft|tested|validated]`: The scheme class [default: draft] + +**Options**: + +* `--help`: Show this message and exit. + +### `primal-page modify regenerate` + +Validates the info.json and regenerate the README.md + +**Usage**: + +```console +$ primal-page modify regenerate [OPTIONS] SCHEMEINFO +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] + +**Options**: + +* `--help`: Show this message and exit. + +### `primal-page modify remove-author` + +Remove an author from the authors list in the info.json file + +**Usage**: + +```console +$ primal-page modify remove-author [OPTIONS] SCHEMEINFO AUTHOR +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] +* `AUTHOR`: The author to remove [required] + +**Options**: + +* `--help`: Show this message and exit. + +### `primal-page modify remove-citation` + +Remove an citation form the authors list in the info.json file + +**Usage**: + +```console +$ primal-page modify remove-citation [OPTIONS] SCHEMEINFO CITATION +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] +* `CITATION`: The citation to remove [required] + +**Options**: + +* `--help`: Show this message and exit. + +### `primal-page modify remove-collection` + +Remove an Collection from the Collection list in the info.json file + +**Usage**: + +```console +$ primal-page modify remove-collection [OPTIONS] SCHEMEINFO COLLECTION:{ARTIC|MODJADJI|QUICK-LAB|COMMUNITY|WASTE-WATER|CLINICAL-ISOLATES|WHOLE-GENOME|PANEL|MULTI-TARGET} +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] +* `COLLECTION:{ARTIC|MODJADJI|QUICK-LAB|COMMUNITY|WASTE-WATER|CLINICAL-ISOLATES|WHOLE-GENOME|PANEL|MULTI-TARGET}`: The Collection to remove [required] + +**Options**: + +* `--help`: Show this message and exit. + +### `primal-page modify remove-link` + +Add a link to the selected link field to the info.json + +**Usage**: + +```console +$ primal-page modify remove-link [OPTIONS] SCHEMEINFO LINKFIELD LINK +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] +* `LINKFIELD`: The link field to remove from. protocols, validation, homepage, vendors, misc [required] +* `LINK`: The link to remove. [required] + +**Options**: + +* `--help`: Show this message and exit. + +### `primal-page modify reorder-authors` + +Reorder the authors in the info.json file + +**Usage**: + +```console +$ primal-page modify reorder-authors [OPTIONS] SCHEMEINFO [AUTHOR_INDEX] +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] +* `[AUTHOR_INDEX]`: The indexes in the new order, separated by spaces. e.g. 1 0 2. Any indexes not provided will be appended to the end + +**Options**: + +* `--help`: Show this message and exit. + +## `primal-page remove` + +Remove a scheme's version from the repo, will also remove size and schemename directories if empty + +**Usage**: + +```console +$ primal-page remove [OPTIONS] SCHEMEINFO +``` + +**Arguments**: + +* `SCHEMEINFO`: The path to info.json [required] + +**Options**: + +* `--help`: Show this message and exit. + diff --git a/docs/examples.md b/docs/examples.md new file mode 100644 index 0000000..c1ba634 --- /dev/null +++ b/docs/examples.md @@ -0,0 +1,45 @@ +# Adding a scheme + +> See [primal-page create](cli.md#primal-page-create) full details. + +To add a scheme into ```quick-lab/primerschemes```, primal-page is used to create the info.json metadata file and insure all the files are in the correct format. + +## Creating a scheme from primalscheme(1) files + +### .primer.bed +From primalscheme a file should be output called `{scheme-name}.primer.bed`. This file contains all the data needed to produce the primer scheme. + +> Old version of primalscheme do not contains the 7th column (PrimerSequence) + +![primerbed](assets/primalscheme1bed.png) + + + + +## Manual editing of files + +Do not do this unless you have to. + +If you edit the `info.json` use `primal-page modify regenerate {info.json}` to validate the changes, and regenerate the README.md + +If you edit the `primer.bed` or `reference.fasta` use `primal-page dev regenerate {info.json}` to update the hashes in info.json need to be updated. + +> If you are editing `primer.bed` or `reference.fasta` something has gone wrong + + +### Modifying cascade graph +```mermaid +flowchart TD + +info[info.json] +readme[README.md] +primer[primer.bed] +ref[reference.fasta] + + +info -->|Embedded| readme + +primer -->|md5 hash| info +ref -->|md5 hash| info + +``` diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..eb1b922 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,53 @@ +# primal-page + +![primalpage](assets/primalpage.png) + +`primal-page` is a python tool for creating and modifying metadata for primerschemes according to the schema used in [labs](https://labs.primalscheme.com/). + + + +## Installation + +### via pip +``` +pip install primal-page + +# To run +primal-page +``` + +### from source +``` +git clone https://github.com/ChrisgKent/primal-page.git +cd primal-page +poetry build + +# To run +poetry run primal-page +``` + + +## Overview + +### create +To create the metadata file, use `primal-page create`, which will ask for required data to create the metadata file. For a more details please see [examples](examples.md) page or the [cli](cli.md). + +### modify + +Once the metadata files are generated, they can be modified with `primal-page modify` and the appropriate option. + +>*Do not modify the files manually* [see](examples.md#manual-editing-of-files). + +### aliases + +Aliases are a way to provide alternative names for a schemename. For example, the schemename `hbv` (from `hbv/600.v2.1.0`) scheme has the aliases of `hepatitis-b-virus`:`hbv`. + +This is currently used for; + +- The searchbar in [labs](https://labs.primalscheme.com). So Searching for `hepatitis` will provide `hbv/600.v2.1.0` +- Backwards compatibility. The [`ncoV-2019`](https://github.com/artic-network/primer-schemes/tree/master/nCoV-2019) schemes are renamed `artic-sars-cov-2`, so we want to ensure that `ncoV-2019/400/v5.3.2` points to the correct scheme. + + + + + diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..d3d13ea --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,20 @@ +site_name: primal-page + +repo_url: https://github.com/ChrisgKent/primal-page +repo_name: primal-page + +site_url: https://chrisgkent.github.io/primal-page/ +theme: + name: material + +nav: + - Overview: index.md + - Command Line Interface: cli.md + - Examples: examples.md + +markdown_extensions: + - pymdownx.superfences: + custom_fences: + - name: mermaid + class: mermaid + format: !!python/name:pymdownx.superfences.fence_code_format