{"id":18016325,"url":"https://github.com/grosstor/identiflow","last_synced_at":"2025-04-04T15:27:07.171Z","repository":{"id":201859189,"uuid":"228026173","full_name":"GrossTor/IdentiFlow","owner":"GrossTor","description":"Identifiability and experimental design in perturbation studies","archived":false,"fork":false,"pushed_at":"2020-09-25T15:19:02.000Z","size":95,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-10T01:17:46.274Z","etag":null,"topics":["experimental-design","identifiability","matroid","maximum-flow","network-inference","reverse-engineering","systems-biology"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GrossTor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-12-14T13:19:02.000Z","updated_at":"2024-08-22T19:42:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"3534878a-ef4a-4b34-a94f-f98f3cc5845a","html_url":"https://github.com/GrossTor/IdentiFlow","commit_stats":null,"previous_names":["grosstor/identiflow"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrossTor%2FIdentiFlow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrossTor%2FIdentiFlow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrossTor%2FIdentiFlow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GrossTor%2FIdentiFlow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GrossTor","download_url":"https://codeload.github.com/GrossTor/IdentiFlow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247200854,"owners_count":20900502,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["experimental-design","identifiability","matroid","maximum-flow","network-inference","reverse-engineering","systems-biology"],"created_at":"2024-10-30T04:17:29.587Z","updated_at":"2025-04-04T15:27:07.150Z","avatar_url":"https://github.com/GrossTor.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# IdentiFlow\nInteraction strengths between nodes in directed networks can be quantified from observations of the network's response to perturbations. This package reveals the identifiability of the inferred network parameters and optimizes experimental design for network perturbation studies. See our [publication](https://doi.org/10.1093/bioinformatics/btaa404) for details.\n\n\nYou can install the IdentiFlow package with [pip](https://pypi.org/project/pip/):\n\n```\npip install git+https://github.com/GrossTor/IdentiFlow#egg=identiflow\n```\n\nThe package is easy to use and we demonstrate its most relevant features in the example below. You find the example script in [identiflow/examples](identiflow/examples). This folder also contains the scripts that were used to analyse the KEGG pathways, as described in our [paper](https://www.biorxiv.org/content/10.1101/2020.02.03.931816v1).\n\n\n\nAfter successful installation of the package you are able to import it in your Python session.\n\n\n```python\nimport identiflow\n```\n\n### Input\nFirst we define the network topology as a networkx Digraph and specify perturbations and their targets in a dictionary.\n\n\n```python\nimport networkx as nx\n\nedges = [('node 0', 'node 1'),\n         ('node 0', 'node 2'),\n         ('node 0', 'node 3'),\n         ('node 1', 'node 3'),\n         ('node 2', 'node 3'),\n         ('node 3', 'node 0'),\n         ('node 4', 'node 3'),\n         ('node 4', 'node 5'),\n         ('node 5', 'node 4')]\n\nperturbations = {'P0': {'node 0', 'node 3'},\n                 'P1': {'node 2'},\n                 'P2': {'node 3', 'node 4'}}\n\n\nnet = nx.DiGraph(edges)\n\n#There must be no self_loops. The next line ensures it.\nnet.remove_edges_from(nx.classes.selfloop_edges(net))\n```\n\n## Identifiability\nNext, we investigate which of the interaction and perturbation strengths are identifiable in this perturbation experiment. This can be done with the function `infer_identifiability` (or `infer_identifiability_by_simulation`, see function documentation for details). It returns dictionaries that specify the dimensionality of the associated solution spaces and the identifiability status. The latter can be depicted by the plotting function `draw_identifiability_graph`.\n\n\n```python\nsol_space_dims, identifiability = \\\n    identiflow.infer_identifiability(net,perturbations)\nsol_space_dims_simu, identifiability_simu = \\\n    identiflow.infer_identifiability_by_simulation(net,perturbations)\n\nidentiflow.draw_identifiability_graph(identifiability)\n```\n\n\n![pdf](./identiflow/examples/identi_net.png)\n\n\nTo elucidate the identifiability relationships between groups of network parameters we can can determine the cyclic flats using the function `infer_identifiability_relationships` and plot them with `draw_lattice`.\n\n\n```python\ncyclic_flats_dict = \\\n    identiflow.infer_identifiability_relationships(net, perturbations)\nfor node in cyclic_flats_dict:\n    if sol_space_dims[node]\u003e0:\n        fig,ax=identiflow.draw_lattice(cyclic_flats_dict[node])\n```\n\n\n![png](./identiflow/examples/matroid_node_3.png)\n\n\n\n![png](./identiflow/examples/matroid_node_4.png)\n\n\n## Experimental design\nIdentiFlow also allows to identify perturbation sequences that maximize the number of identifiable parameters with a minimal number of perturbations. The function `optimize_experimental_design` has different options to do so, that are described in detail in its documentation. Here we try a few and compare their performances.\n\n\n```python\nnodes = list(net.nodes)\n\n#we allow all single target perturbations\n\nperturbations = {'P{0}'.format(i):{nodes[i]} for i in range(len(nodes))}\nexhaustive = identiflow.optimize_experimental_design(net, perturbations,\n                                strategy='exhaustive',sampling=False)\n\ngreedy = identiflow.optimize_experimental_design(net, perturbations,\n                                strategy='greedy',sampling=False)\n\nmulti_target = identiflow.optimize_experimental_design(net, perturbations,\n                                strategy='multi_target',sampling=False)\n\nnaive = identiflow.optimize_experimental_design(net, perturbations,\n                                strategy='naive',sampling=False)\n\nrandom = identiflow.optimize_experimental_design(net, perturbations,\n                                strategy='random',sampling=True, n_samples=1)\n\n\nimport pprint\nprint('\\nPerformance:\\n\\n   exhaustive: {0}\\n   greedy: {1}\\n   multi_target: {2}\\n   naive: {3}\\n   random: {4}'.format(\n        exhaustive['ident_AUC'],greedy['ident_AUC'],multi_target['ident_AUC'],naive['ident_AUC'], random['ident_AUC']))\n\nprint('\\nBest perturbation sequences:\\n\\n   greedy:\\n')\npprint.pprint(greedy['best_pert_seqs'])\nprint('\\n   multi-target:\\n')\npprint.pprint([tuple(set(combi) for combi in seq) for seq in multi_target['best_pert_seqs']])\n```\n\n    Performance:\n    \n       exhaustive: 0.7592592592592593\n       greedy: 0.7592592592592593\n       multi_target: 0.8148148148148148\n       naive: 0.7407407407407407\n       random: 0.48148148148148145\n    \n    Best perturbation sequences:\n    \n       greedy:\n    \n    [('P5', 'P0', 'P1', 'P2', 'P4'),\n     ('P5', 'P0', 'P2', 'P1', 'P4'),\n     ('P4', 'P0', 'P1', 'P2', 'P5'),\n     ('P4', 'P0', 'P2', 'P1', 'P5')]\n    \n       multi-target:\n    \n    [({'P5'}, {'P0', 'P4'}, {'P2'}, {'P1'}),\n     ({'P5'}, {'P0', 'P4'}, {'P1'}, {'P2'}),\n     ({'P4'}, {'P0', 'P5'}, {'P2'}, {'P1'}),\n     ({'P4'}, {'P0', 'P5'}, {'P1'}, {'P2'})]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrosstor%2Fidentiflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrosstor%2Fidentiflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrosstor%2Fidentiflow/lists"}