# AGROBIOTA SDK
This package contains the code for the Agrobiota Environment.
## Usage
The AGROBIOTA SDK simplifies the integration and transformation of AGROBIOTA
data. It is available for Python 3.12+ and can be installed using pip:
```bash
python3.12 -m pip install agrobiota-sdk
```
It can be used through a CLI or as a Python library.
### CLI
To discover the available options in the AGROBIOTA SDK CLI, use the `--help`
option at the root of the project:
```bash
$ agb-sdk --help
Usage: agb-sdk [OPTIONS] COMMAND [ARGS]...
Agrobiota SDK CLI
╭─ Options ────────────────────────────────────────────────────╮
│ --version Show the version and exit. │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────╮
│ analysis Operations over analysis from Agroportal API │
│ convert Convert data between formats │
╰──────────────────────────────────────────────────────────────╯
```
As shown in the example above, the AGROBIOTA SDK CLI has two commands:
`analysis` and `convert`.
The `analysis` command allows viewing analyses and bioindex reports. To see the
available options, simply run the command with the `--help` option:
```bash
$ agb-sdk analysis list --help
Usage: agb-sdk analysis list [OPTIONS] [REPORT_ID]
╭─ Options ────────────────────────────────────────────────────────────────╮
│ --connection-string TEXT The connection string to the │
│ Agroportal API. │
│ [env var: AGB_CONNECTION_STRING] │
│ --term -t TEXT The term to search for in the │
│ analysis. │
│ --skip -sk INTEGER The number of records to skip. │
│ [default: 0] │
│ --size -s INTEGER The number of records to return. │
│ [default: 25] │
│ --save-to-file PATH If provided, the analysis will be │
│ saved to a file. This option is only │
│ available when the Biotrop Bioindex │
│ is provided. │
│ --stdout-json -j If true, the analysis will be │
│ printed to the console as JSON. This │
│ command should be used when the │
│ `REPORT_ID` parameter is provided. │
│ --resolve-taxonomies If true, the taxonomies will be │
│ resolved from the taxonomy service. │
│ Otherwise the TaxID values will be │
│ used as is. This command should be │
│ used when the `REPORT_ID` parameter │
│ is provided. │
│ [default: True] │
│ --taxonomy-url TEXT The URL to the taxonomy service. │
│ This command should be used when the │
│ `REPORT_ID` parameter is provided. │
│ [default: │
│ https://dev.api.agrobiota.biotrop.a… │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────╯
```
Note that the `list` command uses the `--connection-string` parameter to connect
to the Agroportal API. This parameter can be omitted if the
`AGB_CONNECTION_STRING` environment variable is set.
The `list` command also has a `REPORT_ID` parameter. This parameter is used to
specify the report ID to be viewed. If this parameter is not provided, the
command will print the bioindex details as a simple list of tables included in
the results, or if the parameter `--save-to-file` is provided, the command will
save the bioindex details to a file.
Note also the `--stdout-json`, `--resolve-taxonomies` and `--taxonomy-url`
options. They are used to resolve the taxonomies of the results, when the
`REPORT_ID` parameter is provided.
The `--resolve-taxonomies` option is used to resolve the taxonomies of the
results, when the `REPORT_ID` parameter is provided. The `--taxonomy-url` option
is used to specify the URL to the taxonomy service.
---
The AGROBIOTA SDK CLI can be used to convert data between formats and perform
other tasks. To do this, run the following command:
```bash
$ agb-sdk convert bioindex-to-tabular --help
Usage: agb-sdk convert bioindex-to-tabular [OPTIONS] INPUT_PATH OUTPUT_PATH
╭─ Options ────────────────────────────────────────────────────────────────╮
│ --resolve-taxonomies If true, the taxonomies will be resolved │
│ from the taxonomy service. Otherwise the │
│ TaxID values will be used as is. This │
│ command should be used when the │
│ `REPORT_ID` parameter is provided. │
│ [default: True] │
│ --taxonomy-url TEXT The URL to the taxonomy service. This │
│ command should be used when the │
│ `REPORT_ID` parameter is provided. │
│ [default: │
│ https://dev.api.agrobiota.biotrop.agr.br/… │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────╯
```
The `bioindex-to-tabular` command converts a bioindex to a tabular format. The
input is a JSON file with the bioindex data and the output is an Excel file with
the converted data.
### Python
The AGROBIOTA SDK can also be used as a Python library. To do this, import the
SDK and use the available functions.
```python
from agb_sdk.core.use_cases import convert_bioindex_to_tabular
(
info_data_frame,
by_sample_data_frame,
by_dimension_data_frame,
by_process_data_frame,
diversity_data_frame,
community_composition_data_frame,
) = await convert_bioindex_to_tabular(
input_path="input.json",
output_path="output.xlsx",
resolve_taxonomies=True,
)
```
Note that the `convert_bioindex_to_tabular` function is asynchronous, then, you
need to use the `await` keyword to call it. The function outputs six DataFrames
with the converted data, which can be used as needed. The content of the
DataFrames is the same as the one returned by the CLI command, but into a
Pythonic format.
> [!IMPORTANT]
> The library is constantly evolving and new features are being added. If you
> have any suggestions or feedback, please open an
> [issue](https://github.com/agrobiota/agrobiota-sdk/issues) or contact us
> via email at [bioinfo@biotrop.com.br](mailto:bioinfo@biotrop.com.br).
---
This SDK was tested in Linux. It may work in other operating systems, but this
is not guaranteed. For windows, we recommend using WSL (Windows Subsystem for
Linux).
Raw data
{
"_id": null,
"home_page": "https://github.com/Biotrop/agb-sdk",
"name": "agrobiota-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.12",
"maintainer_email": null,
"keywords": "Bioinformatics, AGROBIOTA, SDK",
"author": "BIOTROP Bioinformatics Team",
"author_email": "bioinfo@biotrop.com.br",
"download_url": null,
"platform": null,
"description": "# AGROBIOTA SDK\n\nThis package contains the code for the Agrobiota Environment.\n\n## Usage\n\nThe AGROBIOTA SDK simplifies the integration and transformation of AGROBIOTA\ndata. It is available for Python 3.12+ and can be installed using pip:\n\n```bash\npython3.12 -m pip install agrobiota-sdk\n```\n\nIt can be used through a CLI or as a Python library.\n\n### CLI\n\nTo discover the available options in the AGROBIOTA SDK CLI, use the `--help`\noption at the root of the project:\n\n```bash\n$ agb-sdk --help\n \n Usage: agb-sdk [OPTIONS] COMMAND [ARGS]... \n \n Agrobiota SDK CLI \n \n\u256d\u2500 Options \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 --version Show the version and exit. \u2502\n\u2502 --help Show this message and exit. \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n\u256d\u2500 Commands \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 analysis Operations over analysis from Agroportal API \u2502\n\u2502 convert Convert data between formats \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n```\n\nAs shown in the example above, the AGROBIOTA SDK CLI has two commands:\n`analysis` and `convert`.\n\nThe `analysis` command allows viewing analyses and bioindex reports. To see the\navailable options, simply run the command with the `--help` option:\n\n```bash\n$ agb-sdk analysis list --help\n \n Usage: agb-sdk analysis list [OPTIONS] [REPORT_ID] \n \n\u256d\u2500 Options \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 --connection-string TEXT The connection string to the \u2502\n\u2502 Agroportal API. \u2502\n\u2502 [env var: AGB_CONNECTION_STRING] \u2502\n\u2502 --term -t TEXT The term to search for in the \u2502\n\u2502 analysis. \u2502\n\u2502 --skip -sk INTEGER The number of records to skip. \u2502\n\u2502 [default: 0] \u2502\n\u2502 --size -s INTEGER The number of records to return. \u2502\n\u2502 [default: 25] \u2502\n\u2502 --save-to-file PATH If provided, the analysis will be \u2502\n\u2502 saved to a file. This option is only \u2502\n\u2502 available when the Biotrop Bioindex \u2502\n\u2502 is provided. \u2502\n\u2502 --stdout-json -j If true, the analysis will be \u2502\n\u2502 printed to the console as JSON. This \u2502\n\u2502 command should be used when the \u2502\n\u2502 `REPORT_ID` parameter is provided. \u2502\n\u2502 --resolve-taxonomies If true, the taxonomies will be \u2502\n\u2502 resolved from the taxonomy service. \u2502\n\u2502 Otherwise the TaxID values will be \u2502\n\u2502 used as is. This command should be \u2502\n\u2502 used when the `REPORT_ID` parameter \u2502\n\u2502 is provided. \u2502\n\u2502 [default: True] \u2502\n\u2502 --taxonomy-url TEXT The URL to the taxonomy service. \u2502\n\u2502 This command should be used when the \u2502\n\u2502 `REPORT_ID` parameter is provided. \u2502\n\u2502 [default: \u2502\n\u2502 https://dev.api.agrobiota.biotrop.a\u2026 \u2502\n\u2502 --help Show this message and exit. \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n```\n\nNote that the `list` command uses the `--connection-string` parameter to connect\nto the Agroportal API. This parameter can be omitted if the\n`AGB_CONNECTION_STRING` environment variable is set.\n\nThe `list` command also has a `REPORT_ID` parameter. This parameter is used to\nspecify the report ID to be viewed. If this parameter is not provided, the\ncommand will print the bioindex details as a simple list of tables included in\nthe results, or if the parameter `--save-to-file` is provided, the command will\nsave the bioindex details to a file.\n\nNote also the `--stdout-json`, `--resolve-taxonomies` and `--taxonomy-url`\noptions. They are used to resolve the taxonomies of the results, when the\n`REPORT_ID` parameter is provided.\n\nThe `--resolve-taxonomies` option is used to resolve the taxonomies of the\nresults, when the `REPORT_ID` parameter is provided. The `--taxonomy-url` option\nis used to specify the URL to the taxonomy service.\n\n---\n\nThe AGROBIOTA SDK CLI can be used to convert data between formats and perform\nother tasks. To do this, run the following command:\n\n```bash\n$ agb-sdk convert bioindex-to-tabular --help\n \n Usage: agb-sdk convert bioindex-to-tabular [OPTIONS] INPUT_PATH OUTPUT_PATH\n \n\u256d\u2500 Options \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 --resolve-taxonomies If true, the taxonomies will be resolved \u2502\n\u2502 from the taxonomy service. Otherwise the \u2502\n\u2502 TaxID values will be used as is. This \u2502\n\u2502 command should be used when the \u2502\n\u2502 `REPORT_ID` parameter is provided. \u2502\n\u2502 [default: True] \u2502\n\u2502 --taxonomy-url TEXT The URL to the taxonomy service. This \u2502\n\u2502 command should be used when the \u2502\n\u2502 `REPORT_ID` parameter is provided. \u2502\n\u2502 [default: \u2502\n\u2502 https://dev.api.agrobiota.biotrop.agr.br/\u2026 \u2502\n\u2502 --help Show this message and exit. \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n```\n\nThe `bioindex-to-tabular` command converts a bioindex to a tabular format. The\ninput is a JSON file with the bioindex data and the output is an Excel file with\nthe converted data.\n\n### Python\n\nThe AGROBIOTA SDK can also be used as a Python library. To do this, import the\nSDK and use the available functions.\n\n```python\nfrom agb_sdk.core.use_cases import convert_bioindex_to_tabular\n\n(\n info_data_frame,\n by_sample_data_frame,\n by_dimension_data_frame,\n by_process_data_frame,\n diversity_data_frame,\n community_composition_data_frame,\n) = await convert_bioindex_to_tabular(\n input_path=\"input.json\",\n output_path=\"output.xlsx\",\n resolve_taxonomies=True,\n)\n```\n\nNote that the `convert_bioindex_to_tabular` function is asynchronous, then, you\nneed to use the `await` keyword to call it. The function outputs six DataFrames\nwith the converted data, which can be used as needed. The content of the\nDataFrames is the same as the one returned by the CLI command, but into a\nPythonic format.\n\n> [!IMPORTANT]\n> The library is constantly evolving and new features are being added. If you\n> have any suggestions or feedback, please open an\n> [issue](https://github.com/agrobiota/agrobiota-sdk/issues) or contact us\n> via email at [bioinfo@biotrop.com.br](mailto:bioinfo@biotrop.com.br).\n\n---\n\nThis SDK was tested in Linux. It may work in other operating systems, but this\nis not guaranteed. For windows, we recommend using WSL (Windows Subsystem for\nLinux).\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "An official SDK library for the AGROBIOTA environment",
"version": "0.1.0a8",
"project_urls": {
"Homepage": "https://github.com/Biotrop/agb-sdk"
},
"split_keywords": [
"bioinformatics",
" agrobiota",
" sdk"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "086dae6fee51550db122dc4b4ed522753cae3aca8f9e7f737ed59665da382efa",
"md5": "0a44732e5b94bf06196c44aed34f061e",
"sha256": "9a16e5c83676047f3da64ea250450207a1cbe29dd0ce12256e1fe1b7ae984daf"
},
"downloads": -1,
"filename": "agrobiota_sdk-0.1.0a8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0a44732e5b94bf06196c44aed34f061e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.12",
"size": 18661,
"upload_time": "2025-08-01T12:21:05",
"upload_time_iso_8601": "2025-08-01T12:21:05.327324Z",
"url": "https://files.pythonhosted.org/packages/08/6d/ae6fee51550db122dc4b4ed522753cae3aca8f9e7f737ed59665da382efa/agrobiota_sdk-0.1.0a8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-01 12:21:05",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Biotrop",
"github_project": "agb-sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "agrobiota-sdk"
}