{
"cells": [
{
"cell_type": "markdown",
"id": "56b2a181",
"metadata": {},
"source": [
"# Use cases"
]
},
{
"cell_type": "markdown",
"id": "82c5eb84",
"metadata": {},
"source": [
"## Itroduction\n",
"\n",
"The pybioum llibrary provides a list of methods to interact with [BioUML](https://www.biouml.org/) server from within python. BioUML is an open source integrated Java platform for analysis of data from omics sciences research and other advanced computational biology, for building the virtual cell and the virtual physiological human. It spans a comprehensive range of capabilities, including access to databases with experimental data, tools for formalized description of biological systems structure and functioning, as well as tools for their visualization, simulation, parametersfitting and analyses."
]
},
{
"cell_type": "markdown",
"id": "4ef2e109",
"metadata": {},
"source": [
"## Getting started"
]
},
{
"cell_type": "markdown",
"id": "c028a58f",
"metadata": {},
"source": [
"### ConnectingtoBioUMLserver\n",
"\n",
"The first thing youneed to do is load thepackage and log into the BioUML server.As an example we will connect to the free public [BioUML server](https://ict.biouml.org)."
]
},
{
"cell_type": "markdown",
"id": "4e63a946",
"metadata": {},
"source": [
"Library instalation throuth pip: \n",
"```bash\n",
"pip install pybiouml\n",
"```"
]
},
{
"cell_type": "markdown",
"id": "8cab15a8",
"metadata": {},
"source": [
"Nex step will be library importing and making a object of your future connaction:"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "6bf2d273",
"metadata": {},
"outputs": [],
"source": [
"from pybiouml import pybiouml\n"
]
},
{
"cell_type": "markdown",
"id": "3915c4c1",
"metadata": {},
"source": [
"After importing library we create an object using PyBiouml class in library:"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "8e3c48da",
"metadata": {},
"outputs": [],
"source": [
"my_work = pybiouml.PyBiouml()\n"
]
},
{
"cell_type": "markdown",
"id": "525703a5",
"metadata": {},
"source": [
"Now we are ready to work. At first, we need to loging into server. It can be done using `login` method of early created class ```my_work```. \n",
"The `login` also accepts `user` and `password`, but we leave them empty in the example above for anonymous login. Alternatively you can install BioUML on your local computer and connect to it in the same way: \n",
"```python\n",
"my_work.login('localhost:8080')\n",
"```\n",
"See [BioUML installation](http://wiki.biouml.org/index.php/BioUML_server_installation) for details on BioUML server installation.\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "683570a0",
"metadata": {},
"outputs": [],
"source": [
"my_work.login(url='https://ict.biouml.org')"
]
},
{
"cell_type": "markdown",
"id": "a40ffd8b",
"metadata": {},
"source": [
"### Querying BioUML repository\n",
"\n",
"The BioUML repository (or simply repository) is the central BioUML data storage place. Basically, all the data you work with in BioUML is stored in the repository. The repository has a hierarchical structure similar to file systems. On the top level the repository consists of several root folders. The most common ones are: \n",
"- `databases` contains preinstalled or user-defined modules. \n",
"- `data` contains user projects and public examples.\n",
"\n",
"The `ls` lists the contents of given folder in repository. The list of databases available in BioUML server:"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "4b2a1297",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" name | \n",
" hasChildren | \n",
" class | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" Biomodels | \n",
" True | \n",
" 0 | \n",
"
\n",
" \n",
" | 1 | \n",
" EnsemblArabidopsisThaliana91 | \n",
" True | \n",
" 1 | \n",
"
\n",
" \n",
" | 2 | \n",
" EnsemblFruitfly91 | \n",
" True | \n",
" 1 | \n",
"
\n",
" \n",
" | 3 | \n",
" EnsemblHuman85_38 | \n",
" True | \n",
" 1 | \n",
"
\n",
" \n",
" | 4 | \n",
" EnsemblMouse81_38 | \n",
" True | \n",
" 1 | \n",
"
\n",
" \n",
" | 5 | \n",
" EnsemblNematoda91 | \n",
" True | \n",
" 1 | \n",
"
\n",
" \n",
" | 6 | \n",
" EnsemblRat91 | \n",
" True | \n",
" 1 | \n",
"
\n",
" \n",
" | 7 | \n",
" EnsemblSaccharomycesCerevisiae91 | \n",
" True | \n",
" 1 | \n",
"
\n",
" \n",
" | 8 | \n",
" EnsemblSchizosaccharomycesPombe91 | \n",
" True | \n",
" 1 | \n",
"
\n",
" \n",
" | 9 | \n",
" EnsemblZebrafish92 | \n",
" True | \n",
" 1 | \n",
"
\n",
" \n",
" | 10 | \n",
" GTRD | \n",
" True | \n",
" 1 | \n",
"
\n",
" \n",
" | 11 | \n",
" HOCOMOCO v11 | \n",
" True | \n",
" 0 | \n",
"
\n",
" \n",
" | 12 | \n",
" PantherDB 14 | \n",
" True | \n",
" 0 | \n",
"
\n",
" \n",
" | 13 | \n",
" Reactome Icons | \n",
" True | \n",
" 2 | \n",
"
\n",
" \n",
" | 14 | \n",
" Reactome63 | \n",
" True | \n",
" 1 | \n",
"
\n",
" \n",
" | 15 | \n",
" Tests SBML 3.3.0 | \n",
" True | \n",
" 0 | \n",
"
\n",
" \n",
" | 16 | \n",
" Tests Stochastic | \n",
" True | \n",
" 0 | \n",
"
\n",
" \n",
" | 17 | \n",
" Virtual Cell | \n",
" True | \n",
" 0 | \n",
"
\n",
" \n",
" | 18 | \n",
" Virtual Human | \n",
" True | \n",
" 0 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" name hasChildren class\n",
"0 Biomodels True 0\n",
"1 EnsemblArabidopsisThaliana91 True 1\n",
"2 EnsemblFruitfly91 True 1\n",
"3 EnsemblHuman85_38 True 1\n",
"4 EnsemblMouse81_38 True 1\n",
"5 EnsemblNematoda91 True 1\n",
"6 EnsemblRat91 True 1\n",
"7 EnsemblSaccharomycesCerevisiae91 True 1\n",
"8 EnsemblSchizosaccharomycesPombe91 True 1\n",
"9 EnsemblZebrafish92 True 1\n",
"10 GTRD True 1\n",
"11 HOCOMOCO v11 True 0\n",
"12 PantherDB 14 True 0\n",
"13 Reactome Icons True 2\n",
"14 Reactome63 True 1\n",
"15 Tests SBML 3.3.0 True 0\n",
"16 Tests Stochastic True 0\n",
"17 Virtual Cell True 0\n",
"18 Virtual Human True 0"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import requests\n",
"my_work.ls('databases')"
]
},
{
"cell_type": "markdown",
"id": "a0d35069",
"metadata": {},
"source": [
"The list of data elements available in BioUML examples folder:"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "cf79d87e",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" name | \n",
" hasChildren | \n",
" class | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" exp_data_1 | \n",
" False | \n",
" 0 | \n",
"
\n",
" \n",
" | 1 | \n",
" exp_data_2 | \n",
" False | \n",
" 0 | \n",
"
\n",
" \n",
" | 2 | \n",
" exp_data_3 | \n",
" False | \n",
" 0 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" name hasChildren class\n",
"0 exp_data_1 False 0\n",
"1 exp_data_2 False 0\n",
"2 exp_data_3 False 0"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_work.ls('data/Examples/Optimization/Data/Experiments')"
]
},
{
"cell_type": "markdown",
"id": "1146803f",
"metadata": {},
"source": [
"The pybiouml `get` method fetches a table from BioUML repository as `pandas.DataFrame`:"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "11f60a24",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" time | \n",
" p43p41 | \n",
" pro8 | \n",
" casp8 | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 0 | \n",
" 0.057725 | \n",
" 59.963164 | \n",
" 0 | \n",
"
\n",
" \n",
" | 1 | \n",
" 10 | \n",
" 0.268144 | \n",
" 57.564637 | \n",
" 0.041075 | \n",
"
\n",
" \n",
" | 2 | \n",
" 20 | \n",
" 4.760481 | \n",
" 58.589814 | \n",
" 0.316117 | \n",
"
\n",
" \n",
" | 3 | \n",
" 30 | \n",
" 8.251935 | \n",
" 59.421561 | \n",
" 1.397356 | \n",
"
\n",
" \n",
" | 4 | \n",
" 45 | \n",
" 16.144483 | \n",
" 48.189751 | \n",
" 3.520371 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" time p43p41 pro8 casp8\n",
"0 0 0.057725 59.963164 0\n",
"1 10 0.268144 57.564637 0.041075\n",
"2 20 4.760481 58.589814 0.316117\n",
"3 30 8.251935 59.421561 1.397356\n",
"4 45 16.144483 48.189751 3.520371"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"exp_1 = my_work.get('data/Examples/Optimization/Data/Experiments/exp_data_1')\n",
"exp_1.head()"
]
},
{
"cell_type": "markdown",
"id": "98f34619",
"metadata": {},
"source": [
"This function allows to fetch not only true BioUML tables,but any data elements which have tabular representation, including profiles, user uploaded tracks and soon. \n",
"To store `pandas.DataFrame` as a table into BioUML repository use `put` method:"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "51e5b0f1",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" time | \n",
" p43p41 | \n",
" pro8 | \n",
" casp8 | \n",
" sum_column | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 0 | \n",
" 0.057725 | \n",
" 59.963164 | \n",
" 0 | \n",
" 59.963164 | \n",
"
\n",
" \n",
" | 1 | \n",
" 10 | \n",
" 0.268144 | \n",
" 57.564637 | \n",
" 0.041075 | \n",
" 57.605712 | \n",
"
\n",
" \n",
" | 2 | \n",
" 20 | \n",
" 4.760481 | \n",
" 58.589814 | \n",
" 0.316117 | \n",
" 58.905930 | \n",
"
\n",
" \n",
" | 3 | \n",
" 30 | \n",
" 8.251935 | \n",
" 59.421561 | \n",
" 1.397356 | \n",
" 60.818917 | \n",
"
\n",
" \n",
" | 4 | \n",
" 45 | \n",
" 16.144483 | \n",
" 48.189751 | \n",
" 3.520371 | \n",
" 51.710122 | \n",
"
\n",
" \n",
" | 5 | \n",
" 60 | \n",
" 17.020606 | \n",
" 38.950266 | \n",
" 3.947229 | \n",
" 42.897495 | \n",
"
\n",
" \n",
" | 6 | \n",
" 90 | \n",
" 15.269292 | \n",
" 23.501692 | \n",
" 4.871417 | \n",
" 28.373108 | \n",
"
\n",
" \n",
" | 7 | \n",
" 120 | \n",
" 12.53013 | \n",
" 13.127419 | \n",
" 4.87786 | \n",
" 18.005280 | \n",
"
\n",
" \n",
" | 8 | \n",
" 150 | \n",
" 10.334704 | \n",
" 10.703102 | \n",
" 4.228311 | \n",
" 14.931413 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" time p43p41 pro8 casp8 sum_column\n",
"0 0 0.057725 59.963164 0 59.963164\n",
"1 10 0.268144 57.564637 0.041075 57.605712\n",
"2 20 4.760481 58.589814 0.316117 58.905930\n",
"3 30 8.251935 59.421561 1.397356 60.818917\n",
"4 45 16.144483 48.189751 3.520371 51.710122\n",
"5 60 17.020606 38.950266 3.947229 42.897495\n",
"6 90 15.269292 23.501692 4.871417 28.373108\n",
"7 120 12.53013 13.127419 4.87786 18.005280\n",
"8 150 10.334704 10.703102 4.228311 14.931413"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"exp_1['sum_column'] = exp_1[['pro8', 'casp8']].sum(axis=1)\n",
"exp_1"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "7dafe3ab",
"metadata": {},
"outputs": [],
"source": [
"my_work.put('data/Collaboration/Demo/Data/pybiouml_test/exp_1_pybiouml', exp_1)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "72c37ae3",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" name | \n",
" hasChildren | \n",
" class | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" exp_1_pybiouml | \n",
" False | \n",
" 0 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" name hasChildren class\n",
"0 exp_1_pybiouml False 0"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_work.ls('data/Collaboration/Demo/Data/pybiouml_test')"
]
},
{
"cell_type": "markdown",
"id": "e420e440",
"metadata": {},
"source": [
"### Using BioUML analyses"
]
},
{
"cell_type": "markdown",
"id": "b6f3e919",
"metadata": {},
"source": [
"BioUML provides a set of analyses organized in groups.The list of analyses available in the currents server can be fetched with `analysis_list` method."
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "b57fd075",
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Group | \n",
" Name | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" ChIP-seq | \n",
" ChIP-seq Quality control analysis | \n",
"
\n",
" \n",
" | 1 | \n",
" ChIP-seq | \n",
" ChIP-seq peak profile | \n",
"
\n",
" \n",
" | 2 | \n",
" ChIP-seq | \n",
" Quality control analysis | \n",
"
\n",
" \n",
" | 3 | \n",
" ChIP-seq | \n",
" Report generator for quality control analysis | \n",
"
\n",
" \n",
" | 4 | \n",
" ChIP-seq | \n",
" Run MACS 1_3_7 on ChiP-Seq | \n",
"
\n",
" \n",
" | ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" | 229 | \n",
" Workflow utils | \n",
" Check Workflow consistency | \n",
"
\n",
" \n",
" | 230 | \n",
" Workflow utils | \n",
" Copy data element | \n",
"
\n",
" \n",
" | 231 | \n",
" Workflow utils | \n",
" Copy folder | \n",
"
\n",
" \n",
" | 232 | \n",
" Workflow utils | \n",
" Create folder | \n",
"
\n",
" \n",
" | 233 | \n",
" Workflow utils | \n",
" Run a Workflow as Analysis | \n",
"
\n",
" \n",
"
\n",
"
234 rows × 2 columns
\n",
"
"
],
"text/plain": [
" Group Name\n",
"0 ChIP-seq ChIP-seq Quality control analysis\n",
"1 ChIP-seq ChIP-seq peak profile\n",
"2 ChIP-seq Quality control analysis\n",
"3 ChIP-seq Report generator for quality control analysis\n",
"4 ChIP-seq Run MACS 1_3_7 on ChiP-Seq\n",
".. ... ...\n",
"229 Workflow utils Check Workflow consistency\n",
"230 Workflow utils Copy data element\n",
"231 Workflow utils Copy folder\n",
"232 Workflow utils Create folder\n",
"233 Workflow utils Run a Workflow as Analysis\n",
"\n",
"[234 rows x 2 columns]"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a_l = my_work.analysis_list()\n",
"a_l"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "ae493e80",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array(['ChIP-seq', 'Composite module analyses',\n",
" 'Differential algebraic equations', 'GATK', 'GTRD',\n",
" 'Gene set analysis', 'Import', 'Match sites and genes', 'MicroRNA',\n",
" 'Molecular networks', 'Motif discovery', 'Mutations',\n",
" 'NGS alignment', 'NGS color-space', 'NGS utils',\n",
" 'Operations with genomic tracks', 'Parameter fitting',\n",
" 'Plots and charts', 'RNA-seq', 'Statistics',\n",
" 'TF binding site search', 'Table manipulation', 'Workflow utils'],\n",
" dtype=object)"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a_l['Group'].unique()"
]
},
{
"cell_type": "code",
"execution_count": 47,
"id": "6cc57f36",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Group | \n",
" Name | \n",
"
\n",
" \n",
" \n",
" \n",
" | 213 | \n",
" Table manipulation | \n",
" Add calculated column | \n",
"
\n",
" \n",
" | 214 | \n",
" Table manipulation | \n",
" Annotate table | \n",
"
\n",
" \n",
" | 215 | \n",
" Table manipulation | \n",
" Convert table | \n",
"
\n",
" \n",
" | 216 | \n",
" Table manipulation | \n",
" Convert table via homology | \n",
"
\n",
" \n",
" | 217 | \n",
" Table manipulation | \n",
" Filter duplicate rows | \n",
"
\n",
" \n",
" | 218 | \n",
" Table manipulation | \n",
" Filter table | \n",
"
\n",
" \n",
" | 219 | \n",
" Table manipulation | \n",
" Group table rows | \n",
"
\n",
" \n",
" | 220 | \n",
" Table manipulation | \n",
" Join several tables | \n",
"
\n",
" \n",
" | 221 | \n",
" Table manipulation | \n",
" Join two tables | \n",
"
\n",
" \n",
" | 222 | \n",
" Table manipulation | \n",
" Merge table columns | \n",
"
\n",
" \n",
" | 223 | \n",
" Table manipulation | \n",
" Select random rows | \n",
"
\n",
" \n",
" | 224 | \n",
" Table manipulation | \n",
" Select table columns | \n",
"
\n",
" \n",
" | 225 | \n",
" Table manipulation | \n",
" Select top rows | \n",
"
\n",
" \n",
" | 226 | \n",
" Table manipulation | \n",
" Super annotate table | \n",
"
\n",
" \n",
" | 227 | \n",
" Table manipulation | \n",
" Transform table | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Group Name\n",
"213 Table manipulation Add calculated column\n",
"214 Table manipulation Annotate table\n",
"215 Table manipulation Convert table\n",
"216 Table manipulation Convert table via homology\n",
"217 Table manipulation Filter duplicate rows\n",
"218 Table manipulation Filter table\n",
"219 Table manipulation Group table rows\n",
"220 Table manipulation Join several tables\n",
"221 Table manipulation Join two tables\n",
"222 Table manipulation Merge table columns\n",
"223 Table manipulation Select random rows\n",
"224 Table manipulation Select table columns\n",
"225 Table manipulation Select top rows\n",
"226 Table manipulation Super annotate table\n",
"227 Table manipulation Transform table"
]
},
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a_l[a_l['Group'] == 'Table manipulation']"
]
},
{
"cell_type": "markdown",
"id": "b9aa1160",
"metadata": {},
"source": [
"Each biouml analysis has a set of parameters, `analysis_parameters` returns a `pandas.DataFrame` with row names corresponding to parameter names and one column 'description'."
]
},
{
"cell_type": "code",
"execution_count": 49,
"id": "12382e39",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Name | \n",
" Description | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" inputPath | \n",
" Table to filter | \n",
"
\n",
" \n",
" | 1 | \n",
" filterExpression | \n",
" Expression in JavaScript like 'ColumnName1 > 5... | \n",
"
\n",
" \n",
" | 2 | \n",
" filteringMode | \n",
" Which rows to select | \n",
"
\n",
" \n",
" | 3 | \n",
" outputPath | \n",
" Path to the filtered table | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Name Description\n",
"0 inputPath Table to filter\n",
"1 filterExpression Expression in JavaScript like 'ColumnName1 > 5...\n",
"2 filteringMode Which rows to select\n",
"3 outputPath Path to the filtered table"
]
},
"execution_count": 49,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_work.analysis_parameters('Filter table')"
]
},
{
"cell_type": "markdown",
"id": "64fc1ef4",
"metadata": {},
"source": [
"The `analysis` method launches analysis with given parameters."
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "d07ea984",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"INFO - Analysis 'Filter table' added to queue\n",
"INFO - Analysis 'Filter table' started\n",
"INFO - Filtering...\n",
"\n",
"\n",
"\n",
"INFO - Writing result...\n",
"\n",
"INFO - Analysis 'Filter table' finished (3.968 s)\n",
"\n",
"RJOB202202131652562\n"
]
}
],
"source": [
"my_work.analysis('Filter table', \n",
" parameters={\n",
" 'inputPath': 'data/Examples/Optimization/Data/Experiments/exp_data_1', \n",
" 'filterExpression': 'time < 40',\n",
" 'outputPath': 'data/Collaboration/Demo/Data/pybiouml_test/exp_data_1 filtered'\n",
" }\n",
" )"
]
},
{
"cell_type": "markdown",
"id": "ee0b5924",
"metadata": {},
"source": [
"### Importing files to and from BioUML\n",
"As described previously, `pandas.DataFrame` can be fetched from and stored to BioUML repository using pybiouml `get` and `put` methods. In addition, data can be imported from files and exported to files in various formats. The list of importers can be obtained with `importers` method."
]
},
{
"cell_type": "code",
"execution_count": 58,
"id": "2d4051ae",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['BioUML format(*.dml)',\n",
" 'BioUML Simulation result',\n",
" 'ZIP-archive (*.zip)',\n",
" 'Generic file',\n",
" 'Image file (*.png, *jpeg, *.gif etc)',\n",
" 'Text file (*.txt)',\n",
" 'HTML file (*.html, *.htm)',\n",
" 'SBML',\n",
" 'SBML(CellDesigner)',\n",
" 'BioPAX file (*.owl, *.xml)']"
]
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_work.importers()[:10]"
]
},
{
"cell_type": "markdown",
"id": "8f866966",
"metadata": {},
"source": [
"As an example we will import fasta file to BioUML. This fasta file can be downloaded from our [github](https://github.com/Biosoft-ru/pybiouml)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "7c034264",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"\n",
"data/Collaboration/Demo/Data/pybiouml_test/hiv1\n"
]
},
{
"data": {
"text/plain": [
"'data/Collaboration/Demo/Data/pybiouml_test/hiv1'"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fasta = 'hiv1.fna'\n",
"out = 'data/Collaboration/Demo/Data/pybiouml_test'\n",
"my_work.to_import(fasta, out, importer='Fasta format (*.fasta)')\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "bf4b5254",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" name | \n",
" hasChildren | \n",
" class | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" exp_1_pybiouml | \n",
" False | \n",
" 0 | \n",
"
\n",
" \n",
" | 1 | \n",
" exp_data_1 filtered | \n",
" False | \n",
" 0 | \n",
"
\n",
" \n",
" | 2 | \n",
" hiv1 | \n",
" True | \n",
" 1 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" name hasChildren class\n",
"0 exp_1_pybiouml False 0\n",
"1 exp_data_1 filtered False 0\n",
"2 hiv1 True 1"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_work.ls(out)"
]
},
{
"cell_type": "markdown",
"id": "3ed9396b",
"metadata": {},
"source": [
"Similarly, we can use `export` method to export data from BioUML repository."
]
},
{
"cell_type": "code",
"execution_count": 22,
"id": "4613cba6",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['JPEG file (*.jpg)',\n",
" 'Bitmap file(*.bmp)',\n",
" 'Portable Network Graphics (*.png)',\n",
" 'BioUML format(*.dml)',\n",
" 'BioUML state (*.xml)',\n",
" 'Pair graph file(*.txt)',\n",
" 'Archive containing exported elements (*.zip)',\n",
" 'Generic file',\n",
" 'Zipped HTML file',\n",
" 'SBML',\n",
" 'BioPAX (*.owl)',\n",
" 'FASTA sequences (*.fasta)',\n",
" 'BED format (*.bed)',\n",
" 'Interval format (*.interval)',\n",
" 'General Feature Format (*.gff)',\n",
" 'Gene Transfer Format (*.gtf)',\n",
" 'Match format (*.match)',\n",
" 'Variant Call Format (*.vcf)',\n",
" 'Wiggle format (*.wig)',\n",
" 'SAM or BAM alignment file (*.sam, *.bam)',\n",
" 'ZHTML document (*.zhtml)',\n",
" 'SDF file (*.sdf)',\n",
" 'GraphML(*.graphml)',\n",
" 'Scalable Vector Graphics(*.svg)',\n",
" 'SBGN-ML',\n",
" 'COMBINE archive (*.omex)',\n",
" 'BioNetGen language format (*.bngl)',\n",
" 'Cytoscape (*.cx)',\n",
" 'Antimony',\n",
" 'Tab-separated text (*.txt)',\n",
" 'Comma-separated values (*.csv)',\n",
" 'HTML document (*.html)']"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_work.exporters()"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "0e009a9e",
"metadata": {},
"outputs": [],
"source": [
"my_work.export('data/Collaboration/Demo/Data/pybiouml_test/hiv1.fa', \n",
" exporter='Fasta format (*.fasta)', \n",
" target_file='downloaded_hiv1.fa'\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "64b900ae",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['.ipynb_checkpoints', 'downloaded_hiv1.fa', 'hiv1.fna', 'Use_cases.ipynb']"
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import os\n",
"os.listdir()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "91990430",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "test_biouml",
"language": "python",
"name": "test_biouml"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}