-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
514 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
"isRoot": true, | ||
"tools": { | ||
"fable": { | ||
"version": "4.6.0", | ||
"version": "4.7.0", | ||
"commands": [ | ||
"fable" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,238 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": { | ||
"dotnet_interactive": { | ||
"language": "fsharp" | ||
}, | ||
"polyglot_notebook": { | ||
"kernelName": "fsharp" | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from __future__ import annotations\n", | ||
"from array import array as array_3\n", | ||
"from typing import (Any, Callable, TypeVar)\n", | ||
"from fable_modules.fable_library.array_ import (initialize, add_range_in_place, map as map_1, indexed, reverse as reverse_1, append as append_2, map_indexed, take, fill)\n", | ||
"from fable_modules.fable_library.list import (FSharpList, of_array, is_empty, iterate, append as append_1, cons, singleton as singleton_1)\n", | ||
"from fable_modules.fable_library.map import of_list\n", | ||
"from fable_modules.fable_library.map_util import (add_to_dict, get_item_from_dict)\n", | ||
"from fable_modules.fable_library.mutable_map import Dictionary\n", | ||
"from fable_modules.fable_library.option import value as value_8\n", | ||
"from fable_modules.fable_library.range import range_big_int\n", | ||
"from fable_modules.fable_library.seq import (to_list, delay, collect, singleton, append, to_array, map)\n", | ||
"from fable_modules.fable_library.string_ import (to_text, printf)\n", | ||
"from fable_modules.fable_library.system_text import (StringBuilder__ctor, StringBuilder__AppendLine_Z721C83C5)\n", | ||
"from fable_modules.fable_library.types import (Array, to_string)\n", | ||
"from fable_modules.fable_library.util import (IEnumerable_1, int32_to_string, assert_equal, equals as equals_4, safe_hash, to_enumerable, ignore, compare_arrays, equal_arrays, array_hash)\n", | ||
"from fable_modules.fable_pyxpecto.pyxpecto import Helper_expectError\n", | ||
"from fable_modules.fable_pyxpecto.pyxpecto import TestCase\n", | ||
"from src.ISA.ISA.ArcTypes.arc_table_aux import try_find_duplicate_unique_in_array\n", | ||
"from src.ISA.ISA.ArcTypes.arc_table import ArcTable\n", | ||
"from src.ISA.ISA.ArcTypes.arc_table_aux import (SanityChecks_validateColumnIndex, SanityChecks_validateRowIndex, try_find_duplicate_unique)\n", | ||
"from src.ISA.ISA.ArcTypes.composite_cell import CompositeCell\n", | ||
"from src.ISA.ISA.ArcTypes.composite_column import CompositeColumn\n", | ||
"from src.ISA.ISA.ArcTypes.composite_header import (IOType, CompositeHeader)\n", | ||
"from src.ISA.ISA.ArcTypes.identifier_setters import set_arc_table_name\n", | ||
"from src.ISA.ISA.JsonTypes.ontology_annotation import OntologyAnnotation\n", | ||
"from library import (Test_testList, Test_testCase, Expect_sequenceEqual, Expect_isTrue, Expect_notEqual, Expect_throws, Expect_isNone, Expect_isSome, Expect_containsAll, Expect_isFalse)\n", | ||
"\n", | ||
"__A = TypeVar(\"__A\")\n", | ||
"\n", | ||
"TableName: str = \"Test\"\n", | ||
"\n", | ||
"oa_species: OntologyAnnotation = OntologyAnnotation.from_string(\"species\", \"GO\", \"GO:0123456\")\n", | ||
"\n", | ||
"oa_chlamy: OntologyAnnotation = OntologyAnnotation.from_string(\"Chlamy\", \"NCBI\", \"NCBI:0123456\")\n", | ||
"\n", | ||
"oa_instrument_model: OntologyAnnotation = OntologyAnnotation.from_string(\"instrument model\", \"MS\", \"MS:0123456\")\n", | ||
"\n", | ||
"oa_sciexinstrument_model: OntologyAnnotation = OntologyAnnotation.from_string(\"SCIEX instrument model\", \"MS\", \"MS:654321\")\n", | ||
"\n", | ||
"oa_temperature: OntologyAnnotation = OntologyAnnotation.from_string(\"temperature\", \"NCIT\", \"NCIT:0123210\")\n", | ||
"\n", | ||
"def table_values_printable(table: ArcTable) -> FSharpList[str]:\n", | ||
" def _arrow1027(__unit: None=None, table: Any=table) -> IEnumerable_1[str]:\n", | ||
" def _arrow1026(match_value: Any) -> IEnumerable_1[str]:\n", | ||
" active_pattern_result: tuple[tuple[int, int], CompositeCell] = match_value\n", | ||
" return singleton((((((\"(\" + str(active_pattern_result[0][0])) + \",\") + str(active_pattern_result[0][1])) + \") \") + str(active_pattern_result[1])) + \"\")\n", | ||
"\n", | ||
" return collect(_arrow1026, table.Values)\n", | ||
"\n", | ||
" return to_list(delay(_arrow1027))\n", | ||
"\n", | ||
"\n", | ||
"def create_cells_free_text(pretext: Any, count: int) -> Array[CompositeCell]:\n", | ||
" def _arrow1030(i: int, pretext: Any=pretext, count: Any=count) -> CompositeCell:\n", | ||
" return CompositeCell.create_free_text((((\"\" + str(pretext)) + \"_\") + str(i)) + \"\")\n", | ||
"\n", | ||
" return initialize(count, _arrow1030, None)\n", | ||
"\n", | ||
"\n", | ||
"def create_cells_term(count: int) -> Array[CompositeCell]:\n", | ||
" def _arrow1032(_arg: int, count: Any=count) -> CompositeCell:\n", | ||
" return CompositeCell.create_term(oa_sciexinstrument_model)\n", | ||
"\n", | ||
" return initialize(count, _arrow1032, None)\n", | ||
"\n", | ||
"\n", | ||
"def create_cells_unitized(count: int) -> Array[CompositeCell]:\n", | ||
" def _arrow1035(i: int, count: Any=count) -> CompositeCell:\n", | ||
" return CompositeCell.create_unitized(int32_to_string(i), OntologyAnnotation.empty())\n", | ||
"\n", | ||
" return initialize(count, _arrow1035, None)\n", | ||
"\n", | ||
"\n", | ||
"column_input: CompositeColumn = CompositeColumn.create(CompositeHeader(11, IOType(0)), create_cells_free_text(\"Source\", 5))\n", | ||
"\n", | ||
"column_output: CompositeColumn = CompositeColumn.create(CompositeHeader(12, IOType(1)), create_cells_free_text(\"Sample\", 5))\n", | ||
"\n", | ||
"column_component: CompositeColumn = CompositeColumn.create(CompositeHeader(0, oa_instrument_model), create_cells_term(5))\n", | ||
"\n", | ||
"column_param: CompositeColumn = CompositeColumn.create(CompositeHeader(3, OntologyAnnotation.empty()), create_cells_unitized(5))\n", | ||
"\n", | ||
"def create_test_table(__unit: None=None) -> ArcTable:\n", | ||
" t: ArcTable = ArcTable.init(TableName)\n", | ||
" columns: Array[CompositeColumn] = [column_input, column_output, column_param, column_component, column_param]\n", | ||
" t.AddColumns(columns)\n", | ||
" return t\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"table1: ArcTable = create_test_table()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"8821596988035483298" | ||
] | ||
}, | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"# table1.GetHeadersHashCode()\n", | ||
"from src.ISA.ISA.helper import HashCodes_boxHashArray\n", | ||
"\n", | ||
"# HashCodes_boxHashArray(list(table1.Headers))\n", | ||
"\n", | ||
"from fable_modules.fable_library.util import (get_enumerator, dispose, equals, structural_hash, identity_hash, number_hash, IEnumerable_1, ignore, is_iterable)\n", | ||
"_A = TypeVar(\"_A\")\n", | ||
"\n", | ||
"copy_of_struct: _A = table1.Headers[0]\n", | ||
"identity_hash(copy_of_struct)\n", | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 23, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"ename": "TypeError", | ||
"evalue": "unhashable type: 'OntologyAnnotation'", | ||
"output_type": "error", | ||
"traceback": [ | ||
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", | ||
"\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", | ||
"\u001b[1;32mc:\\Users\\HLWei\\source\\repos\\ARC_tools\\ARCtrl\\pytests\\arc_table_tests.ipynb Cell 4\u001b[0m line \u001b[0;36m3\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/HLWei/source/repos/ARC_tools/ARCtrl/pytests/arc_table_tests.ipynb#W6sZmlsZQ%3D%3D?line=32'>33</a>\u001b[0m identity_hash(oa)\n\u001b[0;32m <a href='vscode-notebook-cell:/c%3A/Users/HLWei/source/repos/ARC_tools/ARCtrl/pytests/arc_table_tests.ipynb#W6sZmlsZQ%3D%3D?line=34'>35</a>\u001b[0m p \u001b[39m=\u001b[39m CompositeHeader\u001b[39m.\u001b[39mparameter(oa)\n\u001b[1;32m---> <a href='vscode-notebook-cell:/c%3A/Users/HLWei/source/repos/ARC_tools/ARCtrl/pytests/arc_table_tests.ipynb#W6sZmlsZQ%3D%3D?line=35'>36</a>\u001b[0m identity_hash(p)\n", | ||
"File \u001b[1;32mc:\\Users\\HLWei\\source\\repos\\ARC_tools\\ARCtrl\\pytests\\fable_modules\\fable_library\\util.py:2642\u001b[0m, in \u001b[0;36midentity_hash\u001b[1;34m(x)\u001b[0m\n\u001b[0;32m 2639\u001b[0m \u001b[39mreturn\u001b[39;00m x\u001b[39m.\u001b[39mGetHashCode()\n\u001b[0;32m 2641\u001b[0m \u001b[39mif\u001b[39;00m is_hashable_py(x):\n\u001b[1;32m-> 2642\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mhash\u001b[39m(x)\n\u001b[0;32m 2644\u001b[0m \u001b[39mreturn\u001b[39;00m physical_hash(x)\n", | ||
"File \u001b[1;32mc:\\Users\\HLWei\\source\\repos\\ARC_tools\\ARCtrl\\pytests\\fable_modules\\fable_library\\types.py:85\u001b[0m, in \u001b[0;36mUnion.__hash__\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 83\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m__hash__\u001b[39m(\u001b[39mself\u001b[39m) \u001b[39m-\u001b[39m\u001b[39m>\u001b[39m \u001b[39mint\u001b[39m:\n\u001b[0;32m 84\u001b[0m hashes \u001b[39m=\u001b[39m \u001b[39mmap\u001b[39m(\u001b[39mhash\u001b[39m, \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mfields)\n\u001b[1;32m---> 85\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mhash\u001b[39m((\u001b[39mhash\u001b[39m(\u001b[39mself\u001b[39m\u001b[39m.\u001b[39mtag), \u001b[39m*\u001b[39mhashes))\n", | ||
"\u001b[1;31mTypeError\u001b[0m: unhashable type: 'OntologyAnnotation'" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"from fable_modules.fable_library.array_ import (contains, fold, partition, exactly_one)\n", | ||
"\n", | ||
"a = table1.Headers\n", | ||
"\n", | ||
"# def folder(acc: int, o: _A, a: Any=a) -> int:\n", | ||
"# def _arrow67(__unit: None=None, acc: Any=acc, o: Any=o) -> int:\n", | ||
"# copy_of_struct: _A = o\n", | ||
"# return identity_hash(copy_of_struct)\n", | ||
"\n", | ||
"# return ((-1640531527 + _arrow67()) + (acc << 6)) + (acc >> 2)\n", | ||
"\n", | ||
"# failt\n", | ||
"# fold(folder, 0, a)\n", | ||
"\n", | ||
"\n", | ||
"# identity_hash(table1.Headers[0])\n", | ||
"# identity_hash(table1.Headers[1])\n", | ||
"# failt\n", | ||
"# identity_hash(table1.Headers[2])\n", | ||
"# identity_hash(table1.Headers[3])\n", | ||
"# identity_hash(table1.Headers[4])\n", | ||
"\n", | ||
"\n", | ||
"# failt\n", | ||
"# identity_hash(column_param.Header)\n", | ||
"\n", | ||
"\n", | ||
"\n", | ||
"table1.Headers[2]\n", | ||
"\n", | ||
"oa = OntologyAnnotation.empty()\n", | ||
"\n", | ||
"identity_hash(oa)\n", | ||
"\n", | ||
"# p = CompositeHeader.parameter(oa)\n", | ||
"\n", | ||
"# identity_hash(p)\n", | ||
"\n", | ||
"\n" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"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.11.0" | ||
}, | ||
"polyglot_notebook": { | ||
"kernelInfo": { | ||
"defaultKernelName": "fsharp", | ||
"items": [ | ||
{ | ||
"aliases": [], | ||
"languageName": "fsharp", | ||
"name": "fsharp" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Oops, something went wrong.