diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml deleted file mode 100644 index 6c5f85e..0000000 --- a/.github/workflows/python-publish.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Upload Python Package - -on: - release: - types: [created] - -jobs: - deploy: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Update version - run: | - cd ./excel2flapjack - sed -i "s/version=.*,/version='${{ github.event.release.tag_name }}',/g" setup.py - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - cd ./excel2flapjack - cat setup.py - python setup.py sdist bdist_wheel - twine upload dist/* diff --git a/.gitignore b/.gitignore deleted file mode 100644 index b6e4761..0000000 --- a/.gitignore +++ /dev/null @@ -1,129 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -pip-wheel-metadata/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -.python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ diff --git a/README.md b/README.md deleted file mode 100644 index 7b4b88e..0000000 --- a/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# Experimental Data Converter - -The Experimental Data Converter (XDC) is a software tool for experimental data standardization using Excel, Flapjack and SynBioHub. The XDC provides researchers with an Excel standard to capture both experimental results and contextual metadata, which are then converted to a uniform data representation for the SBOL standard and Flapjack’s data model. Through SBOL, users of XDC can store experimental results with all initial sequence, part and metadata information, as well as retrieve and share with others, improving reproducibility and collaboration. - -## Installation - -## Documentation - -## Tutorials - diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 49c9717..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -pyflapjack==1.0.5 -pandas==1.3.3 -openpyxl==3.0.9 \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index b875bfc..0000000 --- a/setup.py +++ /dev/null @@ -1,27 +0,0 @@ -from setuptools import find_packages, setup - -setup(name='excel2flapjack', - version='1.0.5', - url='https://github.com/SynBioDex/Experimental-Data-Converter/', - license='BSD 3-clause', - include_package_data=True, - description='upload excel resources to flapjack', - packages=find_packages(where="src"), - package_dir={"":"src"}, - long_description=open('README.md').read(), - install_requires=['pyflapjack>=1.0.5', - 'numpy>=1.21.2', - 'scipy>=1.8.0', - 'pandas>=1.3.3', - 'requests>=2.26.0', - 'tqdm>=4.62.3', - 'plotly>=5.3.1', - 'asyncio>=3.4.3', - 'nest_asyncio>=1.5.1', - 'requests_jwt>=0.5.3', - 'websockets>=10.0', - 'matplotlib>=3.4.3', - 'kaleido>=0.2.1', - 'openpyxl>=3.0.9' - ], - zip_safe=False) diff --git a/src/.DS_Store b/src/.DS_Store deleted file mode 100644 index fe2f527..0000000 Binary files a/src/.DS_Store and /dev/null differ diff --git a/src/README.md b/src/README.md deleted file mode 100644 index f311cb6..0000000 --- a/src/README.md +++ /dev/null @@ -1 +0,0 @@ -This library is a collection of functions used to upload data to Flapjack from an Excel template. \ No newline at end of file diff --git a/src/excel2flapjack/__init__.py b/src/excel2flapjack/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/excel2flapjack/e2f_oop.ipynb b/src/excel2flapjack/e2f_oop.ipynb deleted file mode 100644 index 4037ca0..0000000 --- a/src/excel2flapjack/e2f_oop.ipynb +++ /dev/null @@ -1,2060 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 48, - "metadata": {}, - "outputs": [], - "source": [ - "import os\n", - "import pandas as pd\n", - "from flapjack import Flapjack\n", - "import mainNew" - ] - }, - { - "cell_type": "code", - "execution_count": 119, - "metadata": {}, - "outputs": [], - "source": [ - "import importlib\n", - "importlib.reload(mainNew)\n", - "from mainNew import X2F" - ] - }, - { - "cell_type": "code", - "execution_count": 50, - "metadata": {}, - "outputs": [], - "source": [ - "fj_url = \"localhost:8000\" #local\n", - "# fj_url = \"flapjack.rudge-lab.org:8000\" #Web Instance Rudge Lab\n", - "#fj_url = \"198.59.83.73:8000\" #Web Instance Genetic Logic Lab\n", - "fj_user = \"dylan33smith\"\n", - "fj_pass = \"coco33\"\n", - "\n", - "# updated xcel file is in test/test_files\n", - "test_file_path = '../../tests/test_files'\n", - "# real file path ------\n", - "# excel_path = os.path.join(test_file_path, \"flapjack_excel_converter_revamp.xlsx\")\n", - "# testing file path ------\n", - " # XDC spreadsheet with Test tagged onto names for testing clarity\n", - "excel_path = os.path.join(test_file_path, \"xdc_test.xlsx\")" - ] - }, - { - "cell_type": "code", - "execution_count": 51, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "../../tests/test_files\\xdc_test.xlsx\n" - ] - } - ], - "source": [ - "print(excel_path)" - ] - }, - { - "cell_type": "code", - "execution_count": 52, - "metadata": {}, - "outputs": [], - "source": [ - "# block to test output of fj login for testing assertions\n", - "# fj = Flapjack(url_base=fj_url) #Local Instance\n", - "# fj.log_in(username=fj_user, password=fj_pass)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 53, - "metadata": {}, - "outputs": [], - "source": [ - "xls = pd.ExcelFile(excel_path)" - ] - }, - { - "cell_type": "code", - "execution_count": 120, - "metadata": {}, - "outputs": [], - "source": [ - "test_case = X2F(xls, fj_url, fj_user, fj_pass)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Upload Individually\n", - "uploading all at once is below\n", - "\n", - "X2F function to print out relevant information\n", - "- test_case.print_info(fj_sht = True, df=True, hash_map=True)" - ] - }, - { - "cell_type": "code", - "execution_count": 114, - "metadata": {}, - "outputs": [], - "source": [ - "test_case.create_df()" - ] - }, - { - "cell_type": "code", - "execution_count": 115, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Returning exististing model, study\n", - "\n", - "id 7\n", - "is_owner True\n", - "shared_with []\n", - "name e2f testing\n", - "description testing for e2f upload\n", - "doi https://doi.org/thisisatest\n", - "sboluri \n", - "public False\n" - ] - } - ], - "source": [ - "test_case.upload_studies()" - ] - }, - { - "cell_type": "code", - "execution_count": 57, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Returning exististing model, study\n", - " id is_owner shared_with name description \\\n", - "0 3 True [] e2f testing testing for e2f upload \n", - "\n", - " doi sboluri public \n", - "0 https://doi.org/thisisatest False \n", - "Returning exististing model, signal\n", - "Returning exististing model, signal\n", - "Returning exististing model, chemical\n", - "Returning exististing model, chemical\n", - "Returning exististing model, dna\n", - "Returning exististing model, dna\n", - "Returning exististing model, dna\n", - "Returning exististing model, media\n", - "Returning exististing model, strain\n", - "Returning exististing model, supplement\n", - "Returning exististing model, supplement\n", - "Returning exististing model, vector\n", - "Returning exististing model, vector\n", - "Returning exististing model, assay\n", - "Returning exististing model, assay\n", - "Returning exististing model, sample\n", - "Returning exististing model, sample\n", - "Returning exististing model, sample\n", - "Returning exististing model, sample\n" - ] - } - ], - "source": [ - "test_case.upload_studies()\n", - "test_case.upload_signals()\n", - "test_case.upload_chemicals()\n", - "test_case.upload_dna()\n", - "test_case.upload_medias()\n", - "test_case.upload_strains()\n", - "test_case.upload_supplements()\n", - "test_case.upload_vectors()\n", - "test_case.upload_assays()\n", - "test_case.upload_samples()" - ] - }, - { - "cell_type": "code", - "execution_count": 37, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "--- name ---\n", - "TestChemical1 TestATC\n", - "TestChemical2 TestIPTG\n", - "TestDNA1 Test_Rep_HIGH_degrate\n", - "TestDNA2 Test_Rep_LOW_degrate\n", - "TestDNA3 Test_Reporter\n", - "TestSupplement1 TestATC\n", - "TestSupplement2 TestIPTG\n", - "Test_Rep_HIGH_degrate_plasmid Test for Repressilator Low Degradation\n", - "Test_Rep_LOW_degrate_plasmid Test for Repressilator High Degradation\n", - "TestEcoli TestEcoli\n", - "TestGlucose TestGlucose\n", - "TestSignalB TestBiomass\n", - "TestSignalA TestGFP\n", - "TestStudy e2f testing\n", - "TestAssay1 Test Plate 1\n", - "TestAssay2 Test Plate 2\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: name, dtype: object\n", - "\n", - "--- description ---\n", - "TestChemical1 TestATCInducer\n", - "TestChemical2 TestIPTGInducer\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli TestEcoli\n", - "TestGlucose testing: induction\n", - "TestSignalB Testing for biomass\n", - "TestSignalA Testing for fluorescence\n", - "TestStudy testing for e2f upload\n", - "TestAssay1 Test Plate 1\n", - "TestAssay2 Test Plate 2\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: description, dtype: object\n", - "\n", - "--- pubchemid ---\n", - "TestChemical1 Test pubchem1\n", - "TestChemical2 Test pubchem2\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: pubchemid, dtype: object\n", - "\n", - "--- object ---\n", - "TestChemical1 Chemical\n", - "TestChemical2 Chemical\n", - "TestDNA1 DNA\n", - "TestDNA2 DNA\n", - "TestDNA3 DNA\n", - "TestSupplement1 Supplement\n", - "TestSupplement2 Supplement\n", - "Test_Rep_HIGH_degrate_plasmid Vector\n", - "Test_Rep_LOW_degrate_plasmid Vector\n", - "TestEcoli Strain\n", - "TestGlucose Media\n", - "TestSignalB Signal\n", - "TestSignalA Signal\n", - "TestStudy Study\n", - "TestAssay1 Assay\n", - "TestAssay2 Assay\n", - "TestSample1 Sample\n", - "TestSample2 Sample\n", - "TestSample3 Sample\n", - "TestSample4 Sample\n", - "TestMeasurement0 Measurement\n", - "TestMeasurement1 Measurement\n", - "TestMeasurement2 Measurement\n", - "TestSampleDesign1 Sample Design\n", - "TestSampleDesign2 Sample Design\n", - "Name: object, dtype: object\n", - "\n", - "--- flapjackid ---\n", - "TestChemical1 3\n", - "TestChemical2 4\n", - "TestDNA1 4\n", - "TestDNA2 5\n", - "TestDNA3 6\n", - "TestSupplement1 3\n", - "TestSupplement2 4\n", - "Test_Rep_HIGH_degrate_plasmid 3\n", - "Test_Rep_LOW_degrate_plasmid 4\n", - "TestEcoli 2\n", - "TestGlucose 2\n", - "TestSignalB 4\n", - "TestSignalA 5\n", - "TestStudy 3\n", - "TestAssay1 5\n", - "TestAssay2 6\n", - "TestSample1 5\n", - "TestSample2 6\n", - "TestSample3 5\n", - "TestSample4 6\n", - "TestMeasurement0 \n", - "TestMeasurement1 \n", - "TestMeasurement2 \n", - "TestSampleDesign1 \n", - "TestSampleDesign2 \n", - "Name: flapjackid, dtype: object\n", - "\n", - "--- chemical ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 TestChemical1\n", - "TestSupplement2 TestChemical2\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: chemical, dtype: object\n", - "\n", - "--- concentration ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 100.0\n", - "TestSupplement2 100.0\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: concentration, dtype: float64\n", - "\n", - "--- dna ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid TestDNA1\n", - "Test_Rep_LOW_degrate_plasmid TestDNA2\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: dna, dtype: object\n", - "\n", - "--- color ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB TestBlack\n", - "TestSignalA TestGreen\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: color, dtype: object\n", - "\n", - "--- DOI ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy https://doi.org/thisisatest\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: DOI, dtype: object\n", - "\n", - "--- machine ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 Test Machine\n", - "TestAssay2 Test Machine\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: machine, dtype: object\n", - "\n", - "--- temperature ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 0.0\n", - "TestAssay2 0.0\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: temperature, dtype: float64\n", - "\n", - "--- study ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 TestStudy\n", - "TestAssay2 TestStudy\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: study, dtype: object\n", - "\n", - "--- row ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 1.0\n", - "TestSample2 1.0\n", - "TestSample3 1.0\n", - "TestSample4 1.0\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: row, dtype: float64\n", - "\n", - "--- col ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 1.0\n", - "TestSample2 2.0\n", - "TestSample3 1.0\n", - "TestSample4 2.0\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: col, dtype: float64\n", - "\n", - "--- assay ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 TestAssay1\n", - "TestSample2 TestAssay2\n", - "TestSample3 TestAssay1\n", - "TestSample4 TestAssay2\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: assay, dtype: object\n", - "\n", - "--- sampledesign ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 TestSampleDesign1\n", - "TestSample2 TestSampleDesign2\n", - "TestSample3 TestSampleDesign1\n", - "TestSample4 TestSampleDesign2\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: sampledesign, dtype: object\n", - "\n", - "--- sample ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 TestSample1\n", - "TestMeasurement1 TestSample1\n", - "TestMeasurement2 TestSample1\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: sample, dtype: object\n", - "\n", - "--- signal ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 TestSignalA\n", - "TestMeasurement1 TestSignalB\n", - "TestMeasurement2 TestSignalA\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: signal, dtype: object\n", - "\n", - "--- time ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 0.00\n", - "TestMeasurement1 0.00\n", - "TestMeasurement2 0.25\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: time, dtype: float64\n", - "\n", - "--- value ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 0.0\n", - "TestMeasurement1 100.0\n", - "TestMeasurement2 50.0\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: value, dtype: float64\n", - "\n", - "--- media ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 TestGlucose\n", - "TestSampleDesign2 TestGlucose\n", - "Name: media, dtype: object\n", - "\n", - "--- strain ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 TestEcoli\n", - "TestSampleDesign2 TestEcoli\n", - "Name: strain, dtype: object\n", - "\n", - "--- vector ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 Test_Rep_LOW_degrate_plasmid\n", - "TestSampleDesign2 Test_Rep_HIGH_degrate_plasmid\n", - "Name: vector, dtype: object\n", - "\n", - "--- supplement ---\n", - "TestChemical1 NaN\n", - "TestChemical2 NaN\n", - "TestDNA1 NaN\n", - "TestDNA2 NaN\n", - "TestDNA3 NaN\n", - "TestSupplement1 NaN\n", - "TestSupplement2 NaN\n", - "Test_Rep_HIGH_degrate_plasmid NaN\n", - "Test_Rep_LOW_degrate_plasmid NaN\n", - "TestEcoli NaN\n", - "TestGlucose NaN\n", - "TestSignalB NaN\n", - "TestSignalA NaN\n", - "TestStudy NaN\n", - "TestAssay1 NaN\n", - "TestAssay2 NaN\n", - "TestSample1 NaN\n", - "TestSample2 NaN\n", - "TestSample3 NaN\n", - "TestSample4 NaN\n", - "TestMeasurement0 NaN\n", - "TestMeasurement1 NaN\n", - "TestMeasurement2 NaN\n", - "TestSampleDesign1 NaN\n", - "TestSampleDesign2 NaN\n", - "Name: supplement, dtype: float64\n", - "\n" - ] - } - ], - "source": [ - "# print each column\n", - "for i in test_case.df:\n", - " print(\"---\", i, \"---\")\n", - " print(test_case.df[i])\n", - " print()" - ] - }, - { - "cell_type": "code", - "execution_count": 40, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "-------\n", - "TestChemical1\n", - "name TestATC\n", - "description TestATCInducer\n", - "pubchemid Test pubchem1\n", - "object Chemical\n", - "flapjackid 3\n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestChemical1, dtype: object\n", - "\n", - "-------\n", - "TestChemical2\n", - "name TestIPTG\n", - "description TestIPTGInducer\n", - "pubchemid Test pubchem2\n", - "object Chemical\n", - "flapjackid 4\n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestChemical2, dtype: object\n", - "\n", - "-------\n", - "TestDNA1\n", - "name Test_Rep_HIGH_degrate\n", - "description NaN\n", - "pubchemid NaN\n", - "object DNA\n", - "flapjackid 4\n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestDNA1, dtype: object\n", - "\n", - "-------\n", - "TestDNA2\n", - "name Test_Rep_LOW_degrate\n", - "description NaN\n", - "pubchemid NaN\n", - "object DNA\n", - "flapjackid 5\n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestDNA2, dtype: object\n", - "\n", - "-------\n", - "TestDNA3\n", - "name Test_Reporter\n", - "description NaN\n", - "pubchemid NaN\n", - "object DNA\n", - "flapjackid 6\n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestDNA3, dtype: object\n", - "\n", - "-------\n", - "TestSupplement1\n", - "name TestATC\n", - "description NaN\n", - "pubchemid NaN\n", - "object Supplement\n", - "flapjackid 3\n", - "chemical TestChemical1\n", - "concentration 100.0\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestSupplement1, dtype: object\n", - "\n", - "-------\n", - "TestSupplement2\n", - "name TestIPTG\n", - "description NaN\n", - "pubchemid NaN\n", - "object Supplement\n", - "flapjackid 4\n", - "chemical TestChemical2\n", - "concentration 100.0\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestSupplement2, dtype: object\n", - "\n", - "-------\n", - "Test_Rep_HIGH_degrate_plasmid\n", - "name Test for Repressilator Low Degradation\n", - "description NaN\n", - "pubchemid NaN\n", - "object Vector\n", - "flapjackid 3\n", - "chemical NaN\n", - "concentration NaN\n", - "dna TestDNA1\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: Test_Rep_HIGH_degrate_plasmid, dtype: object\n", - "\n", - "-------\n", - "Test_Rep_LOW_degrate_plasmid\n", - "name Test for Repressilator High Degradation\n", - "description NaN\n", - "pubchemid NaN\n", - "object Vector\n", - "flapjackid 4\n", - "chemical NaN\n", - "concentration NaN\n", - "dna TestDNA2\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: Test_Rep_LOW_degrate_plasmid, dtype: object\n", - "\n", - "-------\n", - "TestEcoli\n", - "name TestEcoli\n", - "description TestEcoli\n", - "pubchemid NaN\n", - "object Strain\n", - "flapjackid 2\n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestEcoli, dtype: object\n", - "\n", - "-------\n", - "TestGlucose\n", - "name TestGlucose\n", - "description testing: induction\n", - "pubchemid NaN\n", - "object Media\n", - "flapjackid 2\n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestGlucose, dtype: object\n", - "\n", - "-------\n", - "TestSignalB\n", - "name TestBiomass\n", - "description Testing for biomass\n", - "pubchemid NaN\n", - "object Signal\n", - "flapjackid 4\n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color TestBlack\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestSignalB, dtype: object\n", - "\n", - "-------\n", - "TestSignalA\n", - "name TestGFP\n", - "description Testing for fluorescence\n", - "pubchemid NaN\n", - "object Signal\n", - "flapjackid 5\n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color TestGreen\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestSignalA, dtype: object\n", - "\n", - "-------\n", - "TestStudy\n", - "name e2f testing\n", - "description testing for e2f upload\n", - "pubchemid NaN\n", - "object Study\n", - "flapjackid 3\n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI https://doi.org/thisisatest\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestStudy, dtype: object\n", - "\n", - "-------\n", - "TestAssay1\n", - "name Test Plate 1\n", - "description Test Plate 1\n", - "pubchemid NaN\n", - "object Assay\n", - "flapjackid 5\n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine Test Machine\n", - "temperature 0.0\n", - "study TestStudy\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestAssay1, dtype: object\n", - "\n", - "-------\n", - "TestAssay2\n", - "name Test Plate 2\n", - "description Test Plate 2\n", - "pubchemid NaN\n", - "object Assay\n", - "flapjackid 6\n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine Test Machine\n", - "temperature 0.0\n", - "study TestStudy\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestAssay2, dtype: object\n", - "\n", - "-------\n", - "TestSample1\n", - "name NaN\n", - "description NaN\n", - "pubchemid NaN\n", - "object Sample\n", - "flapjackid 5\n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row 1.0\n", - "col 1.0\n", - "assay TestAssay1\n", - "sampledesign TestSampleDesign1\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestSample1, dtype: object\n", - "\n", - "-------\n", - "TestSample2\n", - "name NaN\n", - "description NaN\n", - "pubchemid NaN\n", - "object Sample\n", - "flapjackid 6\n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row 1.0\n", - "col 2.0\n", - "assay TestAssay2\n", - "sampledesign TestSampleDesign2\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestSample2, dtype: object\n", - "\n", - "-------\n", - "TestSample3\n", - "name NaN\n", - "description NaN\n", - "pubchemid NaN\n", - "object Sample\n", - "flapjackid 5\n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row 1.0\n", - "col 1.0\n", - "assay TestAssay1\n", - "sampledesign TestSampleDesign1\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestSample3, dtype: object\n", - "\n", - "-------\n", - "TestSample4\n", - "name NaN\n", - "description NaN\n", - "pubchemid NaN\n", - "object Sample\n", - "flapjackid 6\n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row 1.0\n", - "col 2.0\n", - "assay TestAssay2\n", - "sampledesign TestSampleDesign2\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestSample4, dtype: object\n", - "\n", - "-------\n", - "TestMeasurement0\n", - "name NaN\n", - "description NaN\n", - "pubchemid NaN\n", - "object Measurement\n", - "flapjackid \n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample TestSample1\n", - "signal TestSignalA\n", - "time 0.0\n", - "value 0.0\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestMeasurement0, dtype: object\n", - "\n", - "-------\n", - "TestMeasurement1\n", - "name NaN\n", - "description NaN\n", - "pubchemid NaN\n", - "object Measurement\n", - "flapjackid \n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample TestSample1\n", - "signal TestSignalB\n", - "time 0.0\n", - "value 100.0\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestMeasurement1, dtype: object\n", - "\n", - "-------\n", - "TestMeasurement2\n", - "name NaN\n", - "description NaN\n", - "pubchemid NaN\n", - "object Measurement\n", - "flapjackid \n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample TestSample1\n", - "signal TestSignalA\n", - "time 0.25\n", - "value 50.0\n", - "media NaN\n", - "strain NaN\n", - "vector NaN\n", - "supplement NaN\n", - "Name: TestMeasurement2, dtype: object\n", - "\n", - "-------\n", - "TestSampleDesign1\n", - "name NaN\n", - "description NaN\n", - "pubchemid NaN\n", - "object Sample Design\n", - "flapjackid \n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media TestGlucose\n", - "strain TestEcoli\n", - "vector Test_Rep_LOW_degrate_plasmid\n", - "supplement NaN\n", - "Name: TestSampleDesign1, dtype: object\n", - "\n", - "-------\n", - "TestSampleDesign2\n", - "name NaN\n", - "description NaN\n", - "pubchemid NaN\n", - "object Sample Design\n", - "flapjackid \n", - "chemical NaN\n", - "concentration NaN\n", - "dna NaN\n", - "color NaN\n", - "DOI NaN\n", - "machine NaN\n", - "temperature NaN\n", - "study NaN\n", - "row NaN\n", - "col NaN\n", - "assay NaN\n", - "sampledesign NaN\n", - "sample NaN\n", - "signal NaN\n", - "time NaN\n", - "value NaN\n", - "media TestGlucose\n", - "strain TestEcoli\n", - "vector Test_Rep_HIGH_degrate_plasmid\n", - "supplement NaN\n", - "Name: TestSampleDesign2, dtype: object\n", - "\n" - ] - } - ], - "source": [ - "# print each row\n", - "for index, row in test_case.df.iterrows():\n", - " print(\"-------\")\n", - " print(index)\n", - " print(row)\n", - " print()" - ] - }, - { - "cell_type": "code", - "execution_count": 47, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'TestStudy': 3, 'TestSignalB': 4, 'TestSignalA': 5, 'TestChemical1': 3, 'TestChemical2': 4, 'TestDNA1': 4, 'TestDNA2': 5, 'TestDNA3': 6, 'TestGlucose': 2, 'TestEcoli': 2, 'TestSupplement1': 3, 'TestSupplement2': 4, 'Test_Rep_HIGH_degrate_plasmid': 3, 'Test_Rep_LOW_degrate_plasmid': 4, 'TestAssay1': 5, 'TestAssay2': 6, 'TestSample1': 5, 'TestSample2': 6, 'TestSample3': 5, 'TestSample4': 6}\n" - ] - } - ], - "source": [ - "\n", - "test_case.print_info(hash_map=True)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Upload all at once\n", - "creates df and uploads data from XDC spreadsheet using individual functions above" - ] - }, - { - "cell_type": "code", - "execution_count": 121, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Returning exististing model, study\n", - "id 7\n", - "is_owner True\n", - "shared_with []\n", - "name e2f testing\n", - "description testing for e2f upload\n", - "doi https://doi.org/thisisatest\n", - "sboluri \n", - "public False\n", - "\n", - "Returning exististing model, signal\n", - "id 10\n", - "name TestBiomass\n", - "description Testing for biomass\n", - "color testblack\n", - "sboluri \n", - "\n", - "Returning exististing model, signal\n", - "id 11\n", - "name TestGFP\n", - "description Testing for fluorescence\n", - "color testgreen\n", - "sboluri \n", - "\n", - "Returning exististing model, chemical\n", - "id 3\n", - "name TestATC\n", - "description TestATCInducer\n", - "pubchemid None\n", - "sboluri \n", - "\n", - "Returning exististing model, chemical\n", - "id 4\n", - "name TestIPTG\n", - "description TestIPTGInducer\n", - "pubchemid None\n", - "sboluri \n", - "\n", - "Returning exististing model, dna\n", - "id 13\n", - "name Test_Rep_HIGH_degrate\n", - "sboluri \n", - "\n", - "Returning exististing model, dna\n", - "id 14\n", - "name Test_Rep_LOW_degrate\n", - "sboluri \n", - "\n", - "Returning exististing model, dna\n", - "id 15\n", - "name Test_Reporter\n", - "sboluri \n", - "\n", - "Returning exististing model, media\n", - "id 5\n", - "name TestGlucose\n", - "description testing: induction\n", - "sboluri \n", - "\n", - "Returning exististing model, strain\n", - "id 5\n", - "name TestEcoli\n", - "description TestEcoli\n", - "sboluri \n", - "\n", - "Returning exististing model, supplement\n", - "id 9\n", - "name TestATC\n", - "concentration 100.0\n", - "sboluri \n", - "chemical 3\n", - "\n", - "Returning exististing model, supplement\n", - "id 10\n", - "name TestIPTG\n", - "concentration 100.0\n", - "sboluri \n", - "chemical 4\n", - "\n", - "Returning exististing model, vector\n", - "id 10\n", - "name Test for Repressilator Low Degradation\n", - "sboluri \n", - "dnas [13]\n", - "\n", - "Returning exististing model, vector\n", - "id 11\n", - "name Test for Repressilator High Degradation\n", - "sboluri \n", - "dnas [14]\n", - "\n", - "Returning exististing model, assay\n", - "id 13\n", - "name Test Plate 1\n", - "machine Test Machine\n", - "description Test Plate 1\n", - "temperature 0.0\n", - "sboluri \n", - "study 7\n", - "\n", - "Returning exististing model, assay\n", - "id 14\n", - "name Test Plate 2\n", - "machine Test Machine\n", - "description Test Plate 2\n", - "temperature 0.0\n", - "sboluri \n", - "study 7\n", - "\n", - "Returning exististing model, sample\n", - "id 13\n", - "sboluri \n", - "row 1\n", - "col 1\n", - "assay 13\n", - "media 5\n", - "strain 5\n", - "vector 11\n", - "supplements []\n", - "\n", - "Returning exististing model, sample\n", - "id 14\n", - "sboluri \n", - "row 1\n", - "col 2\n", - "assay 14\n", - "media 5\n", - "strain 5\n", - "vector 10\n", - "supplements []\n", - "\n", - "Returning exististing model, sample\n", - "id 13\n", - "sboluri \n", - "row 1\n", - "col 1\n", - "assay 13\n", - "media 5\n", - "strain 5\n", - "vector 11\n", - "supplements []\n", - "\n", - "Returning exististing model, sample\n", - "id 14\n", - "sboluri \n", - "row 1\n", - "col 2\n", - "assay 14\n", - "media 5\n", - "strain 5\n", - "vector 10\n", - "supplements []\n", - "\n" - ] - } - ], - "source": [ - "test_case.upload_all()\n", - "# return values from each upload fj.create call" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Delete upload" - ] - }, - { - "cell_type": "code", - "execution_count": 82, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "study\n", - "[5]\n", - "signal\n", - "[6, 7]\n", - "chemical\n", - "[3, 4]\n", - "dna\n", - "[7, 8, 9]\n", - "media\n", - "[3]\n", - "strain\n", - "[3]\n", - "supplement\n", - "[5, 6]\n", - "vector\n", - "[6, 7]\n", - "assay\n", - "[9, 10]\n", - "sample\n", - "[9, 10]\n" - ] - } - ], - "source": [ - "for i in test_case.del_map:\n", - " print(i)\n", - " print(test_case.del_map[i])" - ] - }, - { - "cell_type": "code", - "execution_count": 88, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Problem deleting chemical id=3:\n", - "{\"detail\":\"You do not have permission to perform this action.\"}\n", - "Problem deleting chemical id=4:\n", - "{\"detail\":\"You do not have permission to perform this action.\"}\n", - "Problem deleting assay id=11:\n", - "{\"detail\":\"Not found.\"}\n", - "Problem deleting assay id=12:\n", - "{\"detail\":\"Not found.\"}\n", - "Problem deleting sample id=11:\n", - "{\"detail\":\"Not found.\"}\n", - "Problem deleting sample id=12:\n", - "{\"detail\":\"Not found.\"}\n" - ] - } - ], - "source": [ - "test_case.delete_all()" - ] - }, - { - "cell_type": "code", - "execution_count": 76, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "True" - ] - }, - "execution_count": 76, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "test_case.fj.delete('vector', 3)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "### Unittesting help\n" - ] - }, - { - "cell_type": "code", - "execution_count": 90, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " id is_owner shared_with name description doi sboluri public\n", - "0 8 True [] randomname randomdescription False\n" - ] - } - ], - "source": [ - "print(test_case.fj.create(\n", - " 'study',\n", - " name='randomname',\n", - " description='randomdescription',\n", - " confirm=False,\n", - " overwrite=False,\n", - "))" - ] - }, - { - "cell_type": "code", - "execution_count": 99, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " name description pubchemid object flapjackid chemical concentration dna \\\n", - "0 hi None None None None None None None \n", - "\n", - " color DOI ... assay sampledesign sample signal time value media strain \\\n", - "0 None None ... None None None None None None None None \n", - "\n", - " vector supplement \n", - "0 None None \n", - "\n", - "[1 rows x 25 columns]\n" - ] - } - ], - "source": [ - "data1 = {\n", - " 'name': [None],\n", - " 'description': [None],\n", - " 'pubchemid': [None],\n", - " 'object': [None],\n", - " 'flapjackid': [None],\n", - " 'chemical': [None],\n", - " 'concentration': [None],\n", - " 'dna': [None],\n", - " 'color': [None],\n", - " 'DOI': [None],\n", - " 'machine': [None],\n", - " 'temperature': [None],\n", - " 'study': [None],\n", - " 'row': [None],\n", - " 'col': [None],\n", - " 'assay': [None],\n", - " 'sampledesign': [None],\n", - " 'sample': [None],\n", - " 'signal': [None],\n", - " 'time': [None],\n", - " 'value': [None],\n", - " 'media': [None],\n", - " 'strain': [None],\n", - " 'vector': [None],\n", - " 'supplement': [None]\n", - "}\n", - "\n", - "testdf = pd.DataFrame(data1)\n", - "testdf['name'][0] = \"hi\"\n", - "print(testdf)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "XDC", - "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.9.18" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/src/excel2flapjack/e2f_revamp.ipynb b/src/excel2flapjack/e2f_revamp.ipynb deleted file mode 100644 index 641406d..0000000 --- a/src/excel2flapjack/e2f_revamp.ipynb +++ /dev/null @@ -1,3815 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "import os\n", - "import pandas as pd\n", - "from flapjack import Flapjack" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [], - "source": [ - "fj_url = \"localhost:8000\" #local\n", - "# fj_url = \"flapjack.rudge-lab.org:8000\" #Web Instance Rudge Lab\n", - "#fj_url = \"198.59.83.73:8000\" #Web Instance Genetic Logic Lab\n", - "fj_user = \"dylan33smith\"\n", - "fj_pass = \"coco33\"\n", - "\n", - "# updated xcel file is in test/test_files\n", - "test_file_path = '../../tests/test_files'\n", - "excel_path = os.path.join(test_file_path, \"flapjack_excel_converter_revamp.xlsx\")\n", - "'''\n", - "hash_map = e2f.flapjack_upload(fj_url, fj_user, fj_pass, excel_path, sbol_hash_map={},\n", - " add_sbol_uris=False, flapjack_override=True, print_progress=True)\n", - "print(hash_map)\n", - "'''\n", - "confirm=False\n", - "overwrite=True" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "../../tests/test_files\\flapjack_excel_converter_revamp.xlsx\n" - ] - } - ], - "source": [ - "print(excel_path)" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "metadata": {}, - "outputs": [], - "source": [ - "# # log in to flapjack instance\n", - "fj = Flapjack(url_base=fj_url) #Local Instance\n", - "fj.log_in(username=fj_user, password=fj_pass)" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
Sheet NameColNameFlapjackName
0SupplementSupplement Namename
1SupplementChemical IDchemical
2SupplementConcentrationconcentration
3ChemicalChemical Namename
4ChemicalChemical Descriptiondescription
5ChemicalPubchem IDpubchemid
6VectorVector Namename
7VectorDNA IDdna
8StrainStrain Namename
9StrainStrain Descriptiondescription
10StrainStrain IDstrain
11MediaMedia Namename
12MediaMedia Descriptiondescription
13SignalSignal Namename
14SignalSignal Descriptiondescription
15SignalSignal Colorcolor
16DNADNA Namename
17MeasurementSignal IDsignal
18MeasurementValuevalue
19MeasurementSample IDsample
20MeasurementTimetime
21SampleRowrow
22SampleColumncol
23SampleSample Design IDsampledesign
24SampleAssay IDassay
25Sample DesignSupplement IDsupplement
26Sample DesignVector IDvector
27Sample DesignStrain IDstrain
28Sample DesignMedia IDmedia
29AssayAssay Namename
30AssayMachinemachine
31AssayDescriptiondescription
32AssayStudy IDstudy
33AssayTemperaturetemperature
34StudyStudy Namename
35StudyDescriptiondescription
36StudyDOIDOI
37StudyNaNpublic
\n", - "
" - ], - "text/plain": [ - " Sheet Name ColName FlapjackName\n", - "0 Supplement Supplement Name name\n", - "1 Supplement Chemical ID chemical\n", - "2 Supplement Concentration concentration\n", - "3 Chemical Chemical Name name\n", - "4 Chemical Chemical Description description\n", - "5 Chemical Pubchem ID pubchemid\n", - "6 Vector Vector Name name\n", - "7 Vector DNA ID dna\n", - "8 Strain Strain Name name\n", - "9 Strain Strain Description description\n", - "10 Strain Strain ID strain\n", - "11 Media Media Name name\n", - "12 Media Media Description description\n", - "13 Signal Signal Name name\n", - "14 Signal Signal Description description\n", - "15 Signal Signal Color color\n", - "16 DNA DNA Name name\n", - "17 Measurement Signal ID signal\n", - "18 Measurement Value value\n", - "19 Measurement Sample ID sample\n", - "20 Measurement Time time\n", - "21 Sample Row row\n", - "22 Sample Column col\n", - "23 Sample Sample Design ID sampledesign\n", - "24 Sample Assay ID assay\n", - "25 Sample Design Supplement ID supplement\n", - "26 Sample Design Vector ID vector\n", - "27 Sample Design Strain ID strain\n", - "28 Sample Design Media ID media\n", - "29 Assay Assay Name name\n", - "30 Assay Machine machine\n", - "31 Assay Description description\n", - "32 Assay Study ID study\n", - "33 Assay Temperature temperature\n", - "34 Study Study Name name\n", - "35 Study Description description\n", - "36 Study DOI DOI\n", - "37 Study NaN public" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# read in Excel file\n", - "xls = pd.ExcelFile(excel_path)\n", - "# parse FlapjackCols sheet\n", - "fj_conv_sht = xls.parse('FlapjackCols', skiprows=0)\n", - "fj_conv_sht" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "metadata": {}, - "outputs": [], - "source": [ - "# define list of all the sheet names in the XDC excel sheet\n", - "types = ['Chemical', 'DNA', 'Supplement', 'Vector', 'Strain', 'Media',\n", - " 'Signal', 'Study', 'Assay', 'Sample', 'Measurement', 'Sample Design']\n", - "\n", - "# initiate hashmap for linking to chemicals\n", - " # Linking what to chemicals?\n", - "hash_map = {}\n", - "# create empty dataframe used to store consolidated data from processed xcel sheets\n", - "revamp_df = pd.DataFrame()\n", - "\n", - "# \n", - "for obj in types:\n", - " # Read in the conversion sheet for col name to flapjack name\n", - " fj_conv_sht_obj = fj_conv_sht.loc[(fj_conv_sht['Sheet Name'] == obj)]\n", - " fj_conv_sht_obj = fj_conv_sht_obj.set_index('ColName').to_dict('index')\n", - " # print(fj_conv_sht_obj)\n", - "\n", - " # read in the object sheet\n", - " obj_df = xls.parse(obj, skiprows=0, index_col=f'{obj} ID')\n", - " cols = list(obj_df.columns)\n", - " # drop columns not used by flapjack and rename the ones that are\n", - " new_cols = []\n", - " col_drop = []\n", - " for col in cols:\n", - " if col in fj_conv_sht_obj.keys():\n", - " new_cols.append(fj_conv_sht_obj[col]['FlapjackName'])\n", - " else:\n", - " col_drop.append(col)\n", - "\n", - " # print(obj_df)\n", - " # print()\n", - " obj_df = obj_df.drop(columns=col_drop)\n", - " obj_df.columns = new_cols\n", - " obj_df['object'] = obj\n", - " obj_df['flapjackid'] = ''\n", - "\n", - " revamp_df = revamp_df.append(obj_df)" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
namedescriptionpubchemidobjectflapjackidchemicalconcentrationdnacolorDOI...assaysampledesignsamplesignaltimevaluemediastrainvectorsupplement
Chemical1ATCInducer54710409.0ChemicalNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
Chemical2IPTGInducer656894.0ChemicalNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
DNA1Rep_HIGH_degrateNaNNaNDNANaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
DNA2Rep_LOW_degrateNaNNaNDNANaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
DNA3ReporterNaNNaNDNANaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", - "

5 rows × 25 columns

\n", - "
" - ], - "text/plain": [ - " name description pubchemid object flapjackid \\\n", - "Chemical1 ATC Inducer 54710409.0 Chemical \n", - "Chemical2 IPTG Inducer 656894.0 Chemical \n", - "DNA1 Rep_HIGH_degrate NaN NaN DNA \n", - "DNA2 Rep_LOW_degrate NaN NaN DNA \n", - "DNA3 Reporter NaN NaN DNA \n", - "\n", - " chemical concentration dna color DOI ... assay sampledesign \\\n", - "Chemical1 NaN NaN NaN NaN NaN ... NaN NaN \n", - "Chemical2 NaN NaN NaN NaN NaN ... NaN NaN \n", - "DNA1 NaN NaN NaN NaN NaN ... NaN NaN \n", - "DNA2 NaN NaN NaN NaN NaN ... NaN NaN \n", - "DNA3 NaN NaN NaN NaN NaN ... NaN NaN \n", - "\n", - " sample signal time value media strain vector supplement \n", - "Chemical1 NaN NaN NaN NaN NaN NaN NaN NaN \n", - "Chemical2 NaN NaN NaN NaN NaN NaN NaN NaN \n", - "DNA1 NaN NaN NaN NaN NaN NaN NaN NaN \n", - "DNA2 NaN NaN NaN NaN NaN NaN NaN NaN \n", - "DNA3 NaN NaN NaN NaN NaN NaN NaN NaN \n", - "\n", - "[5 rows x 25 columns]" - ] - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "revamp_df.head()" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "\n", - "Index: 62 entries, Chemical1 to SampleDesign2\n", - "Data columns (total 25 columns):\n", - " # Column Non-Null Count Dtype \n", - "--- ------ -------------- ----- \n", - " 0 name 16 non-null object \n", - " 1 description 9 non-null object \n", - " 2 pubchemid 2 non-null float64\n", - " 3 object 62 non-null object \n", - " 4 flapjackid 62 non-null object \n", - " 5 chemical 2 non-null object \n", - " 6 concentration 2 non-null float64\n", - " 7 dna 2 non-null object \n", - " 8 color 2 non-null object \n", - " 9 DOI 1 non-null object \n", - " 10 machine 2 non-null object \n", - " 11 temperature 2 non-null float64\n", - " 12 study 2 non-null object \n", - " 13 row 4 non-null float64\n", - " 14 col 4 non-null float64\n", - " 15 assay 4 non-null object \n", - " 16 sampledesign 4 non-null object \n", - " 17 sample 40 non-null object \n", - " 18 signal 40 non-null object \n", - " 19 time 40 non-null float64\n", - " 20 value 40 non-null float64\n", - " 21 media 2 non-null object \n", - " 22 strain 2 non-null object \n", - " 23 vector 2 non-null object \n", - " 24 supplement 2 non-null object \n", - "dtypes: float64(7), object(18)\n", - "memory usage: 12.6+ KB\n" - ] - } - ], - "source": [ - "revamp_df.info()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Upload data from excel\n", - "\n", - "If getting an \"error no attribute id\" change overwrite to False\n", - " \n", - "- Otherwise overwrite=overwrite\n", - "\n", - "creating hash_map as you go" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Returning exististing model, study\n" - ] - } - ], - "source": [ - "#create studys\n", - "for index, row in revamp_df[revamp_df['object'] == 'Study'].iterrows():\n", - " flapjack_obj = fj.create(\n", - " 'study',\n", - " name=row['name'],\n", - " description=row['description'],\n", - " confirm=confirm,\n", - " overwrite=False,\n", - " )\n", - " hash_map[index] = flapjack_obj.id[0]\n", - " revamp_df.loc[index, 'flapjackid'] = flapjack_obj.id[0]\n", - " # if row[DOI] is not nan patch the DOI\n", - " if not pd.isna(row['DOI']):\n", - " fj.patch('study', flapjack_obj.id[0], doi=row['DOI'])" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Returning exististing model, signal\n", - "Returning exististing model, signal\n" - ] - } - ], - "source": [ - "#create signals\n", - "for index, row in revamp_df[revamp_df['object'] == 'Signal'].iterrows():\n", - " flapjack_obj = fj.create( \n", - " 'signal',\n", - " name=row['name'], \n", - " description=row['description'],\n", - " color=row['color'],\n", - " confirm=confirm,\n", - " overwrite=False,\n", - " )\n", - " hash_map[index] = flapjack_obj.id[0]\n", - " revamp_df.loc[index, 'flapjackid'] = flapjack_obj.id[0]" - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Returning exististing model, chemical\n", - " id name description pubchemid sboluri\n", - "0 1 ATC Inducer 54710409 \n", - "Returning exististing model, chemical\n", - " id name description pubchemid sboluri\n", - "0 2 IPTG Inducer 656894 \n" - ] - } - ], - "source": [ - "#create chemicals #todo resolve problem with overwrite True and founding an exitent chemical it return a df\n", - "for index, row in revamp_df[revamp_df['object'] == 'Chemical'].iterrows():\n", - " flapjack_obj = fj.create( \n", - " 'chemical',\n", - " name=row['name'], \n", - " description=row['description'],\n", - " pubchemid=row['pubchemid'],\n", - " confirm=confirm,\n", - " overwrite=False,\n", - " )\n", - " print(flapjack_obj)\n", - " hash_map[index] = flapjack_obj.id[0]\n", - " revamp_df.loc[index, 'flapjackid'] = flapjack_obj.id[0]\n", - " '''\n", - " if not pd.isna(row['pubchemid']):\n", - " fj.patch('chemical', flapjack_obj.id[0], pubchemid=row['pubchemid'])\n", - " '''" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Returning exististing model, dna\n", - " id name sboluri\n", - "0 1 Rep_HIGH_degrate \n", - "Returning exististing model, dna\n", - " id name sboluri\n", - "0 2 Rep_LOW_degrate \n", - "Returning exististing model, dna\n", - " id name sboluri\n", - "0 3 Reporter \n" - ] - } - ], - "source": [ - "#create dna\n", - "for index, row in revamp_df[revamp_df['object'] == 'DNA'].iterrows():\n", - " flapjack_obj = fj.create( \n", - " 'dna',\n", - " name=row['name'], \n", - " confirm=confirm,\n", - " overwrite=False,\n", - " )\n", - " print(flapjack_obj)\n", - " hash_map[index] = flapjack_obj.id[0]\n", - " revamp_df.loc[index, 'flapjackid'] = flapjack_obj.id[0]" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{'Study1': 2, 'Signal1': 1, 'Signal9': 2, 'Chemical1': 1, 'Chemical2': 2, 'DNA1': 1, 'DNA2': 2, 'DNA3': 3}\n" - ] - } - ], - "source": [ - "print(hash_map)" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Returning exististing model, media\n" - ] - } - ], - "source": [ - "#create medias\n", - "for index, row in revamp_df[revamp_df['object'] == 'Media'].iterrows():\n", - " flapjack_obj = fj.create( \n", - " 'media',\n", - " name=row['name'], \n", - " description=row['description'],\n", - " confirm=confirm,\n", - " overwrite=False,\n", - " )\n", - " hash_map[index] = flapjack_obj.id[0]\n", - " revamp_df.loc[index, 'flapjackid'] = flapjack_obj.id[0]" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Returning exististing model, strain\n" - ] - } - ], - "source": [ - "#create strains\n", - "for index, row in revamp_df[revamp_df['object'] == 'Strain'].iterrows():\n", - " flapjack_obj = fj.create( \n", - " 'strain',\n", - " name=row['name'], \n", - " description=row['description'],\n", - " confirm=confirm,\n", - " overwrite=False,\n", - " )\n", - " hash_map[index] = flapjack_obj.id[0]\n", - " revamp_df.loc[index, 'flapjackid'] = flapjack_obj.id[0]\n" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Returning exististing model, supplement\n", - " id name concentration sboluri chemical\n", - "0 1 ATC 0.2 1\n", - "Returning exististing model, supplement\n", - " id name concentration sboluri chemical\n", - "0 2 IPTG 0.3 2\n" - ] - } - ], - "source": [ - "#create supplements\n", - "for index, row in revamp_df[revamp_df['object'] == 'Supplement'].iterrows():\n", - " flapjack_obj = fj.create( \n", - " 'supplement',\n", - " name=row['name'], \n", - " description=row['description'],\n", - " chemical=revamp_df.loc[row['chemical'], 'flapjackid'],\n", - " concentration=row['concentration'],\n", - " confirm=confirm,\n", - " overwrite=False,\n", - " )\n", - " print(flapjack_obj)\n", - " hash_map[index] = flapjack_obj.id[0]\n", - " revamp_df.loc[index, 'flapjackid'] = flapjack_obj.id[0]" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Returning exististing model, vector\n", - " id name sboluri dnas\n", - "0 1 Repressilator1 [1]\n", - "Returning exististing model, vector\n", - " id name sboluri dnas\n", - "0 2 Repressilator2 [2]\n" - ] - } - ], - "source": [ - "#create vectors\n", - "for index, row in revamp_df[revamp_df['object'] == 'Vector'].iterrows():\n", - " flapjack_obj = fj.create( \n", - " 'vector',\n", - " name=row['name'], \n", - " description=row['description'],\n", - " dnas=[revamp_df.loc[row['dna'], 'flapjackid']],\n", - " confirm=confirm,\n", - " overwrite=False,\n", - " )\n", - " print(flapjack_obj)\n", - " hash_map[index] = flapjack_obj.id[0]\n", - " revamp_df.loc[index, 'flapjackid'] = flapjack_obj.id[0]" - ] - }, - { - "cell_type": "code", - "execution_count": 42, - "metadata": {}, - "outputs": [], - "source": [ - "#creaye assays\n", - "for index, row in revamp_df[revamp_df['object'] == 'Assay'].iterrows():\n", - " flapjack_obj = fj.create( \n", - " 'assay',\n", - " study=revamp_df.loc[row['study'], 'flapjackid'],\n", - " name=row['name'], \n", - " description=row['description'],\n", - " machine=row['machine'],\n", - " temperature=row['temperature'],\n", - " confirm=confirm,\n", - " overwrite=False,\n", - " )\n", - " hash_map[index] = flapjack_obj.id[0]\n", - " revamp_df.loc[index, 'flapjackid'] = flapjack_obj.id[0]\n" - ] - }, - { - "cell_type": "code", - "execution_count": 43, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Returning exististing model, sample\n", - "Returning exististing model, sample\n" - ] - } - ], - "source": [ - "# create samples\n", - "for index, row in revamp_df[revamp_df['object'] == 'Sample'].iterrows():\n", - " #get flapjack ids from sample design\n", - " media_index = revamp_df.loc[row['sampledesign'], 'media']\n", - " media_id = revamp_df.loc[media_index, 'flapjackid']\n", - " strain_index = revamp_df.loc[row['sampledesign'], 'strain']\n", - " strain_id = revamp_df.loc[strain_index, 'flapjackid']\n", - " vector_index = revamp_df.loc[row['sampledesign'], 'vector']\n", - " vector_id = revamp_df.loc[vector_index, 'flapjackid']\n", - " flapjack_obj = fj.create( \n", - " 'sample',\n", - " assay=revamp_df.loc[row['assay'], 'flapjackid'],\n", - " media=media_id,\n", - " strain=strain_id,\n", - " vector=vector_id,\n", - " row=row['row'],\n", - " col=row['col'],\n", - " confirm=confirm,\n", - " overwrite=False,\n", - " )\n", - " hash_map[index] = flapjack_obj.id[0]\n", - " revamp_df.loc[index, 'flapjackid'] = flapjack_obj.id[0]\n", - " #TDODO add loop over supplements, or get supplements as list\n", - " if not pd.isna(row['supplement']):\n", - " supplement_index = revamp_df.loc[row['sampledesign'], 'supplement']\n", - " supplement_id = revamp_df.loc[supplement_index, 'flapjackid']\n", - " fj.patch('sample', flapjack_obj.id[0], supplements=supplement_id)\n", - " " - ] - }, - { - "cell_type": "code", - "execution_count": 44, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
idsbolurirowcolassaymediastrainvectorsupplements
02122112[]
\n", - "
" - ], - "text/plain": [ - " id sboluri row col assay media strain vector supplements\n", - "0 2 1 2 2 1 1 2 []" - ] - }, - "execution_count": 44, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "flapjack_obj" - ] - }, - { - "cell_type": "code", - "execution_count": 46, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " time value signal sample\n", - "Measurement0 0.00 0.000000 Signal9 Sample1\n", - "Measurement1 0.00 0.010331 Signal1 Sample1\n", - "Measurement2 0.25 1.953695 Signal9 Sample1\n", - "Measurement3 0.25 0.010752 Signal1 Sample1\n", - "Measurement4 0.50 1.715337 Signal9 Sample1\n", - "Measurement5 0.50 0.011156 Signal1 Sample1\n", - "Measurement6 0.75 1.678607 Signal9 Sample1\n", - "Measurement7 0.75 0.012010 Signal1 Sample1\n", - "Measurement8 1.00 1.587738 Signal9 Sample1\n", - "Measurement9 1.00 0.013234 Signal1 Sample1\n", - "Measurement10 1.25 1.612557 Signal9 Sample1\n", - "Measurement11 1.25 0.016093 Signal1 Sample1\n", - "Measurement12 1.50 1.740648 Signal9 Sample1\n", - "Measurement13 1.50 0.018807 Signal1 Sample1\n", - "Measurement14 1.75 2.094849 Signal9 Sample1\n", - "Measurement15 1.75 0.022730 Signal1 Sample1\n", - "Measurement16 2.00 2.715779 Signal9 Sample1\n", - "Measurement17 2.00 0.027194 Signal1 Sample1\n", - "Measurement18 2.25 3.815254 Signal9 Sample1\n", - "Measurement19 2.25 0.034800 Signal1 Sample1\n", - "Measurement200 0.00 0.000000 Signal9 Sample2\n", - "Measurement201 0.00 0.010444 Signal1 Sample2\n", - "Measurement202 0.25 1.725928 Signal9 Sample2\n", - "Measurement203 0.25 0.010294 Signal1 Sample2\n", - "Measurement204 0.50 1.462755 Signal9 Sample2\n", - "Measurement205 0.50 0.011338 Signal1 Sample2\n", - "Measurement206 0.75 1.145845 Signal9 Sample2\n", - "Measurement207 0.75 0.012736 Signal1 Sample2\n", - "Measurement208 1.00 1.236872 Signal9 Sample2\n", - "Measurement209 1.00 0.013692 Signal1 Sample2\n", - "Measurement210 1.25 1.311550 Signal9 Sample2\n", - "Measurement211 1.25 0.015990 Signal1 Sample2\n", - "Measurement212 1.50 1.647446 Signal9 Sample2\n", - "Measurement213 1.50 0.018740 Signal1 Sample2\n", - "Measurement214 1.75 2.025493 Signal9 Sample2\n", - "Measurement215 1.75 0.022822 Signal1 Sample2\n", - "Measurement216 2.00 2.664766 Signal9 Sample2\n", - "Measurement217 2.00 0.026213 Signal1 Sample2\n", - "Measurement218 2.25 3.073661 Signal9 Sample2\n", - "Measurement219 2.25 0.035800 Signal1 Sample2\n", - "{'Sample1', 'Sample2'}\n", - "{'Signal1', 'Signal9'}\n" - ] - } - ], - "source": [ - "measurement_df = revamp_df[revamp_df['object'] == 'Measurement'][['time', 'value', 'signal', 'sample']]\n", - "unique_samples = set(revamp_df[revamp_df['object'] == 'Measurement']['sample'])\n", - "unique_signals = set(revamp_df[revamp_df['object'] == 'Measurement']['signal'])\n", - "\n", - "print(measurement_df)\n", - "print(unique_samples)\n", - "print(unique_signals)" - ] - }, - { - "cell_type": "code", - "execution_count": 47, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - " name description pubchemid object flapjackid chemical \\\n", - "Measurement0 NaN NaN NaN Measurement NaN \n", - "Measurement1 NaN NaN NaN Measurement NaN \n", - "Measurement2 NaN NaN NaN Measurement NaN \n", - "Measurement3 NaN NaN NaN Measurement NaN \n", - "Measurement4 NaN NaN NaN Measurement NaN \n", - "Measurement5 NaN NaN NaN Measurement NaN \n", - "Measurement6 NaN NaN NaN Measurement NaN \n", - "Measurement7 NaN NaN NaN Measurement NaN \n", - "Measurement8 NaN NaN NaN Measurement NaN \n", - "Measurement9 NaN NaN NaN Measurement NaN \n", - "Measurement10 NaN NaN NaN Measurement NaN \n", - "Measurement11 NaN NaN NaN Measurement NaN \n", - "Measurement12 NaN NaN NaN Measurement NaN \n", - "Measurement13 NaN NaN NaN Measurement NaN \n", - "Measurement14 NaN NaN NaN Measurement NaN \n", - "Measurement15 NaN NaN NaN Measurement NaN \n", - "Measurement16 NaN NaN NaN Measurement NaN \n", - "Measurement17 NaN NaN NaN Measurement NaN \n", - "Measurement18 NaN NaN NaN Measurement NaN \n", - "Measurement19 NaN NaN NaN Measurement NaN \n", - "\n", - " concentration dna color DOI ... assay sampledesign \\\n", - "Measurement0 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement1 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement2 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement3 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement4 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement5 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement6 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement7 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement8 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement9 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement10 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement11 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement12 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement13 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement14 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement15 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement16 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement17 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement18 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement19 NaN NaN NaN NaN ... NaN NaN \n", - "\n", - " sample signal time value media strain vector \\\n", - "Measurement0 Sample1 Signal9 0.00 0.000000 NaN NaN NaN \n", - "Measurement1 Sample1 Signal1 0.00 0.010331 NaN NaN NaN \n", - "Measurement2 Sample1 Signal9 0.25 1.953695 NaN NaN NaN \n", - "Measurement3 Sample1 Signal1 0.25 0.010752 NaN NaN NaN \n", - "Measurement4 Sample1 Signal9 0.50 1.715337 NaN NaN NaN \n", - "Measurement5 Sample1 Signal1 0.50 0.011156 NaN NaN NaN \n", - "Measurement6 Sample1 Signal9 0.75 1.678607 NaN NaN NaN \n", - "Measurement7 Sample1 Signal1 0.75 0.012010 NaN NaN NaN \n", - "Measurement8 Sample1 Signal9 1.00 1.587738 NaN NaN NaN \n", - "Measurement9 Sample1 Signal1 1.00 0.013234 NaN NaN NaN \n", - "Measurement10 Sample1 Signal9 1.25 1.612557 NaN NaN NaN \n", - "Measurement11 Sample1 Signal1 1.25 0.016093 NaN NaN NaN \n", - "Measurement12 Sample1 Signal9 1.50 1.740648 NaN NaN NaN \n", - "Measurement13 Sample1 Signal1 1.50 0.018807 NaN NaN NaN \n", - "Measurement14 Sample1 Signal9 1.75 2.094849 NaN NaN NaN \n", - "Measurement15 Sample1 Signal1 1.75 0.022730 NaN NaN NaN \n", - "Measurement16 Sample1 Signal9 2.00 2.715779 NaN NaN NaN \n", - "Measurement17 Sample1 Signal1 2.00 0.027194 NaN NaN NaN \n", - "Measurement18 Sample1 Signal9 2.25 3.815254 NaN NaN NaN \n", - "Measurement19 Sample1 Signal1 2.25 0.034800 NaN NaN NaN \n", - "\n", - " supplement \n", - "Measurement0 NaN \n", - "Measurement1 NaN \n", - "Measurement2 NaN \n", - "Measurement3 NaN \n", - "Measurement4 NaN \n", - "Measurement5 NaN \n", - "Measurement6 NaN \n", - "Measurement7 NaN \n", - "Measurement8 NaN \n", - "Measurement9 NaN \n", - "Measurement10 NaN \n", - "Measurement11 NaN \n", - "Measurement12 NaN \n", - "Measurement13 NaN \n", - "Measurement14 NaN \n", - "Measurement15 NaN \n", - "Measurement16 NaN \n", - "Measurement17 NaN \n", - "Measurement18 NaN \n", - "Measurement19 NaN \n", - "\n", - "[20 rows x 25 columns] \n", - "\n", - " name description pubchemid object flapjackid chemical \\\n", - "Measurement200 NaN NaN NaN Measurement NaN \n", - "Measurement201 NaN NaN NaN Measurement NaN \n", - "Measurement202 NaN NaN NaN Measurement NaN \n", - "Measurement203 NaN NaN NaN Measurement NaN \n", - "Measurement204 NaN NaN NaN Measurement NaN \n", - "Measurement205 NaN NaN NaN Measurement NaN \n", - "Measurement206 NaN NaN NaN Measurement NaN \n", - "Measurement207 NaN NaN NaN Measurement NaN \n", - "Measurement208 NaN NaN NaN Measurement NaN \n", - "Measurement209 NaN NaN NaN Measurement NaN \n", - "Measurement210 NaN NaN NaN Measurement NaN \n", - "Measurement211 NaN NaN NaN Measurement NaN \n", - "Measurement212 NaN NaN NaN Measurement NaN \n", - "Measurement213 NaN NaN NaN Measurement NaN \n", - "Measurement214 NaN NaN NaN Measurement NaN \n", - "Measurement215 NaN NaN NaN Measurement NaN \n", - "Measurement216 NaN NaN NaN Measurement NaN \n", - "Measurement217 NaN NaN NaN Measurement NaN \n", - "Measurement218 NaN NaN NaN Measurement NaN \n", - "Measurement219 NaN NaN NaN Measurement NaN \n", - "\n", - " concentration dna color DOI ... assay sampledesign \\\n", - "Measurement200 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement201 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement202 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement203 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement204 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement205 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement206 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement207 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement208 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement209 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement210 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement211 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement212 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement213 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement214 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement215 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement216 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement217 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement218 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement219 NaN NaN NaN NaN ... NaN NaN \n", - "\n", - " sample signal time value media strain vector \\\n", - "Measurement200 Sample2 Signal9 0.00 0.000000 NaN NaN NaN \n", - "Measurement201 Sample2 Signal1 0.00 0.010444 NaN NaN NaN \n", - "Measurement202 Sample2 Signal9 0.25 1.725928 NaN NaN NaN \n", - "Measurement203 Sample2 Signal1 0.25 0.010294 NaN NaN NaN \n", - "Measurement204 Sample2 Signal9 0.50 1.462755 NaN NaN NaN \n", - "Measurement205 Sample2 Signal1 0.50 0.011338 NaN NaN NaN \n", - "Measurement206 Sample2 Signal9 0.75 1.145845 NaN NaN NaN \n", - "Measurement207 Sample2 Signal1 0.75 0.012736 NaN NaN NaN \n", - "Measurement208 Sample2 Signal9 1.00 1.236872 NaN NaN NaN \n", - "Measurement209 Sample2 Signal1 1.00 0.013692 NaN NaN NaN \n", - "Measurement210 Sample2 Signal9 1.25 1.311550 NaN NaN NaN \n", - "Measurement211 Sample2 Signal1 1.25 0.015990 NaN NaN NaN \n", - "Measurement212 Sample2 Signal9 1.50 1.647446 NaN NaN NaN \n", - "Measurement213 Sample2 Signal1 1.50 0.018740 NaN NaN NaN \n", - "Measurement214 Sample2 Signal9 1.75 2.025493 NaN NaN NaN \n", - "Measurement215 Sample2 Signal1 1.75 0.022822 NaN NaN NaN \n", - "Measurement216 Sample2 Signal9 2.00 2.664766 NaN NaN NaN \n", - "Measurement217 Sample2 Signal1 2.00 0.026213 NaN NaN NaN \n", - "Measurement218 Sample2 Signal9 2.25 3.073661 NaN NaN NaN \n", - "Measurement219 Sample2 Signal1 2.25 0.035800 NaN NaN NaN \n", - "\n", - " supplement \n", - "Measurement200 NaN \n", - "Measurement201 NaN \n", - "Measurement202 NaN \n", - "Measurement203 NaN \n", - "Measurement204 NaN \n", - "Measurement205 NaN \n", - "Measurement206 NaN \n", - "Measurement207 NaN \n", - "Measurement208 NaN \n", - "Measurement209 NaN \n", - "Measurement210 NaN \n", - "Measurement211 NaN \n", - "Measurement212 NaN \n", - "Measurement213 NaN \n", - "Measurement214 NaN \n", - "Measurement215 NaN \n", - "Measurement216 NaN \n", - "Measurement217 NaN \n", - "Measurement218 NaN \n", - "Measurement219 NaN \n", - "\n", - "[20 rows x 25 columns] \n", - "\n" - ] - } - ], - "source": [ - "for sample in unique_samples:\n", - " sample_df = revamp_df[revamp_df['sample'] == sample]\n", - " sample_id = revamp_df.loc[sample, 'flapjackid']\n", - " print(sample_df, \"\\n\")\n", - " \n", - " '''for signal,data in sample_df.groupby('signal'):\n", - " signal_id = revamp_df.loc[signal, 'flapjackid']\n", - " if signal_id:\n", - " fj.upload_measurements(data, signal=[signal_id], sample=[sample_id])\n", - " time.sleep(1) # Add a delay of 1 second before uploading the next set of measurements\n", - " '''" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "for sample in unique_samples:\n", - " sample_df = revamp_df[revamp_df['sample'] == sample]\n", - " sample_id = revamp_df.loc[sample, 'flapjackid']\n", - " for signal,data in sample_df.groupby('signal'):\n", - " signal_id = revamp_df.loc[signal, 'flapjackid']\n", - " if signal_id:\n", - " fj.upload_measurements(data, signal=[signal_id], sample=[sample_id])\n", - " time.sleep(1) # Add a delay of 1 second before uploading the next set of measurements" - ] - }, - { - "cell_type": "code", - "execution_count": 29, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/var/folders/65/dt4l3nw13q57n8x9nlly46640000gn/T/ipykernel_74414/2891085989.py:8: UserWarning:\n", - "\n", - "Boolean Series key will be reindexed to match DataFrame index.\n", - "\n" - ] - }, - { - "ename": "TypeError", - "evalue": "'numpy.int64' object is not iterable", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[29], line 9\u001b[0m\n\u001b[1;32m 7\u001b[0m signal_id \u001b[38;5;241m=\u001b[39m revamp_df\u001b[38;5;241m.\u001b[39mloc[signal, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mflapjackid\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[1;32m 8\u001b[0m measurement_df \u001b[38;5;241m=\u001b[39m revamp_df[revamp_df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mobject\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mMeasurement\u001b[39m\u001b[38;5;124m'\u001b[39m][revamp_df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124msample\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m==\u001b[39m sample][revamp_df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124msignal\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m==\u001b[39m signal][[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtime\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mvalue\u001b[39m\u001b[38;5;124m'\u001b[39m]]\n\u001b[0;32m----> 9\u001b[0m \u001b[43mfj\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mupload_measurements\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmeasurement_df\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msignal\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[43msignal_id\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msample\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msample_id\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 10\u001b[0m time\u001b[38;5;241m.\u001b[39msleep(\u001b[38;5;241m2\u001b[39m)\n", - "File \u001b[0;32m~/Documents/GitHub/pyFlapjack/src/flapjack/flapjack.py:232\u001b[0m, in \u001b[0;36mFlapjack.upload_measurements\u001b[0;34m(self, df, **kwargs)\u001b[0m\n\u001b[1;32m 231\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mupload_measurements\u001b[39m(\u001b[38;5;28mself\u001b[39m, df, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[0;32m--> 232\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43masyncio\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_upload_measurements\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdf\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/site-packages/nest_asyncio.py:32\u001b[0m, in \u001b[0;36m_patch_asyncio..run\u001b[0;34m(future, debug)\u001b[0m\n\u001b[1;32m 30\u001b[0m loop \u001b[38;5;241m=\u001b[39m asyncio\u001b[38;5;241m.\u001b[39mget_event_loop()\n\u001b[1;32m 31\u001b[0m loop\u001b[38;5;241m.\u001b[39mset_debug(debug)\n\u001b[0;32m---> 32\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mloop\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun_until_complete\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfuture\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/site-packages/nest_asyncio.py:70\u001b[0m, in \u001b[0;36m_patch_loop..run_until_complete\u001b[0;34m(self, future)\u001b[0m\n\u001b[1;32m 67\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m f\u001b[38;5;241m.\u001b[39mdone():\n\u001b[1;32m 68\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\n\u001b[1;32m 69\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mEvent loop stopped before Future completed.\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m---> 70\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mf\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mresult\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/asyncio/futures.py:201\u001b[0m, in \u001b[0;36mFuture.result\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 199\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m__log_traceback \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[1;32m 200\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_exception \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m--> 201\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_exception\n\u001b[1;32m 202\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_result\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/asyncio/tasks.py:256\u001b[0m, in \u001b[0;36mTask.__step\u001b[0;34m(***failed resolving arguments***)\u001b[0m\n\u001b[1;32m 252\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 253\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m exc \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 254\u001b[0m \u001b[38;5;66;03m# We use the `send` method directly, because coroutines\u001b[39;00m\n\u001b[1;32m 255\u001b[0m \u001b[38;5;66;03m# don't have `__iter__` and `__next__` methods.\u001b[39;00m\n\u001b[0;32m--> 256\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mcoro\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 257\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 258\u001b[0m result \u001b[38;5;241m=\u001b[39m coro\u001b[38;5;241m.\u001b[39mthrow(exc)\n", - "File \u001b[0;32m~/Documents/GitHub/pyFlapjack/src/flapjack/flapjack.py:239\u001b[0m, in \u001b[0;36mFlapjack._upload_measurements\u001b[0;34m(self, df, **kwargs)\u001b[0m\n\u001b[1;32m 236\u001b[0m uri \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mws_url_base \u001b[38;5;241m+\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m/ws/registry/measurements?token=\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maccess_token\n\u001b[1;32m 238\u001b[0m \u001b[38;5;66;03m# Get the parameter dict from arguments\u001b[39;00m\n\u001b[0;32m--> 239\u001b[0m params \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparse_params\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 240\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(params)\u001b[38;5;241m==\u001b[39m\u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m 241\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m\n", - "File \u001b[0;32m~/Documents/GitHub/pyFlapjack/src/flapjack/flapjack.py:198\u001b[0m, in \u001b[0;36mFlapjack.parse_params\u001b[0;34m(self, **kwargs)\u001b[0m\n\u001b[1;32m 196\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mparse_params\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 197\u001b[0m \u001b[38;5;66;03m# Get search params and convert ids to python int\u001b[39;00m\n\u001b[0;32m--> 198\u001b[0m params \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 199\u001b[0m model: [\n\u001b[1;32m 200\u001b[0m \u001b[38;5;28mint\u001b[39m(\u001b[38;5;28mid\u001b[39m) \u001b[38;5;28;01mfor\u001b[39;00m \u001b[38;5;28mid\u001b[39m \u001b[38;5;129;01min\u001b[39;00m kwargs\u001b[38;5;241m.\u001b[39mget(model, [])\n\u001b[1;32m 201\u001b[0m ] \u001b[38;5;28;01mfor\u001b[39;00m model \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmodels\n\u001b[1;32m 202\u001b[0m }\n\u001b[1;32m 203\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(params)\u001b[38;5;241m==\u001b[39m\u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m 204\u001b[0m \u001b[38;5;66;03m# Empty query params\u001b[39;00m\n\u001b[1;32m 205\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mEmpty query, no results to return\u001b[39m\u001b[38;5;124m'\u001b[39m)\n", - "File \u001b[0;32m~/Documents/GitHub/pyFlapjack/src/flapjack/flapjack.py:199\u001b[0m, in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 196\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mparse_params\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 197\u001b[0m \u001b[38;5;66;03m# Get search params and convert ids to python int\u001b[39;00m\n\u001b[1;32m 198\u001b[0m params \u001b[38;5;241m=\u001b[39m {\n\u001b[0;32m--> 199\u001b[0m model: [\n\u001b[1;32m 200\u001b[0m \u001b[38;5;28mint\u001b[39m(\u001b[38;5;28mid\u001b[39m) \u001b[38;5;28;01mfor\u001b[39;00m \u001b[38;5;28mid\u001b[39m \u001b[38;5;129;01min\u001b[39;00m kwargs\u001b[38;5;241m.\u001b[39mget(model, [])\n\u001b[1;32m 201\u001b[0m ] \u001b[38;5;28;01mfor\u001b[39;00m model \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmodels\n\u001b[1;32m 202\u001b[0m }\n\u001b[1;32m 203\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(params)\u001b[38;5;241m==\u001b[39m\u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m 204\u001b[0m \u001b[38;5;66;03m# Empty query params\u001b[39;00m\n\u001b[1;32m 205\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mEmpty query, no results to return\u001b[39m\u001b[38;5;124m'\u001b[39m)\n", - "\u001b[0;31mTypeError\u001b[0m: 'numpy.int64' object is not iterable" - ] - } - ], - "source": [ - "# create measurements\n", - "unique_samples = set(revamp_df[revamp_df['object'] == 'Measurement']['sample'])\n", - "unique_signals = set(revamp_df[revamp_df['object'] == 'Measurement']['signal'])\n", - "for sample in unique_samples:\n", - " sample_id = revamp_df.loc[sample, 'flapjackid']\n", - " for signal in unique_signals:\n", - " signal_id = revamp_df.loc[signal, 'flapjackid']\n", - " measurement_df = revamp_df[revamp_df['object'] == 'Measurement'][revamp_df['sample'] == sample][revamp_df['signal'] == signal][['time', 'value']]\n", - " fj.upload_measurements(measurement_df, signal=[signal_id], sample=sample_id)\n", - " time.sleep(2)" - ] - }, - { - "cell_type": "code", - "execution_count": 30, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
timevalue
Measurement2000.000.000000
Measurement2020.251.725928
Measurement2040.501.462755
Measurement2060.751.145845
Measurement2081.001.236872
Measurement2101.251.311550
Measurement2121.501.647446
Measurement2141.752.025493
Measurement2162.002.664766
Measurement2182.253.073661
\n", - "
" - ], - "text/plain": [ - " time value\n", - "Measurement200 0.00 0.000000\n", - "Measurement202 0.25 1.725928\n", - "Measurement204 0.50 1.462755\n", - "Measurement206 0.75 1.145845\n", - "Measurement208 1.00 1.236872\n", - "Measurement210 1.25 1.311550\n", - "Measurement212 1.50 1.647446\n", - "Measurement214 1.75 2.025493\n", - "Measurement216 2.00 2.664766\n", - "Measurement218 2.25 3.073661" - ] - }, - "execution_count": 30, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "measurement_df" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "metadata": {}, - "outputs": [ - { - "ename": "TypeError", - "evalue": "'numpy.int64' object is not iterable", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[28], line 10\u001b[0m\n\u001b[1;32m 8\u001b[0m signal_id \u001b[38;5;241m=\u001b[39m revamp_df\u001b[38;5;241m.\u001b[39mloc[signal, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mflapjackid\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[1;32m 9\u001b[0m measurement_df \u001b[38;5;241m=\u001b[39m revamp_df[(revamp_df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mobject\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mMeasurement\u001b[39m\u001b[38;5;124m'\u001b[39m) \u001b[38;5;241m&\u001b[39m (revamp_df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124msample\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m==\u001b[39m sample) \u001b[38;5;241m&\u001b[39m (revamp_df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124msignal\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m==\u001b[39m signal)][[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtime\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mvalue\u001b[39m\u001b[38;5;124m'\u001b[39m]]\n\u001b[0;32m---> 10\u001b[0m \u001b[43mfj\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mupload_measurements\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmeasurement_df\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msignal\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[43msignal_id\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msample\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msample_id\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 11\u001b[0m time\u001b[38;5;241m.\u001b[39msleep(\u001b[38;5;241m10\u001b[39m)\n", - "File \u001b[0;32m~/Documents/GitHub/pyFlapjack/src/flapjack/flapjack.py:232\u001b[0m, in \u001b[0;36mFlapjack.upload_measurements\u001b[0;34m(self, df, **kwargs)\u001b[0m\n\u001b[1;32m 231\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mupload_measurements\u001b[39m(\u001b[38;5;28mself\u001b[39m, df, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[0;32m--> 232\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43masyncio\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_upload_measurements\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdf\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/site-packages/nest_asyncio.py:32\u001b[0m, in \u001b[0;36m_patch_asyncio..run\u001b[0;34m(future, debug)\u001b[0m\n\u001b[1;32m 30\u001b[0m loop \u001b[38;5;241m=\u001b[39m asyncio\u001b[38;5;241m.\u001b[39mget_event_loop()\n\u001b[1;32m 31\u001b[0m loop\u001b[38;5;241m.\u001b[39mset_debug(debug)\n\u001b[0;32m---> 32\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mloop\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun_until_complete\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfuture\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/site-packages/nest_asyncio.py:70\u001b[0m, in \u001b[0;36m_patch_loop..run_until_complete\u001b[0;34m(self, future)\u001b[0m\n\u001b[1;32m 67\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m f\u001b[38;5;241m.\u001b[39mdone():\n\u001b[1;32m 68\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\n\u001b[1;32m 69\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mEvent loop stopped before Future completed.\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m---> 70\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mf\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mresult\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/asyncio/futures.py:201\u001b[0m, in \u001b[0;36mFuture.result\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 199\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m__log_traceback \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[1;32m 200\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_exception \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m--> 201\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_exception\n\u001b[1;32m 202\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_result\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/asyncio/tasks.py:256\u001b[0m, in \u001b[0;36mTask.__step\u001b[0;34m(***failed resolving arguments***)\u001b[0m\n\u001b[1;32m 252\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 253\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m exc \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 254\u001b[0m \u001b[38;5;66;03m# We use the `send` method directly, because coroutines\u001b[39;00m\n\u001b[1;32m 255\u001b[0m \u001b[38;5;66;03m# don't have `__iter__` and `__next__` methods.\u001b[39;00m\n\u001b[0;32m--> 256\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mcoro\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 257\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 258\u001b[0m result \u001b[38;5;241m=\u001b[39m coro\u001b[38;5;241m.\u001b[39mthrow(exc)\n", - "File \u001b[0;32m~/Documents/GitHub/pyFlapjack/src/flapjack/flapjack.py:239\u001b[0m, in \u001b[0;36mFlapjack._upload_measurements\u001b[0;34m(self, df, **kwargs)\u001b[0m\n\u001b[1;32m 236\u001b[0m uri \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mws_url_base \u001b[38;5;241m+\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m/ws/registry/measurements?token=\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maccess_token\n\u001b[1;32m 238\u001b[0m \u001b[38;5;66;03m# Get the parameter dict from arguments\u001b[39;00m\n\u001b[0;32m--> 239\u001b[0m params \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mparse_params\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 240\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(params)\u001b[38;5;241m==\u001b[39m\u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m 241\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m\n", - "File \u001b[0;32m~/Documents/GitHub/pyFlapjack/src/flapjack/flapjack.py:198\u001b[0m, in \u001b[0;36mFlapjack.parse_params\u001b[0;34m(self, **kwargs)\u001b[0m\n\u001b[1;32m 196\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mparse_params\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 197\u001b[0m \u001b[38;5;66;03m# Get search params and convert ids to python int\u001b[39;00m\n\u001b[0;32m--> 198\u001b[0m params \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 199\u001b[0m model: [\n\u001b[1;32m 200\u001b[0m \u001b[38;5;28mint\u001b[39m(\u001b[38;5;28mid\u001b[39m) \u001b[38;5;28;01mfor\u001b[39;00m \u001b[38;5;28mid\u001b[39m \u001b[38;5;129;01min\u001b[39;00m kwargs\u001b[38;5;241m.\u001b[39mget(model, [])\n\u001b[1;32m 201\u001b[0m ] \u001b[38;5;28;01mfor\u001b[39;00m model \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmodels\n\u001b[1;32m 202\u001b[0m }\n\u001b[1;32m 203\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(params)\u001b[38;5;241m==\u001b[39m\u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m 204\u001b[0m \u001b[38;5;66;03m# Empty query params\u001b[39;00m\n\u001b[1;32m 205\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mEmpty query, no results to return\u001b[39m\u001b[38;5;124m'\u001b[39m)\n", - "File \u001b[0;32m~/Documents/GitHub/pyFlapjack/src/flapjack/flapjack.py:199\u001b[0m, in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 196\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mparse_params\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 197\u001b[0m \u001b[38;5;66;03m# Get search params and convert ids to python int\u001b[39;00m\n\u001b[1;32m 198\u001b[0m params \u001b[38;5;241m=\u001b[39m {\n\u001b[0;32m--> 199\u001b[0m model: [\n\u001b[1;32m 200\u001b[0m \u001b[38;5;28mint\u001b[39m(\u001b[38;5;28mid\u001b[39m) \u001b[38;5;28;01mfor\u001b[39;00m \u001b[38;5;28mid\u001b[39m \u001b[38;5;129;01min\u001b[39;00m kwargs\u001b[38;5;241m.\u001b[39mget(model, [])\n\u001b[1;32m 201\u001b[0m ] \u001b[38;5;28;01mfor\u001b[39;00m model \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmodels\n\u001b[1;32m 202\u001b[0m }\n\u001b[1;32m 203\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(params)\u001b[38;5;241m==\u001b[39m\u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m 204\u001b[0m \u001b[38;5;66;03m# Empty query params\u001b[39;00m\n\u001b[1;32m 205\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mEmpty query, no results to return\u001b[39m\u001b[38;5;124m'\u001b[39m)\n", - "\u001b[0;31mTypeError\u001b[0m: 'numpy.int64' object is not iterable" - ] - } - ], - "source": [ - "import time\n", - "# create measurements\n", - "unique_samples = set(revamp_df[revamp_df['object'] == 'Measurement']['sample'])\n", - "unique_signals = set(revamp_df[revamp_df['object'] == 'Measurement']['signal'])\n", - "for sample in unique_samples:\n", - " sample_id = revamp_df.loc[sample, 'flapjackid']\n", - " for signal in unique_signals:\n", - " signal_id = revamp_df.loc[signal, 'flapjackid']\n", - " measurement_df = revamp_df[(revamp_df['object'] == 'Measurement') & (revamp_df['sample'] == sample) & (revamp_df['signal'] == signal)][['time', 'value']]\n", - " fj.upload_measurements(measurement_df, signal=[signal_id], sample=sample_id)\n", - " time.sleep(10)" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "metadata": {}, - "outputs": [ - { - "ename": "ConnectionClosedError", - "evalue": "received 1011 (unexpected error); then sent 1011 (unexpected error)", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mConnectionClosedError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[27], line 9\u001b[0m\n\u001b[1;32m 7\u001b[0m signal_id \u001b[38;5;241m=\u001b[39m [revamp_df\u001b[38;5;241m.\u001b[39mloc[signal, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mflapjackid\u001b[39m\u001b[38;5;124m'\u001b[39m]]\n\u001b[1;32m 8\u001b[0m measurement_df \u001b[38;5;241m=\u001b[39m revamp_df[(revamp_df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mobject\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m==\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mMeasurement\u001b[39m\u001b[38;5;124m'\u001b[39m) \u001b[38;5;241m&\u001b[39m (revamp_df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124msample\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m==\u001b[39m sample) \u001b[38;5;241m&\u001b[39m (revamp_df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124msignal\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m==\u001b[39m signal)][[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtime\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mvalue\u001b[39m\u001b[38;5;124m'\u001b[39m]]\n\u001b[0;32m----> 9\u001b[0m \u001b[43mfj\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mupload_measurements\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmeasurement_df\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msignal\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msignal_id\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msample\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msample_id\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/Documents/GitHub/pyFlapjack/src/flapjack/flapjack.py:232\u001b[0m, in \u001b[0;36mFlapjack.upload_measurements\u001b[0;34m(self, df, **kwargs)\u001b[0m\n\u001b[1;32m 231\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mupload_measurements\u001b[39m(\u001b[38;5;28mself\u001b[39m, df, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[0;32m--> 232\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43masyncio\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_upload_measurements\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdf\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/site-packages/nest_asyncio.py:32\u001b[0m, in \u001b[0;36m_patch_asyncio..run\u001b[0;34m(future, debug)\u001b[0m\n\u001b[1;32m 30\u001b[0m loop \u001b[38;5;241m=\u001b[39m asyncio\u001b[38;5;241m.\u001b[39mget_event_loop()\n\u001b[1;32m 31\u001b[0m loop\u001b[38;5;241m.\u001b[39mset_debug(debug)\n\u001b[0;32m---> 32\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mloop\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun_until_complete\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfuture\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/site-packages/nest_asyncio.py:70\u001b[0m, in \u001b[0;36m_patch_loop..run_until_complete\u001b[0;34m(self, future)\u001b[0m\n\u001b[1;32m 67\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m f\u001b[38;5;241m.\u001b[39mdone():\n\u001b[1;32m 68\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mRuntimeError\u001b[39;00m(\n\u001b[1;32m 69\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mEvent loop stopped before Future completed.\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m---> 70\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mf\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mresult\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/asyncio/futures.py:201\u001b[0m, in \u001b[0;36mFuture.result\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 199\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m__log_traceback \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[1;32m 200\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_exception \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m--> 201\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_exception\n\u001b[1;32m 202\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_result\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/asyncio/tasks.py:256\u001b[0m, in \u001b[0;36mTask.__step\u001b[0;34m(***failed resolving arguments***)\u001b[0m\n\u001b[1;32m 252\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 253\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m exc \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 254\u001b[0m \u001b[38;5;66;03m# We use the `send` method directly, because coroutines\u001b[39;00m\n\u001b[1;32m 255\u001b[0m \u001b[38;5;66;03m# don't have `__iter__` and `__next__` methods.\u001b[39;00m\n\u001b[0;32m--> 256\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mcoro\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 257\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 258\u001b[0m result \u001b[38;5;241m=\u001b[39m coro\u001b[38;5;241m.\u001b[39mthrow(exc)\n", - "File \u001b[0;32m~/Documents/GitHub/pyFlapjack/src/flapjack/flapjack.py:257\u001b[0m, in \u001b[0;36mFlapjack._upload_measurements\u001b[0;34m(self, df, **kwargs)\u001b[0m\n\u001b[1;32m 255\u001b[0m \u001b[38;5;28;01masync\u001b[39;00m \u001b[38;5;28;01mwith\u001b[39;00m websockets\u001b[38;5;241m.\u001b[39mconnect(uri, max_size\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m1e10\u001b[39m) \u001b[38;5;28;01mas\u001b[39;00m websocket:\n\u001b[1;32m 256\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m websocket\u001b[38;5;241m.\u001b[39msend(json\u001b[38;5;241m.\u001b[39mdumps(payload))\n\u001b[0;32m--> 257\u001b[0m response_json \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mawait\u001b[39;00m websocket\u001b[38;5;241m.\u001b[39mrecv()\n\u001b[1;32m 258\u001b[0m response_data \u001b[38;5;241m=\u001b[39m json\u001b[38;5;241m.\u001b[39mloads(response_json)\n\u001b[1;32m 259\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m response_data[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtype\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;241m==\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124merror\u001b[39m\u001b[38;5;124m'\u001b[39m:\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/site-packages/websockets/legacy/protocol.py:552\u001b[0m, in \u001b[0;36mWebSocketCommonProtocol.recv\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 548\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;66;03m# type: ignore\u001b[39;00m\n\u001b[1;32m 549\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 550\u001b[0m \u001b[38;5;66;03m# Wait until the connection is closed to raise\u001b[39;00m\n\u001b[1;32m 551\u001b[0m \u001b[38;5;66;03m# ConnectionClosed with the correct code and reason.\u001b[39;00m\n\u001b[0;32m--> 552\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mensure_open()\n\u001b[1;32m 554\u001b[0m \u001b[38;5;66;03m# Pop a message from the queue.\u001b[39;00m\n\u001b[1;32m 555\u001b[0m message \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmessages\u001b[38;5;241m.\u001b[39mpopleft()\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/site-packages/websockets/legacy/protocol.py:929\u001b[0m, in \u001b[0;36mWebSocketCommonProtocol.ensure_open\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 922\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstate \u001b[38;5;129;01mis\u001b[39;00m State\u001b[38;5;241m.\u001b[39mCLOSING:\n\u001b[1;32m 923\u001b[0m \u001b[38;5;66;03m# If we started the closing handshake, wait for its completion to\u001b[39;00m\n\u001b[1;32m 924\u001b[0m \u001b[38;5;66;03m# get the proper close code and reason. self.close_connection_task\u001b[39;00m\n\u001b[1;32m 925\u001b[0m \u001b[38;5;66;03m# will complete within 4 or 5 * close_timeout after close(). The\u001b[39;00m\n\u001b[1;32m 926\u001b[0m \u001b[38;5;66;03m# CLOSING state also occurs when failing the connection. In that\u001b[39;00m\n\u001b[1;32m 927\u001b[0m \u001b[38;5;66;03m# case self.close_connection_task will complete even faster.\u001b[39;00m\n\u001b[1;32m 928\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m asyncio\u001b[38;5;241m.\u001b[39mshield(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mclose_connection_task)\n\u001b[0;32m--> 929\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconnection_closed_exc()\n\u001b[1;32m 931\u001b[0m \u001b[38;5;66;03m# Control may only reach this point in buggy third-party subclasses.\u001b[39;00m\n\u001b[1;32m 932\u001b[0m \u001b[38;5;28;01massert\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstate \u001b[38;5;129;01mis\u001b[39;00m State\u001b[38;5;241m.\u001b[39mCONNECTING\n", - "\u001b[0;31mConnectionClosedError\u001b[0m: received 1011 (unexpected error); then sent 1011 (unexpected error)" - ] - } - ], - "source": [ - "# create measurements\n", - "unique_samples = set(revamp_df[revamp_df['object'] == 'Measurement']['sample'])\n", - "unique_signals = set(revamp_df[revamp_df['object'] == 'Measurement']['signal'])\n", - "for sample in unique_samples:\n", - " sample_id = [revamp_df.loc[sample, 'flapjackid']]\n", - " for signal in unique_signals:\n", - " signal_id = [revamp_df.loc[signal, 'flapjackid']]\n", - " measurement_df = revamp_df[(revamp_df['object'] == 'Measurement') & (revamp_df['sample'] == sample) & (revamp_df['signal'] == signal)][['time', 'value']]\n", - " fj.upload_measurements(measurement_df, signal=signal_id, sample=sample_id)\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# create measurements\n", - "unique_samples = set(revamp_df[revamp_df['object'] == 'Measurement']['sample'])\n", - "unique_signals = set(revamp_df[revamp_df['object'] == 'Measurement']['signal'])\n", - "for sample in unique_samples:\n", - " sample_id = revamp_df.loc[sample, 'flapjackid']\n", - " for signal in unique_signals:\n", - " signal_id = revamp_df.loc[signal, 'flapjackid']\n", - " measurement_df = revamp_df[revamp_df['object'] == 'Measurement'][revamp_df['sample'] == sample][revamp_df['signal'] == signal][['time', 'value']]\n", - " fj.upload_measurements(measurement_df, signal=[signal_id], sample=sample_id)\n" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
timevalue
Measurement2000.000.000000
Measurement2020.251.725928
Measurement2040.501.462755
Measurement2060.751.145845
Measurement2081.001.236872
Measurement2101.251.311550
Measurement2121.501.647446
Measurement2141.752.025493
Measurement2162.002.664766
Measurement2182.253.073661
\n", - "
" - ], - "text/plain": [ - " time value\n", - "Measurement200 0.00 0.000000\n", - "Measurement202 0.25 1.725928\n", - "Measurement204 0.50 1.462755\n", - "Measurement206 0.75 1.145845\n", - "Measurement208 1.00 1.236872\n", - "Measurement210 1.25 1.311550\n", - "Measurement212 1.50 1.647446\n", - "Measurement214 1.75 2.025493\n", - "Measurement216 2.00 2.664766\n", - "Measurement218 2.25 3.073661" - ] - }, - "execution_count": 26, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "measurement_df" - ] - }, - { - "cell_type": "code", - "execution_count": 63, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/var/folders/65/dt4l3nw13q57n8x9nlly46640000gn/T/ipykernel_28112/3758165704.py:1: UserWarning:\n", - "\n", - "Boolean Series key will be reindexed to match DataFrame index.\n", - "\n" - ] - }, - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
timevalue
Measurement2010.000.010444
Measurement2030.250.010294
Measurement2050.500.011338
Measurement2070.750.012736
Measurement2091.000.013692
Measurement2111.250.015990
Measurement2131.500.018740
Measurement2151.750.022822
Measurement2172.000.026213
Measurement2192.250.035800
\n", - "
" - ], - "text/plain": [ - " time value\n", - "Measurement201 0.00 0.010444\n", - "Measurement203 0.25 0.010294\n", - "Measurement205 0.50 0.011338\n", - "Measurement207 0.75 0.012736\n", - "Measurement209 1.00 0.013692\n", - "Measurement211 1.25 0.015990\n", - "Measurement213 1.50 0.018740\n", - "Measurement215 1.75 0.022822\n", - "Measurement217 2.00 0.026213\n", - "Measurement219 2.25 0.035800" - ] - }, - "execution_count": 63, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "measurement_df = revamp_df[revamp_df['object'] == 'Measurement'][revamp_df['sample'] == sample][revamp_df['signal'] == signal][['time', 'value']]\n", - "measurement_df" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "media_id = revamp_df.loc[media_index, 'flapjackid']" - ] - }, - { - "cell_type": "code", - "execution_count": 61, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Sample2\n", - "21696\n", - "Sample1\n", - "21695\n" - ] - } - ], - "source": [ - "for i in unique_samples:\n", - " print(i)\n", - " sample_id = revamp_df.loc[i, 'flapjackid']\n", - " print(sample_id)" - ] - }, - { - "cell_type": "code", - "execution_count": 40, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'Sample1', 'Sample2'}" - ] - }, - "execution_count": 40, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "unique_samples = set(revamp_df[revamp_df['object'] == 'Measurement']['sample'])\n", - "unique_samples" - ] - }, - { - "cell_type": "code", - "execution_count": 51, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "{'Signal1', 'Signal9'}" - ] - }, - "execution_count": 51, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "unique_signals = set(revamp_df[revamp_df['object'] == 'Measurement']['signal'])\n", - "unique_signals" - ] - }, - { - "cell_type": "code", - "execution_count": 45, - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/var/folders/65/dt4l3nw13q57n8x9nlly46640000gn/T/ipykernel_28112/1582080924.py:2: UserWarning:\n", - "\n", - "Boolean Series key will be reindexed to match DataFrame index.\n", - "\n" - ] - }, - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
namedescriptionpubchemidobjectflapjackidchemicalconcentrationdnacolorDOI...assaysampledesignsamplesignaltimevaluemediastrainvectorsupplement
Measurement0NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal90.000.000000NaNNaNNaNNaN
Measurement1NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal10.000.010331NaNNaNNaNNaN
Measurement2NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal90.251.953695NaNNaNNaNNaN
Measurement3NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal10.250.010752NaNNaNNaNNaN
Measurement4NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal90.501.715337NaNNaNNaNNaN
Measurement5NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal10.500.011156NaNNaNNaNNaN
Measurement6NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal90.751.678607NaNNaNNaNNaN
Measurement7NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal10.750.012010NaNNaNNaNNaN
Measurement8NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal91.001.587738NaNNaNNaNNaN
Measurement9NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal11.000.013234NaNNaNNaNNaN
Measurement10NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal91.251.612557NaNNaNNaNNaN
Measurement11NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal11.250.016093NaNNaNNaNNaN
Measurement12NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal91.501.740648NaNNaNNaNNaN
Measurement13NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal11.500.018807NaNNaNNaNNaN
Measurement14NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal91.752.094849NaNNaNNaNNaN
Measurement15NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal11.750.022730NaNNaNNaNNaN
Measurement16NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal92.002.715779NaNNaNNaNNaN
Measurement17NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal12.000.027194NaNNaNNaNNaN
Measurement18NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal92.253.815254NaNNaNNaNNaN
Measurement19NaNNaNNaNMeasurementNaNNaNNaNNaNNaN...NaNNaNSample1Signal12.250.034800NaNNaNNaNNaN
\n", - "

20 rows × 25 columns

\n", - "
" - ], - "text/plain": [ - " name description pubchemid object flapjackid chemical \\\n", - "Measurement0 NaN NaN NaN Measurement NaN \n", - "Measurement1 NaN NaN NaN Measurement NaN \n", - "Measurement2 NaN NaN NaN Measurement NaN \n", - "Measurement3 NaN NaN NaN Measurement NaN \n", - "Measurement4 NaN NaN NaN Measurement NaN \n", - "Measurement5 NaN NaN NaN Measurement NaN \n", - "Measurement6 NaN NaN NaN Measurement NaN \n", - "Measurement7 NaN NaN NaN Measurement NaN \n", - "Measurement8 NaN NaN NaN Measurement NaN \n", - "Measurement9 NaN NaN NaN Measurement NaN \n", - "Measurement10 NaN NaN NaN Measurement NaN \n", - "Measurement11 NaN NaN NaN Measurement NaN \n", - "Measurement12 NaN NaN NaN Measurement NaN \n", - "Measurement13 NaN NaN NaN Measurement NaN \n", - "Measurement14 NaN NaN NaN Measurement NaN \n", - "Measurement15 NaN NaN NaN Measurement NaN \n", - "Measurement16 NaN NaN NaN Measurement NaN \n", - "Measurement17 NaN NaN NaN Measurement NaN \n", - "Measurement18 NaN NaN NaN Measurement NaN \n", - "Measurement19 NaN NaN NaN Measurement NaN \n", - "\n", - " concentration dna color DOI ... assay sampledesign \\\n", - "Measurement0 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement1 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement2 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement3 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement4 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement5 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement6 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement7 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement8 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement9 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement10 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement11 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement12 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement13 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement14 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement15 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement16 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement17 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement18 NaN NaN NaN NaN ... NaN NaN \n", - "Measurement19 NaN NaN NaN NaN ... NaN NaN \n", - "\n", - " sample signal time value media strain vector \\\n", - "Measurement0 Sample1 Signal9 0.00 0.000000 NaN NaN NaN \n", - "Measurement1 Sample1 Signal1 0.00 0.010331 NaN NaN NaN \n", - "Measurement2 Sample1 Signal9 0.25 1.953695 NaN NaN NaN \n", - "Measurement3 Sample1 Signal1 0.25 0.010752 NaN NaN NaN \n", - "Measurement4 Sample1 Signal9 0.50 1.715337 NaN NaN NaN \n", - "Measurement5 Sample1 Signal1 0.50 0.011156 NaN NaN NaN \n", - "Measurement6 Sample1 Signal9 0.75 1.678607 NaN NaN NaN \n", - "Measurement7 Sample1 Signal1 0.75 0.012010 NaN NaN NaN \n", - "Measurement8 Sample1 Signal9 1.00 1.587738 NaN NaN NaN \n", - "Measurement9 Sample1 Signal1 1.00 0.013234 NaN NaN NaN \n", - "Measurement10 Sample1 Signal9 1.25 1.612557 NaN NaN NaN \n", - "Measurement11 Sample1 Signal1 1.25 0.016093 NaN NaN NaN \n", - "Measurement12 Sample1 Signal9 1.50 1.740648 NaN NaN NaN \n", - "Measurement13 Sample1 Signal1 1.50 0.018807 NaN NaN NaN \n", - "Measurement14 Sample1 Signal9 1.75 2.094849 NaN NaN NaN \n", - "Measurement15 Sample1 Signal1 1.75 0.022730 NaN NaN NaN \n", - "Measurement16 Sample1 Signal9 2.00 2.715779 NaN NaN NaN \n", - "Measurement17 Sample1 Signal1 2.00 0.027194 NaN NaN NaN \n", - "Measurement18 Sample1 Signal9 2.25 3.815254 NaN NaN NaN \n", - "Measurement19 Sample1 Signal1 2.25 0.034800 NaN NaN NaN \n", - "\n", - " supplement \n", - "Measurement0 NaN \n", - "Measurement1 NaN \n", - "Measurement2 NaN \n", - "Measurement3 NaN \n", - "Measurement4 NaN \n", - "Measurement5 NaN \n", - "Measurement6 NaN \n", - "Measurement7 NaN \n", - "Measurement8 NaN \n", - "Measurement9 NaN \n", - "Measurement10 NaN \n", - "Measurement11 NaN \n", - "Measurement12 NaN \n", - "Measurement13 NaN \n", - "Measurement14 NaN \n", - "Measurement15 NaN \n", - "Measurement16 NaN \n", - "Measurement17 NaN \n", - "Measurement18 NaN \n", - "Measurement19 NaN \n", - "\n", - "[20 rows x 25 columns]" - ] - }, - "execution_count": 45, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# create a dataframe containing only the measurements\n", - "measurement_df = revamp_df[revamp_df['object'] == 'Measurement'][revamp_df['sample'] == 'Sample1']\n", - "measurement_df\n" - ] - }, - { - "cell_type": "code", - "execution_count": 50, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
timevalue
Measurement00.000.000000
Measurement10.000.010331
Measurement20.251.953695
Measurement30.250.010752
Measurement40.501.715337
Measurement50.500.011156
Measurement60.751.678607
Measurement70.750.012010
Measurement81.001.587738
Measurement91.000.013234
Measurement101.251.612557
Measurement111.250.016093
Measurement121.501.740648
Measurement131.500.018807
Measurement141.752.094849
Measurement151.750.022730
Measurement162.002.715779
Measurement172.000.027194
Measurement182.253.815254
Measurement192.250.034800
\n", - "
" - ], - "text/plain": [ - " time value\n", - "Measurement0 0.00 0.000000\n", - "Measurement1 0.00 0.010331\n", - "Measurement2 0.25 1.953695\n", - "Measurement3 0.25 0.010752\n", - "Measurement4 0.50 1.715337\n", - "Measurement5 0.50 0.011156\n", - "Measurement6 0.75 1.678607\n", - "Measurement7 0.75 0.012010\n", - "Measurement8 1.00 1.587738\n", - "Measurement9 1.00 0.013234\n", - "Measurement10 1.25 1.612557\n", - "Measurement11 1.25 0.016093\n", - "Measurement12 1.50 1.740648\n", - "Measurement13 1.50 0.018807\n", - "Measurement14 1.75 2.094849\n", - "Measurement15 1.75 0.022730\n", - "Measurement16 2.00 2.715779\n", - "Measurement17 2.00 0.027194\n", - "Measurement18 2.25 3.815254\n", - "Measurement19 2.25 0.034800" - ] - }, - "execution_count": 50, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "#create a DataFrame just with time and value columns\n", - "data_df = measurement_df[['time', 'value']]\n", - "data_df" - ] - }, - { - "cell_type": "code", - "execution_count": 48, - "metadata": {}, - "outputs": [ - { - "ename": "KeyError", - "evalue": "\"None of [Index(['Signal9', 'Signal1', 'Signal9', 'Signal1', 'Signal9', 'Signal1',\\n 'Signal9', 'Signal1', 'Signal9', 'Signal1', 'Signal9', 'Signal1',\\n 'Signal9', 'Signal1', 'Signal9', 'Signal1', 'Signal9', 'Signal1',\\n 'Signal9', 'Signal1'],\\n dtype='object')] are in the [columns]\"", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[48], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m data_df \u001b[38;5;241m=\u001b[39m \u001b[43mmeasurement_df\u001b[49m\u001b[43m[\u001b[49m\u001b[43mmeasurement_df\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43msignal\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m, measurement_df[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mvalue\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[1;32m 2\u001b[0m data_df\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/site-packages/pandas/core/frame.py:3464\u001b[0m, in \u001b[0;36mDataFrame.__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 3462\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m is_iterator(key):\n\u001b[1;32m 3463\u001b[0m key \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlist\u001b[39m(key)\n\u001b[0;32m-> 3464\u001b[0m indexer \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mloc\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_get_listlike_indexer\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43maxis\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m)\u001b[49m[\u001b[38;5;241m1\u001b[39m]\n\u001b[1;32m 3466\u001b[0m \u001b[38;5;66;03m# take() does not accept boolean indexers\u001b[39;00m\n\u001b[1;32m 3467\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mgetattr\u001b[39m(indexer, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdtype\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m) \u001b[38;5;241m==\u001b[39m \u001b[38;5;28mbool\u001b[39m:\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/site-packages/pandas/core/indexing.py:1314\u001b[0m, in \u001b[0;36m_LocIndexer._get_listlike_indexer\u001b[0;34m(self, key, axis)\u001b[0m\n\u001b[1;32m 1311\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 1312\u001b[0m keyarr, indexer, new_indexer \u001b[38;5;241m=\u001b[39m ax\u001b[38;5;241m.\u001b[39m_reindex_non_unique(keyarr)\n\u001b[0;32m-> 1314\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_validate_read_indexer\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkeyarr\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mindexer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43maxis\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1316\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m needs_i8_conversion(ax\u001b[38;5;241m.\u001b[39mdtype) \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(\n\u001b[1;32m 1317\u001b[0m ax, (IntervalIndex, CategoricalIndex)\n\u001b[1;32m 1318\u001b[0m ):\n\u001b[1;32m 1319\u001b[0m \u001b[38;5;66;03m# For CategoricalIndex take instead of reindex to preserve dtype.\u001b[39;00m\n\u001b[1;32m 1320\u001b[0m \u001b[38;5;66;03m# For IntervalIndex this is to map integers to the Intervals they match to.\u001b[39;00m\n\u001b[1;32m 1321\u001b[0m keyarr \u001b[38;5;241m=\u001b[39m ax\u001b[38;5;241m.\u001b[39mtake(indexer)\n", - "File \u001b[0;32m~/opt/anaconda3/envs/LOICA/lib/python3.9/site-packages/pandas/core/indexing.py:1374\u001b[0m, in \u001b[0;36m_LocIndexer._validate_read_indexer\u001b[0;34m(self, key, indexer, axis)\u001b[0m\n\u001b[1;32m 1372\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m use_interval_msg:\n\u001b[1;32m 1373\u001b[0m key \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlist\u001b[39m(key)\n\u001b[0;32m-> 1374\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mNone of [\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mkey\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m] are in the [\u001b[39m\u001b[38;5;132;01m{\u001b[39;00maxis_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m]\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 1376\u001b[0m not_found \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlist\u001b[39m(ensure_index(key)[missing_mask\u001b[38;5;241m.\u001b[39mnonzero()[\u001b[38;5;241m0\u001b[39m]]\u001b[38;5;241m.\u001b[39munique())\n\u001b[1;32m 1377\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mnot_found\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m not in index\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", - "\u001b[0;31mKeyError\u001b[0m: \"None of [Index(['Signal9', 'Signal1', 'Signal9', 'Signal1', 'Signal9', 'Signal1',\\n 'Signal9', 'Signal1', 'Signal9', 'Signal1', 'Signal9', 'Signal1',\\n 'Signal9', 'Signal1', 'Signal9', 'Signal1', 'Signal9', 'Signal1',\\n 'Signal9', 'Signal1'],\\n dtype='object')] are in the [columns]\"" - ] - } - ], - "source": [ - "data_df = measurement_df[measurement_df['signal']], measurement_df['value']\n", - "data_df" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "revamp_df[revamp_df['object'] == 'Measurement']['sample'][revamp_df['object'] == 'Measurement']['sample']" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "#create measurements\n" - ] - }, - { - "cell_type": "code", - "execution_count": 62, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
namedescriptionpubchemidobjectchemicalconcentrationdnacolorDOImachine...studyrowcolassaymediastrainsamplesignaltimevalue
Study1excel2flapjacke2f testNaNStudyNaNNaNNaNNaNhttps://doi.org/10.1371/journal.pone.0187163NaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN
\n", - "

1 rows × 21 columns

\n", - "
" - ], - "text/plain": [ - " name description pubchemid object chemical concentration \\\n", - "Study1 excel2flapjack e2f test NaN Study NaN NaN \n", - "\n", - " dna color DOI machine ... \\\n", - "Study1 NaN NaN https://doi.org/10.1371/journal.pone.0187163 NaN ... \n", - "\n", - " study row col assay media strain sample signal time value \n", - "Study1 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN \n", - "\n", - "[1 rows x 21 columns]" - ] - }, - "execution_count": 62, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "revamp_df[revamp_df['object'] == 'Study']" - ] - }, - { - "cell_type": "code", - "execution_count": 51, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'ATC'" - ] - }, - "execution_count": 51, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# select the chemical name using loc and column name\n", - "revamp_df.loc['Chemical1']['name']" - ] - }, - { - "cell_type": "code", - "execution_count": 52, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'excel2flapjack'" - ] - }, - "execution_count": 52, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "revamp_df.loc['Study1']['name']" - ] - }, - { - "cell_type": "code", - "execution_count": 34, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
namedescriptionpubchemidchemicalconcentrationdnacolorDOImachinetemperature...rowcolassaymediastrainsamplesignaltimevalueType
Chemical1ATCInducerPubchem 1NaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNChemical1
Chemical2IPTGInducerPubchem 2NaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNChemical2
DNA1Rep_HIGH_degrateNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNDNA1
DNA2Rep_LOW_degrateNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNDNA2
DNA3ReporterNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNDNA3
Supplement1ATCNaNNaNChemical10.2NaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNSupplement1
Supplement2IPTGNaNNaNChemical20.3NaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNSupplement2
Rep_1Repressilator1NaNNaNNaNNaNDNA1NaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNRep
Rep_2Repressilator2NaNNaNNaNNaNDNA2NaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNRep
EcoliT7E_coli_T7E.coli T7NaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNEcoliT7
M9GlucoseM9GlucoseImaging mediaNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNM9Glucose
Signal1BiomassbiomassNaNNaNNaNNaNblackNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNSignal1
Signal9GFPfluorescentNaNNaNNaNNaNgreenNaNNaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNSignal9
Study1excel2flapjacke2f testNaNNaNNaNNaNNaNhttps://doi.org/10.1371/journal.pone.0187163NaNNaN...NaNNaNNaNNaNNaNNaNNaNNaNNaNStudy1
Assay1GFP Plate 1GFP Plate 1NaNNaNNaNNaNNaNNaNHTX Synergy37.0...NaNNaNNaNNaNNaNNaNNaNNaNNaNAssay1
Assay2GFP Plate 2GFP Plate 2NaNNaNNaNNaNNaNNaNHTX Synergy37.0...NaNNaNNaNNaNNaNNaNNaNNaNNaNAssay2
Sample1NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN...1.01.0Assay1M9GlucoseEcoliT7NaNNaNNaNNaNSample1
Sample2NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN...1.02.0Assay2M9GlucoseEcoliT7NaNNaNNaNNaNSample2
Sample3NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN...2.01.0Assay1M9GlucoseEcoliT7NaNNaNNaNNaNSample3
Sample4NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN...2.02.0Assay2M9GlucoseEcoliT7NaNNaNNaNNaNSample4
Measurement0NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNSample1Signal90.000.000000Measurement0
Measurement1NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNSample1Signal10.000.010331Measurement1
Measurement2NaNNaNNaNNaNNaNNaNNaNNaNNaNNaN...NaNNaNNaNNaNNaNSample1Signal90.251.953695Measurement2
\n", - "

23 rows × 21 columns

\n", - "
" - ], - "text/plain": [ - " name description pubchemid chemical \\\n", - "Chemical1 ATC Inducer Pubchem 1 NaN \n", - "Chemical2 IPTG Inducer Pubchem 2 NaN \n", - "DNA1 Rep_HIGH_degrate NaN NaN NaN \n", - "DNA2 Rep_LOW_degrate NaN NaN NaN \n", - "DNA3 Reporter NaN NaN NaN \n", - "Supplement1 ATC NaN NaN Chemical1 \n", - "Supplement2 IPTG NaN NaN Chemical2 \n", - "Rep_1 Repressilator1 NaN NaN NaN \n", - "Rep_2 Repressilator2 NaN NaN NaN \n", - "EcoliT7 E_coli_T7 E.coli T7 NaN NaN \n", - "M9Glucose M9Glucose Imaging media NaN NaN \n", - "Signal1 Biomass biomass NaN NaN \n", - "Signal9 GFP fluorescent NaN NaN \n", - "Study1 excel2flapjack e2f test NaN NaN \n", - "Assay1 GFP Plate 1 GFP Plate 1 NaN NaN \n", - "Assay2 GFP Plate 2 GFP Plate 2 NaN NaN \n", - "Sample1 NaN NaN NaN NaN \n", - "Sample2 NaN NaN NaN NaN \n", - "Sample3 NaN NaN NaN NaN \n", - "Sample4 NaN NaN NaN NaN \n", - "Measurement0 NaN NaN NaN NaN \n", - "Measurement1 NaN NaN NaN NaN \n", - "Measurement2 NaN NaN NaN NaN \n", - "\n", - " concentration dna color \\\n", - "Chemical1 NaN NaN NaN \n", - "Chemical2 NaN NaN NaN \n", - "DNA1 NaN NaN NaN \n", - "DNA2 NaN NaN NaN \n", - "DNA3 NaN NaN NaN \n", - "Supplement1 0.2 NaN NaN \n", - "Supplement2 0.3 NaN NaN \n", - "Rep_1 NaN DNA1 NaN \n", - "Rep_2 NaN DNA2 NaN \n", - "EcoliT7 NaN NaN NaN \n", - "M9Glucose NaN NaN NaN \n", - "Signal1 NaN NaN black \n", - "Signal9 NaN NaN green \n", - "Study1 NaN NaN NaN \n", - "Assay1 NaN NaN NaN \n", - "Assay2 NaN NaN NaN \n", - "Sample1 NaN NaN NaN \n", - "Sample2 NaN NaN NaN \n", - "Sample3 NaN NaN NaN \n", - "Sample4 NaN NaN NaN \n", - "Measurement0 NaN NaN NaN \n", - "Measurement1 NaN NaN NaN \n", - "Measurement2 NaN NaN NaN \n", - "\n", - " DOI machine \\\n", - "Chemical1 NaN NaN \n", - "Chemical2 NaN NaN \n", - "DNA1 NaN NaN \n", - "DNA2 NaN NaN \n", - "DNA3 NaN NaN \n", - "Supplement1 NaN NaN \n", - "Supplement2 NaN NaN \n", - "Rep_1 NaN NaN \n", - "Rep_2 NaN NaN \n", - "EcoliT7 NaN NaN \n", - "M9Glucose NaN NaN \n", - "Signal1 NaN NaN \n", - "Signal9 NaN NaN \n", - "Study1 https://doi.org/10.1371/journal.pone.0187163 NaN \n", - "Assay1 NaN HTX Synergy \n", - "Assay2 NaN HTX Synergy \n", - "Sample1 NaN NaN \n", - "Sample2 NaN NaN \n", - "Sample3 NaN NaN \n", - "Sample4 NaN NaN \n", - "Measurement0 NaN NaN \n", - "Measurement1 NaN NaN \n", - "Measurement2 NaN NaN \n", - "\n", - " temperature ... row col assay media strain sample \\\n", - "Chemical1 NaN ... NaN NaN NaN NaN NaN NaN \n", - "Chemical2 NaN ... NaN NaN NaN NaN NaN NaN \n", - "DNA1 NaN ... NaN NaN NaN NaN NaN NaN \n", - "DNA2 NaN ... NaN NaN NaN NaN NaN NaN \n", - "DNA3 NaN ... NaN NaN NaN NaN NaN NaN \n", - "Supplement1 NaN ... NaN NaN NaN NaN NaN NaN \n", - "Supplement2 NaN ... NaN NaN NaN NaN NaN NaN \n", - "Rep_1 NaN ... NaN NaN NaN NaN NaN NaN \n", - "Rep_2 NaN ... NaN NaN NaN NaN NaN NaN \n", - "EcoliT7 NaN ... NaN NaN NaN NaN NaN NaN \n", - "M9Glucose NaN ... NaN NaN NaN NaN NaN NaN \n", - "Signal1 NaN ... NaN NaN NaN NaN NaN NaN \n", - "Signal9 NaN ... NaN NaN NaN NaN NaN NaN \n", - "Study1 NaN ... NaN NaN NaN NaN NaN NaN \n", - "Assay1 37.0 ... NaN NaN NaN NaN NaN NaN \n", - "Assay2 37.0 ... NaN NaN NaN NaN NaN NaN \n", - "Sample1 NaN ... 1.0 1.0 Assay1 M9Glucose EcoliT7 NaN \n", - "Sample2 NaN ... 1.0 2.0 Assay2 M9Glucose EcoliT7 NaN \n", - "Sample3 NaN ... 2.0 1.0 Assay1 M9Glucose EcoliT7 NaN \n", - "Sample4 NaN ... 2.0 2.0 Assay2 M9Glucose EcoliT7 NaN \n", - "Measurement0 NaN ... NaN NaN NaN NaN NaN Sample1 \n", - "Measurement1 NaN ... NaN NaN NaN NaN NaN Sample1 \n", - "Measurement2 NaN ... NaN NaN NaN NaN NaN Sample1 \n", - "\n", - " signal time value Type \n", - "Chemical1 NaN NaN NaN Chemical1 \n", - "Chemical2 NaN NaN NaN Chemical2 \n", - "DNA1 NaN NaN NaN DNA1 \n", - "DNA2 NaN NaN NaN DNA2 \n", - "DNA3 NaN NaN NaN DNA3 \n", - "Supplement1 NaN NaN NaN Supplement1 \n", - "Supplement2 NaN NaN NaN Supplement2 \n", - "Rep_1 NaN NaN NaN Rep \n", - "Rep_2 NaN NaN NaN Rep \n", - "EcoliT7 NaN NaN NaN EcoliT7 \n", - "M9Glucose NaN NaN NaN M9Glucose \n", - "Signal1 NaN NaN NaN Signal1 \n", - "Signal9 NaN NaN NaN Signal9 \n", - "Study1 NaN NaN NaN Study1 \n", - "Assay1 NaN NaN NaN Assay1 \n", - "Assay2 NaN NaN NaN Assay2 \n", - "Sample1 NaN NaN NaN Sample1 \n", - "Sample2 NaN NaN NaN Sample2 \n", - "Sample3 NaN NaN NaN Sample3 \n", - "Sample4 NaN NaN NaN Sample4 \n", - "Measurement0 Signal9 0.00 0.000000 Measurement0 \n", - "Measurement1 Signal1 0.00 0.010331 Measurement1 \n", - "Measurement2 Signal9 0.25 1.953695 Measurement2 \n", - "\n", - "[23 rows x 21 columns]" - ] - }, - "execution_count": 34, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# add column to indicate object type\n", - "revamp_df['Type'] = revamp_df.index.str.split('_').str[0]\n", - "revamp_df\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "\n", - "# order is important as Chemicals and DNA must be created before\n", - "# they can be referenced\n", - "\n", - "\n", - " # Create a dictionary of the data for flapjack\n", - " obj_dict = obj_df.to_dict('index')\n", - "\n", - " # Upload all the objects to flapjack\n", - " for key in obj_dict:\n", - " if print_progress:\n", - " print(key)\n", - " data = obj_dict[key]\n", - "\n", - " if key in sbol_hash_map and add_sbol_uris:\n", - " data['sboluri'] = sbol_hash_map[key]\n", - "\n", - " # Change to flapjack id rather than name for chemicals and dnas\n", - " lookups = {'chemical', 'dnas', 'study', 'vector', 'strain', 'media', 'assay', 'sample', 'signal'}\n", - " lk_inter = lookups.intersection(set(data.keys()))\n", - " for it in list(lk_inter):\n", - " data[it] = hash_map[data[it]]\n", - "\n", - " data['model'] = obj.lower()\n", - " print(data)\n", - " flapjack_id = fj.create(**data, confirm=not(flapjack_override))\n", - "\n", - " # add Chemical and DNA to hash map to allow cross referencing\n", - " hash_map[key] = flapjack_id.id[0]\n", - "\n", - "return hash_map" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Extra things" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "plate_96_wells = [\n", - "'A1','A2','A3','A4','A5','A6','A7','A8','A9','A10','A11','A12',\n", - "'B1','B2','B3','B4','B5','B6','B7','B8','B9','B10','B11','B12',\n", - "'C1','C2','C3','C4','C5','C6','C7','C8','C9','C10','C11','C12',\n", - "'D1','D2','D3','D4','D5','D6','D7','D8','D9','D10','D11','D12',\n", - "'E1','E2','E3','E4','E5','E6','E7','E8','E9','E10','E11','E12',\n", - "'F1','F2','F3','F4','F5','F6','F7','F8','F9','F10','F11','F12',\n", - "'G1','G2','G3','G4','G5','G6','G7','G8','G9','G10','G11','G12',\n", - "'H1','H2','H3','H4','H5','H6','H7','H8','H9','H10','H11','H12'\n", - "]" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "A1\n", - "A2\n", - "A3\n", - "A4\n", - "A5\n", - "A6\n", - "A7\n", - "A8\n", - "A9\n", - "A10\n", - "A11\n" - ] - } - ], - "source": [ - "for i in range(0,11):\n", - " print(plate_96_wells[i])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "LOICA", - "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.9.18" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/src/excel2flapjack/main.py b/src/excel2flapjack/main.py deleted file mode 100644 index 1f2118b..0000000 --- a/src/excel2flapjack/main.py +++ /dev/null @@ -1,360 +0,0 @@ -import os -import pandas as pd -from flapjack import Flapjack - -class X2F: - - """ - inputData retrives information from input XDC excel template, connects to fj, and formats and uploads data - includes: - - class definition - - initialization method - - class attributes - - instance attributes - - methods - - - Instance Attributes - ---------- - fj : flapjack.flapjack.Flapjack object - fj case that contains the connection to fj account - - excel_path: path - path to XDC spreadsheet - - df : pandas dataframe - contains all the information from XDC file in a format that can be used by FJ - - hash_map: hash map - key: name of study attributes from XDC spreadsheet - value: corresponding flapjackID - - fj_conv_sht: dataframe - dataframe containing information from XDC spreadsheet FJ conversion page - - Sheet name: name of sheet containing rest of info - - ColName: name of column on 'Sheet name' containing XDC data - - FlapjackName: name of flapjack object corresponding to respective XDC data - - - """ - # list of all the sheet names in XDC excel file - # each will define an fj object with data extracted from the excel sheet - # use self.types to access this class attribute - types = ['Chemical', 'DNA', 'Supplement', 'Vector', 'Strain', 'Media', - 'Signal', 'Study', 'Assay', 'Sample', 'Measurement', 'Sample Design'] - - - def __init__(self, - excel_path, - fj_url, - fj_user, - fj_pass): - # fj url has to include 8000 port - if not fj_url.endswith(":8000"): - fj_url = fj_url + ":8000" - - self.fj = Flapjack(url_base=fj_url) - # for testing log_in, no login just returns None - # create a new method for this so we can call it and make sure we're logged in before running the rest of everything - self.fj.log_in(username = fj_user, password = fj_pass) - - # convert excel path to pd.Excel File and parse - self.xls = pd.ExcelFile(excel_path) - self.fj_conv_sht = self.xls.parse('FlapjackCols', skiprows=0) - self.df = pd.DataFrame() - self.hash_map = {} - self.del_map = {} - - # def fj_login(fj_user, fj_pass): - # self.fj.log_in(username = fj_user, password=fj_pass) - - - def print_info(self, fj_sht = False, df=False, hash_map=False): - if fj_sht: - print(self.fj_conv_sht) - if df: - print(self.df.head()) - print(self.df.info()) - if hash_map: - print(self.hash_map) - - def create_df(self): - - for obj in self.types: - # read in the conversion sheet for xdc col name to flapjack name - # for current obj - fj_conv_sht_obj = self.fj_conv_sht.loc[(self.fj_conv_sht['Sheet Name'] == obj)] - fj_conv_sht_obj = fj_conv_sht_obj.set_index('ColName').to_dict('index') - - # read in current obj sheet - obj_df = self.xls.parse(obj, skiprows=0, index_col=f'{obj} ID') - cols = list(obj_df.columns) - - # drop cols not used by fj and rename ones that are - new_cols = [] - drop_cols = [] - for col in cols: - if col in fj_conv_sht_obj.keys(): - new_cols.append(fj_conv_sht_obj[col]['FlapjackName']) - else: - drop_cols.append(col) - - obj_df = obj_df.drop(columns=drop_cols) - obj_df.columns = new_cols - obj_df['object'] = obj - obj_df['flapjackid'] = '' - - self.df = self.df.append(obj_df) - - - def upload_studies(self, overwrite=False, confirm=False): - del_inds = [] - for index, row in self.df[self.df['object'] == 'Study'].iterrows(): - fj_obj = self.fj.create( - 'study', - name=row['name'], - description=row['description'], - confirm=confirm, - overwrite=overwrite, - ) - for i in fj_obj: - print(i, fj_obj[i][0]) - print() - self.hash_map[index] = fj_obj.id[0] - if fj_obj.id[0] not in del_inds: - del_inds.append(fj_obj.id[0]) - self.df.loc[index, 'flapjackid'] = fj_obj.id[0] - # if row[DOI] is not nan patch the DOI - if not pd.isna(row['DOI']): - self.fj.patch('study', fj_obj.id[0], doi=row['DOI']) - self.del_map['study'] = del_inds - - - def upload_signals(self, overwrite=False, confirm=False): - del_inds = [] - for index, row in self.df[self.df['object'] == 'Signal'].iterrows(): - fj_obj = self.fj.create( - 'signal', - name=row['name'], - description=row['description'], - color=row['color'], - confirm=confirm, - overwrite=overwrite, - ) - for i in fj_obj: - print(i, fj_obj[i][0]) - print() - self.hash_map[index] = fj_obj.id[0] - if fj_obj.id[0] not in del_inds: - del_inds.append(fj_obj.id[0]) - self.df.loc[index, 'flapjackid'] = fj_obj.id[0] - self.del_map['signal'] = del_inds - - - def upload_chemicals(self, overwrite=False, confirm=False): - del_inds = [] - for index, row in self.df[self.df['object'] == 'Chemical'].iterrows(): - fj_obj = self.fj.create( - 'chemical', - name=row['name'], - description=row['description'], - confirm=confirm, - overwrite=overwrite, - ) - for i in fj_obj: - print(i, fj_obj[i][0]) - print() - self.hash_map[index] = fj_obj.id[0] - if fj_obj.id[0] not in del_inds: - del_inds.append(fj_obj.id[0]) - self.df.loc[index, 'flapjackid'] = fj_obj.id[0] - self.del_map['chemical'] = del_inds - - def upload_dna(self, overwrite=False, confirm=False): - del_inds = [] - for index, row in self.df[self.df['object'] == 'DNA'].iterrows(): - fj_obj = self.fj.create( - 'dna', - name=row['name'], - confirm=confirm, - overwrite=overwrite, - ) - for i in fj_obj: - print(i, fj_obj[i][0]) - print() - self.hash_map[index] = fj_obj.id[0] - if fj_obj.id[0] not in del_inds: - del_inds.append(fj_obj.id[0]) - self.df.loc[index, 'flapjackid'] = fj_obj.id[0] - self.del_map['dna'] = del_inds - - - def upload_medias(self, overwrite=False, confirm=False): - del_inds = [] - for index, row in self.df[self.df['object'] == 'Media'].iterrows(): - fj_obj = self.fj.create( - 'media', - name=row['name'], - description=row['description'], - confirm=confirm, - overwrite=overwrite, - ) - for i in fj_obj: - print(i, fj_obj[i][0]) - print() - self.hash_map[index] = fj_obj.id[0] - if fj_obj.id[0] not in del_inds: - del_inds.append(fj_obj.id[0]) - self.df.loc[index, 'flapjackid'] = fj_obj.id[0] - self.del_map['media'] = del_inds - - - def upload_strains(self, overwrite=False, confirm=False): - del_inds = [] - for index, row in self.df[self.df['object'] == 'Strain'].iterrows(): - fj_obj = self.fj.create( - 'strain', - name=row['name'], - description=row['description'], - confirm=confirm, - overwrite=overwrite, - ) - for i in fj_obj: - print(i, fj_obj[i][0]) - print() - self.hash_map[index] = fj_obj.id[0] - if fj_obj.id[0] not in del_inds: - del_inds.append(fj_obj.id[0]) - self.df.loc[index, 'flapjackid'] = fj_obj.id[0] - self.del_map['strain'] = del_inds - - - def upload_supplements(self, overwrite=False, confirm=False): - del_inds = [] - for index, row in self.df[self.df['object'] == 'Supplement'].iterrows(): - fj_obj = self.fj.create( - 'supplement', - name=row['name'], - description=row['description'], - chemical=self.df.loc[row['chemical'], 'flapjackid'], - concentration=row['concentration'], - confirm=confirm, - overwrite=overwrite, - ) - for i in fj_obj: - print(i, fj_obj[i][0]) - print() - self.hash_map[index] = fj_obj.id[0] - if fj_obj.id[0] not in del_inds: - del_inds.append(fj_obj.id[0]) - self.df.loc[index, 'flapjackid'] = fj_obj.id[0] - self.del_map['supplement'] = del_inds - - - def upload_vectors(self, overwrite=False, confirm=False): - del_inds = [] - for index, row in self.df[self.df['object'] == 'Vector'].iterrows(): - # print(self.df.loc[row['dna'], 'flapjackid']) - fj_obj = self.fj.create( - 'vector', - name=row['name'], - description=row['description'], - dnas=[self.df.loc[row['dna'], 'flapjackid']], - confirm=confirm, - overwrite=overwrite, - ) - for i in fj_obj: - print(i, fj_obj[i][0]) - print() - self.hash_map[index] = fj_obj.id[0] - if fj_obj.id[0] not in del_inds: - del_inds.append(fj_obj.id[0]) - self.df.loc[index, 'flapjackid'] = fj_obj.id[0] - self.del_map['vector'] = del_inds - - - def upload_assays(self, overwrite=False, confirm=False): - del_inds = [] - for index, row in self.df[self.df['object'] == 'Assay'].iterrows(): - fj_obj = self.fj.create( - 'assay', - study=self.df.loc[row['study'], 'flapjackid'], - name=row['name'], - description=row['description'], - machine=row['machine'], - temperature=row['temperature'], - confirm=confirm, - overwrite=overwrite, - ) - for i in fj_obj: - print(i, fj_obj[i][0]) - print() - self.hash_map[index] = fj_obj.id[0] - if fj_obj.id[0] not in del_inds: - del_inds.append(fj_obj.id[0]) - self.df.loc[index, 'flapjackid'] = fj_obj.id[0] - self.del_map['assay'] = del_inds - - - def upload_samples(self, overwrite=False, confirm=False): - del_inds = [] - # get fj ids from sample design - for index, row in self.df[self.df['object'] == 'Sample'].iterrows(): - media_index = self.df.loc[row['sampledesign'], 'media'] - media_id = self.df.loc[media_index, 'flapjackid'] - strain_index = self.df.loc[row['sampledesign'], 'strain'] - strain_id = self.df.loc[strain_index, 'flapjackid'] - vector_index = self.df.loc[row['sampledesign'], 'vector'] - vector_id = self.df.loc[vector_index, 'flapjackid'] - - fj_obj = self.fj.create( - 'sample', - assay=self.df.loc[row['assay'], 'flapjackid'], - media=media_id, - strain=strain_id, - vector=vector_id, - row=row['row'], - col=row['col'], - confirm=confirm, - overwrite=overwrite, - ) - for i in fj_obj: - print(i, fj_obj[i][0]) - print() - self.hash_map[index] = fj_obj.id[0] - if fj_obj.id[0] not in del_inds: - del_inds.append(fj_obj.id[0]) - self.df.loc[index, 'flapjackid'] = fj_obj.id[0] - - if not pd.isna(row['supplement']): - supplement_index = self.df.loc[row['sampledesign'], 'supplement'] - supplement_id = self.df.loc[supplement_index, 'flapjackid'] - self.fj.patch('sample', fj_obj.id[0], supplements=supplement_id) - self.del_map['sample'] = del_inds - - - - def upload_all(self): - self.create_df() - self.upload_studies() - self.upload_signals() - self.upload_chemicals() - self.upload_dna() - self.upload_medias() - self.upload_strains() - self.upload_supplements() - self.upload_vectors() - self.upload_assays() - self.upload_samples() - - def delete_all(self): - for model in self.del_map: - for id in self.del_map[model]: - self.fj.delete(model, id, confirm=False) - - - - - - - diff --git a/src/excel2flapjack/parsed_file.xlsx b/src/excel2flapjack/parsed_file.xlsx deleted file mode 100644 index f5b7bb3..0000000 Binary files a/src/excel2flapjack/parsed_file.xlsx and /dev/null differ diff --git a/tests/.DS_Store b/tests/.DS_Store deleted file mode 100644 index 21e297f..0000000 Binary files a/tests/.DS_Store and /dev/null differ diff --git a/tests/test_files/.DS_Store b/tests/test_files/.DS_Store deleted file mode 100644 index 4aa50b0..0000000 Binary files a/tests/test_files/.DS_Store and /dev/null differ diff --git a/tests/test_files/flapjack_excel_converter_revamp.xlsx b/tests/test_files/flapjack_excel_converter_revamp.xlsx deleted file mode 100644 index 6b9486e..0000000 Binary files a/tests/test_files/flapjack_excel_converter_revamp.xlsx and /dev/null differ diff --git a/tests/test_files/flapjack_excel_converter_v028.xlsx b/tests/test_files/flapjack_excel_converter_v028.xlsx deleted file mode 100644 index cb3eff7..0000000 Binary files a/tests/test_files/flapjack_excel_converter_v028.xlsx and /dev/null differ diff --git a/tests/test_files/flapjack_excel_converter_v030.xlsx b/tests/test_files/flapjack_excel_converter_v030.xlsx deleted file mode 100644 index 6c725a1..0000000 Binary files a/tests/test_files/flapjack_excel_converter_v030.xlsx and /dev/null differ diff --git a/tests/test_files/xdc_test.xlsx b/tests/test_files/xdc_test.xlsx deleted file mode 100644 index 33602d6..0000000 Binary files a/tests/test_files/xdc_test.xlsx and /dev/null differ diff --git a/tests/test_files/~$flapjack_excel_converter_revamp.xlsx b/tests/test_files/~$flapjack_excel_converter_revamp.xlsx deleted file mode 100644 index 78a31cc..0000000 Binary files a/tests/test_files/~$flapjack_excel_converter_revamp.xlsx and /dev/null differ diff --git a/tests/test_files/~$flapjack_excel_converter_v028.xlsx b/tests/test_files/~$flapjack_excel_converter_v028.xlsx deleted file mode 100644 index 78a31cc..0000000 Binary files a/tests/test_files/~$flapjack_excel_converter_v028.xlsx and /dev/null differ diff --git a/tests/test_fj_access.py b/tests/test_fj_access.py deleted file mode 100644 index 731a4c2..0000000 --- a/tests/test_fj_access.py +++ /dev/null @@ -1,54 +0,0 @@ -import unittest -from unittest.mock import Mock, patch -import sys -import pandas as pd -from excel2flapjack.mainNew import X2F - -# don't need any of this because we're using mock and patch -''' -xls = pd.ExcelFile("./test_files/flapjack_excel_converter_revamp.xlsx") -fj_url = "localhost:8000" -# fj_url = "flapjack.rudge-lab.org:8000" -fj_user = "dylan33smith" -fj_pass = "coco33" -''' - -# define test case class which inherits from 'unittest.TestCase' that contains tests related to initialization of XDC class -class TestX2FInit(unittest.TestCase): - # decorator replaces Flapjack class with a mock - # any instantiation of Flapjack within the test will use this mock instead of the real class - @patch('excel2flapjack.mainNew.Flapjack') - # patched Flapjack class is passed into the test method as the parameter MockFlapjack - def test_init_method(self, MockFlapjack): - # Create a mock ExcelFile object to simulate a pd.ExcelFile - # spec argument ensures that the mock only allows access to attributes and methods that exist on a pd.ExcelFile - mock_xls = Mock(spec=pd.ExcelFile) - print(mock_xls) - - # MockFlapjack.return_value is used to specify the mock object that should be returned whenever the Flapjack class is instantiated - # mock_fj_instance represents this mock instance of Flapjack - mock_fj_instance = MockFlapjack.return_value - # configure log_in method to return 'None' simulating successful behavior - mock_fj_instance.log_in.return_value = None # Simulate successful login - - # define variables used as arguments when creating an instance of the 'XDC' class within a test - test_url = "http://testurl.com" # URL without port 8000 - test_user = "testuser" - test_pass = "testpass" - - # Instantiate XDC with mock excel file ann test credentials - # this is the line that actually tests the __init__ method as it involves creating the XDC object - xdc_instance = X2F(mock_xls, test_url, test_user, test_pass) - - - # Assertions to verify the __init__ behavior - - # test Flapjack class was called exactly once with the url_base constructed by appending ':8000' to 'test_url' - # verifies URL modification logic - MockFlapjack.assert_called_once_with(url_base=test_url + ":8000") # Check URL modification - # test log_in method was called exactly once with the correct username and password - mock_fj_instance.log_in.assert_called_once_with(username=test_user, password=test_pass) # Check login call - - -if __name__ == '__main__': - unittest.main() \ No newline at end of file diff --git a/tests/test_upload_functions.py b/tests/test_upload_functions.py deleted file mode 100644 index a4c771b..0000000 --- a/tests/test_upload_functions.py +++ /dev/null @@ -1,96 +0,0 @@ -import unittest -from unittest.mock import MagicMock, patch -from excel2flapjack.mainNew import X2F -import pandas as pd -import test_xcel_file - -''' -xls = pd.ExcelFile("./test_files/xdc_test.xlsx") -fj_url = "localhost:8000" -# fj_url = "flapjack.rudge-lab.org:8000" -fj_user = "dylan33smith" -fj_pass = "coco33" -''' - -class TestX2FStudyUpload(unittest.TestCase): - - - def setUp(self): - self.xls = MagicMock() - - # set up mock dataframe that can be further setup to test upload results - self.data = { - 'name': [None], - 'description': [None], - 'pubchemid': [None], - 'object': [None], - 'flapjackid': [None], - 'chemical': [None], - 'concentration': [None], - 'dna': [None], - 'color': [None], - 'DOI': [None], - 'machine': [None], - 'temperature': [None], - 'study': [None], - 'row': [None], - 'col': [None], - 'assay': [None], - 'sampledesign': [None], - 'sample': [None], - 'signal': [None], - 'time': [None], - 'value': [None], - 'media': [None], - 'strain': [None], - 'vector': [None], - 'supplement': [None] - } - - # patch the Flapjack class and start the patcher - self.mock_fj_patcher = patch('excel2flapjack.mainNew.Flapjack') - self.mock_fj = self.mock_fj_patcher.start() - - # Setup mock Flapjack instance - self.mock_fj = self.mock_fj.return_value - - fj_return_df = { - 'id': [123], - 'is_owner': [True], - 'shared_with': [[]], # Adjust according to the actual expected structure - 'name': ['test study name'], - 'description': ['test study description'], - 'doi': ['https://doi.org/thisisatest'], - 'sboluri': [''], - 'public': [False] - } - mock_fj_return_df = pd.DataFrame(fj_return_df) - - self.mock_fj.create.return_value = mock_fj_return_df - - - self.x2f = X2F(self.xls, 'fakeurl.com', 'fake_user', 'fake_pass') - # give instance empty df of right structure - self.x2f.df = pd.DataFrame(self.data) - - def tearDown(self): - self.mock_fj_patcher.stop() - - - def test_studies_upload(self): - self.x2f.df['name'] = 'test study name' - self.x2f.df['description'] = 'test study description' - self.x2f.df['object'] = 'Study' - - self.x2f.upload_studies() - - self.mock_fj.create.assert_called_with( - 'study', - name='test study name', - description='test study description', - confirm=False, - overwrite=False - ) - -if __name__ == '__main__': - unittest.main() \ No newline at end of file diff --git a/tests/test_xcel_file.py b/tests/test_xcel_file.py deleted file mode 100644 index b547531..0000000 --- a/tests/test_xcel_file.py +++ /dev/null @@ -1,51 +0,0 @@ -import unittest -from unittest.mock import MagicMock, patch -from excel2flapjack.mainNew import X2F -import pandas as pd - - -data = [ - {"Sheet Name": "Supplement", "ColName": "Supplement Name", "FlapjackName": "name"}, - {"Sheet Name": "Supplement", "ColName": "Chemical ID", "FlapjackName": "chemical"}, - {"Sheet Name": "Supplement", "ColName": "Concentration", "FlapjackName": "concentration"}, - {"Sheet Name": "Chemical", "ColName": "Chemical Name", "FlapjackName": "name"}, - {"Sheet Name": "Chemical", "ColName": "Chemical Description", "FlapjackName": "description"}, - {"Sheet Name": "Chemical", "ColName": "Pubchem ID", "FlapjackName": "pubchemid"}, - {"Sheet Name": "Vector", "ColName": "Vector Name", "FlapjackName": "name"}, - {"Sheet Name": "Vector", "ColName": "DNA ID", "FlapjackName": "dna"}, - {"Sheet Name": "Strain", "ColName": "Strain Name", "FlapjackName": "name"}, - {"Sheet Name": "Strain", "ColName": "Strain Description", "FlapjackName": "description"}, - {"Sheet Name": "Strain", "ColName": "Strain ID", "FlapjackName": "strain"}, - {"Sheet Name": "Media", "ColName": "Media Name", "FlapjackName": "name"}, - {"Sheet Name": "Media", "ColName": "Media Description", "FlapjackName": "description"}, - {"Sheet Name": "Signal", "ColName": "Signal Name", "FlapjackName": "name"}, - {"Sheet Name": "Signal", "ColName": "Signal Description", "FlapjackName": "description"}, - {"Sheet Name": "Signal", "ColName": "Signal Color", "FlapjackName": "color"}, - {"Sheet Name": "DNA", "ColName": "DNA Name", "FlapjackName": "name"}, - {"Sheet Name": "Measurement", "ColName": "Signal ID", "FlapjackName": "signal"}, - {"Sheet Name": "Measurement", "ColName": "Value", "FlapjackName": "value"}, - {"Sheet Name": "Measurement", "ColName": "Sample ID", "FlapjackName": "sample"}, - {"Sheet Name": "Measurement", "ColName": "Time", "FlapjackName": "time"}, - {"Sheet Name": "Sample", "ColName": "Row", "FlapjackName": "row"}, - {"Sheet Name": "Sample", "ColName": "Column", "FlapjackName": "col"}, - {"Sheet Name": "Sample", "ColName": "Sample Design ID", "FlapjackName": "sampledesign"}, - {"Sheet Name": "Sample", "ColName": "Assay ID", "FlapjackName": "assay"}, - {"Sheet Name": "Sample Design", "ColName": "Supplement ID", "FlapjackName": "supplement"}, - {"Sheet Name": "Sample Design", "ColName": "Vector ID", "FlapjackName": "vector"}, - {"Sheet Name": "Sample Design", "ColName": "Strain ID", "FlapjackName": "strain"}, - {"Sheet Name": "Sample Design", "ColName": "Media ID", "FlapjackName": "media"}, - {"Sheet Name": "Assay", "ColName": "Assay Name", "FlapjackName": "name"}, - {"Sheet Name": "Assay", "ColName": "Machine", "FlapjackName": "machine"}, - {"Sheet Name": "Assay", "ColName": "Description", "FlapjackName": "description"}, - {"Sheet Name": "Assay", "ColName": "Study ID", "FlapjackName": "study"}, - {"Sheet Name": "Assay", "ColName": "Temperature", "FlapjackName": "temperature"}, - {"Sheet Name": "Study", "ColName": "Study Name", "FlapjackName": "name"}, - {"Sheet Name": "Study", "ColName": "Description", "FlapjackName": "description"}, - {"Sheet Name": "Study", "ColName": "DOI", "FlapjackName": "DOI"}, - {"Sheet Name": "Study", "ColName": None, "FlapjackName": "public"}, -] - -# Create the DataFrame -df = pd.DataFrame(data) - -print(df)