{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "initial_id", "metadata": { "ExecuteTime": { "end_time": "2026-01-22T10:32:54.760793Z", "start_time": "2026-01-22T10:32:51.598659Z" } }, "outputs": [], "source": [ "import pandas as pd\n", "import tempfile\n", "import atexit\n", "from pathlib import Path\n", "\n", "import urgap\n", "\n", "\n", "tmp_dir_obj = tempfile.TemporaryDirectory()\n", "tmp_dir = Path(tmp_dir_obj.name)\n", "\n", "atexit.register(tmp_dir_obj.cleanup)\n", "\n", "print(f\"Temp directory: {tmp_dir}\")" ] }, { "cell_type": "code", "execution_count": null, "id": "4ef2bf6d34e62595", "metadata": { "ExecuteTime": { "end_time": "2026-01-22T10:48:51.000110Z", "start_time": "2026-01-22T10:48:50.997793Z" } }, "outputs": [], "source": [ "notebook_dir = Path.cwd()\n", "test_data_dir = notebook_dir.parent.parent / \"tests\" / \"data\"" ] }, { "cell_type": "code", "execution_count": null, "id": "c6c171ddcdc2aec7", "metadata": { "ExecuteTime": { "end_time": "2026-01-22T10:49:08.147245Z", "start_time": "2026-01-22T10:49:08.138685Z" } }, "outputs": [], "source": [ "ufiles = urgap.UFileList(\n", " [\n", " urgap.UFile(\n", " uri=f\"file://{test_data_dir}?uftype={urgap.uftypes.any.CSV}\"\n", " f\"#unified_csvs/BSA1_xtandem_alanine_unified.csv\",\n", " ),\n", " ],\n", ")\n", "print(ufiles)" ] }, { "cell_type": "code", "execution_count": null, "id": "d65f0fc0fac9c3ba", "metadata": { "ExecuteTime": { "end_time": "2026-01-22T10:49:11.374309Z", "start_time": "2026-01-22T10:49:11.371454Z" } }, "outputs": [], "source": [ "urun_dict = urgap.URunDict(\n", " {\n", " \"parameters\": {\n", " \"FilterTabularToCSV:1.0.0\": {\n", " \"-q\": \"500 < `exp_mz` < 1000\",\n", " },\n", " \"CompressToTar:1.0.0\": {},\n", " },\n", " \"unode_parameters\": {\n", " \"storage_base_uri\": f\"file://{tmp_dir}\",\n", " },\n", " },\n", ")\n", "print(urun_dict)" ] }, { "cell_type": "code", "execution_count": null, "id": "4f4d369f8052e676", "metadata": { "ExecuteTime": { "end_time": "2026-01-22T10:49:13.138704Z", "start_time": "2026-01-22T10:49:13.128446Z" } }, "outputs": [], "source": [ "filter_node = urgap.init_unode(\"FilterTabularToCSV:1.0.0\")" ] }, { "cell_type": "code", "execution_count": null, "id": "e010a2826315407a", "metadata": { "ExecuteTime": { "end_time": "2026-01-22T10:49:15.533851Z", "start_time": "2026-01-22T10:49:14.580485Z" } }, "outputs": [], "source": [ "filter_results = filter_node.run(urun_dict=urun_dict, ufiles=ufiles)\n", "print(filter_results)" ] }, { "cell_type": "code", "execution_count": null, "id": "307ee4ed67723d3d", "metadata": { "ExecuteTime": { "end_time": "2026-01-22T10:49:29.573440Z", "start_time": "2026-01-22T10:49:29.562141Z" } }, "outputs": [], "source": [ "df = pd.read_csv(filter_results[0].path)\n", "print(df)" ] }, { "cell_type": "code", "execution_count": null, "id": "8f3f52de7d04bf3e", "metadata": { "ExecuteTime": { "end_time": "2026-01-22T10:49:30.839560Z", "start_time": "2026-01-22T10:49:30.833066Z" } }, "outputs": [], "source": [ "compress_node = urgap.init_unode(\"CompressToTar:1.0.0\")" ] }, { "cell_type": "code", "execution_count": null, "id": "3a2d461fb5812a5b", "metadata": { "ExecuteTime": { "end_time": "2026-01-22T10:49:32.458858Z", "start_time": "2026-01-22T10:49:32.327011Z" } }, "outputs": [], "source": [ "compress_results = compress_node.run(urun_dict=urun_dict, ufiles=filter_results)\n", "print(compress_results)" ] }, { "cell_type": "code", "execution_count": null, "id": "8e3f385ee462aecc", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "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.13.2" } }, "nbformat": 4, "nbformat_minor": 5 }