{ "cells": [ { "cell_type": "markdown", "id": "20935b5f", "metadata": {}, "source": [ "# MorphoNet Examples" ] }, { "cell_type": "markdown", "id": "5dd50856", "metadata": {}, "source": [ "This notebook is used to test the MorphoNet API by running it, and give examples to API users" ] }, { "cell_type": "code", "execution_count": 1, "id": "a314ae4c", "metadata": {}, "outputs": [], "source": [ "import os,sys\n", "sys.path.append(\"..\")\n", "import morphonet\n", "import numpy as np\n", "from morphonet.tools import *" ] }, { "cell_type": "markdown", "id": "4d50e240", "metadata": {}, "source": [ "Connection test to MorphoNet\n", "\n", "**Parameters**\n", "\n", "mn_login : (string)\n", " login on morphonet website\n", " \n", "mn_password : (string)\n", " password on morphonet website\n", "\n", "**Returns**\n", "\n", "mn : (MorphoNet.Net)\n", "\tInstance of the MorphoNet session\n" ] }, { "cell_type": "code", "execution_count": null, "id": "4b81334f", "metadata": {}, "outputs": [], "source": [ "mn_login = \"user\"\n", "mn_password = \"password\"\n", "print(\"->> OK Net\")\n", "mn=morphonet.Net(mn_login,mn_password)" ] }, { "cell_type": "markdown", "id": "c785467c", "metadata": {}, "source": [ "Retrieve users test to MorphoNet\n", "\n", "**Parameters**\n", "\n", "id_guy : (int)\n", " id to retrive\n", "\n", "**Returns**\n", "\n", "guy : (string)\n", "\t\"surname name\" of the user , or \"User not found\"\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "f9c0f5b8", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK get_guy_by_id \"+str(mn.get_guy_by_id(1)))\n", "print(\"->> NO get_guy_by_id \"+str(mn.get_guy_by_id(1111111)))" ] }, { "cell_type": "markdown", "id": "4ebe6f41", "metadata": {}, "source": [ "Retrieve users test to MorphoNet\n", "\n", "**Parameters**\n", "\n", "name : (string)\n", " name + surname of user to retrieve\n", "\n", "**Returns**\n", "\n", "id : (int)\n", "\tid of the user\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "e22b7fd7", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK get_guy_by_name \"+str(mn.get_guy_by_name(\"Gallean Benjamin\")))\n", "print(\"->> OK get_guy_by_name \"+str(mn.get_guy_by_name(\"Faure Emmanuel\")))\n", "print(\"->> NO get_guy_by_name \"+str(mn.get_guy_by_name(\"zer\")))\n", "print(\"->> NO get_guy_by_name \"+str(mn.get_guy_by_name(\"zer ZERZRE\")))" ] }, { "cell_type": "markdown", "id": "c77d3a81", "metadata": {}, "source": [ "Retrieve group test to MorphoNet\n", "\n", "**Parameters**\n", "\n", "name : (string)\n", " name of the group to retrieve\n", "\n", "**Returns**\n", "\n", "id : (int)\n", "\tid of the group\n", "\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "99de5549", "metadata": {}, "outputs": [], "source": [ "print(\"->> NO1 get_group_by_name \"+str(mn.get_group_by_name(\"\")))\n", "print(\"->> OK get_group_by_name \"+str(mn.get_group_by_name(\"ASTEC\")))\n", "print(\"->> NO2 get_group_by_name \"+str(mn.get_group_by_name(\"zer\")))" ] }, { "cell_type": "markdown", "id": "6606f7d0", "metadata": {}, "source": [ "List all dataset created by me\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "dc3dfed0", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK list_my_dataset\"); mn.list_my_dataset()\n" ] }, { "cell_type": "markdown", "id": "1e6af382", "metadata": {}, "source": [ "List all dataset I can access\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "aef240e5", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK list_dataset\"); mn.list_dataset()" ] }, { "cell_type": "markdown", "id": "0d7889a0", "metadata": {}, "source": [ "Select a dataset as working\n", "\n", "**Parameters**\n", "\n", "id : (int)\n", " id of the dataset\n" ] }, { "cell_type": "code", "execution_count": null, "id": "7cab8e7c", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK select_dataset_by_id\"); mn.select_dataset_by_id(1)\n", "print(\"->> NO select_dataset_by_id\"); mn.select_dataset_by_id(1111111)\n" ] }, { "cell_type": "markdown", "id": "018cef78", "metadata": {}, "source": [ "Select a dataset as working\n", "\n", "**Parameters**\n", "\n", "name : (string)\n", " name of the dataset\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "812ab13a", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK select_dataset_by_name\"); mn.select_dataset_by_name(\"Phallusia mammillata embryo (Wild type, live SPIM imaging, stages 8-17)\")\n", "print(\"->> NO select_dataset_by_name\"); mn.select_dataset_by_name(\"NONO\")" ] }, { "cell_type": "markdown", "id": "6d80f3a6", "metadata": {}, "source": [ "Create an empty dataset with 3 time steps and select it\n", "\n", "**Parameters**\n", "\n", "name : (string)\n", " name of the dataset on MorphoNet\n", " \n", "minTime : (int)\n", "\tbegin time point\n", " \n", "maxTime : (int)\n", "\tending time point\n", "\n", "**Returns**\n", "\n", "id : (int)\n", "\tid of the dataset\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "fdea1f3a", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK create_dataset\"); id_datset=mn.create_dataset(\"TEST UNITARY\",minTime=0,maxTime=2)" ] }, { "cell_type": "markdown", "id": "72b2fe83", "metadata": {}, "source": [ "Add a description on created dataset\n", "\n", "**Parameters**\n", "\n", "description : (string)\n", " description of the dataset on MorphoNet\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "ac873fa4", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK upload_description\"); mn.upload_description(\"the uploaded description\")" ] }, { "cell_type": "markdown", "id": "c91e7fc1", "metadata": {}, "source": [ "Update a dataset name (for selected dataset)\n", "\n", "**Parameters**\n", "\n", "dataset_name : (string)\n", " new name\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "7817b490", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK update_dataset\"); mn.update_dataset(dataset_name=\"NEW TEST NAME\")" ] }, { "cell_type": "markdown", "id": "f80fcb6d", "metadata": {}, "source": [ "Share the selected dataset with a MorphoNet user\n", "\n", "**Parameters**\n", "\n", "id_user : (int)\n", " id of the user\n", " \n", "role : (int)\n", "\tRole of the user : 0 to share as a reader, 1 as a manager\n", "\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "ade9f452", "metadata": {}, "outputs": [], "source": [ "id_user=1\n", "print(\"->> OK share_dataset_with_user\"); mn.share_dataset_with_user(id_user,1)\n", "#print(\"->> OK unshare_dataset_with_user\"); mn.unshare_dataset_with_user(id_user)\n", "#TODO Test other roles" ] }, { "cell_type": "markdown", "id": "41f1d115", "metadata": {}, "source": [ "Retrieve a group id by its name\n", "\n", "**Parameters**\n", "\n", "name : (string)\n", " name of the group\n", "\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "e2fef804", "metadata": {}, "outputs": [], "source": [ "id_group=mn.get_group_by_name(\"ASTEC\")" ] }, { "cell_type": "markdown", "id": "35e7d030", "metadata": {}, "source": [ "Share the selected dataset with a MorphoNet group\n", "\n", "**Parameters**\n", "\n", "id_group : (int)\n", " id of the user\n", " \n", "role : (int)\n", "\tRole of the user : 0 to share as a reader, 1 as a manager\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "f5a43e7b", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK share_dataset_with_group\"); mn.share_dataset_with_group(id_group,1)\n", "#print(\"->> OK unshare_dataset_with_group\"); mn.unshare_dataset_with_group(id_group)" ] }, { "cell_type": "code", "execution_count": null, "id": "6ee672ec", "metadata": {}, "outputs": [], "source": [ "\n", "#TODO get_number_of_mesh_at as to return the number, not print it\n", "#MESHES\n", "fileobj=\"seg_t{:03d}.inr.gz\"\n", "for t in range(0,3):\n", "\tif mn.get_number_of_mesh_at(t)==0:\n", "\t\tprint(\"->> OK Read Image\"); im=imread(fileobj.format(t))\n", "\t\t\"\"\" Convert image to morphonet 3d data format\n", "\n", "\t\tParameters\n", "\t\t----------\n", "\t\tim : np.array\n", "\t\t\timage data\n", "\t\tt : int\n", "\t\t\ttime point in the image name\n", "\t\tbackground : int\n", "\t\t\tvalue of the background in the image\n", "\t\tfactor : int\n", "\t\t\tfactor of the downscaling applied to the data (the higher the faster, but data loss could appear)\n", "\n", "\t\tReturns\n", "\t\t-------\n", "\t\tobj : bytes\n", "\t\t\tdata in the morphonet 3d format, ready for upload\n", "\t\t\"\"\"\n", "\t\tprint(\"->> OK convert_to_OBJ\"); obj=convert_to_OBJ(im,t,background=1,factor=2)\n", "\t\t\"\"\" Upload 3d data on morphonet\n", "\n", "\t\tParameters\n", "\t\t----------\n", "\t\tt : int\n", "\t\t time of the Dataset to upload\n", "\t\tobj : bytes\n", "\t\t\t3D data\n", "\n", "\t\t\"\"\"\n", "\t\tprint(\"->> OK upload_mesh_at \"+str(t)); mn.upload_mesh_at(t,obj)\n", "\t\t#TAKE SOME TIMES FOR UPDATE\n", "\t\tif t==0:\n", "\t\t\t\"\"\" Retrieve the 3d data for the selected dataset at a time point t\n", "\n", "\t\t\tParameters\n", "\t\t\t----------\n", "\t\t\tt : int\n", "\t\t\t\ttime point on the dataset\n", "\n", "\t\t\tReturns\n", "\t\t\t-------\n", "\t\t\tobj : bytes\n", "\t\t\t\tdata on the morphonet server\n", "\t\t\t\"\"\"\n", "\t\t\tprint(\"->> OK get_mesh_at \"+str(t)); objout=mn.get_mesh_at(t);\n", "\t\t\tif objout is not None:\n", "\t\t\t\tprint(\" --> \"+str(len(objout))+\" chars\")\n", "\t\t\telse:\n", "\t\t\t\tprint(\" --> None \")\n", "\n", "print(\"->> NO get_mesh_at \"+str(t)); objout=mn.get_mesh_at(5);\n", "if objout is not None:\n", "\tprint(\" --> \"+str(len(objout))+\" chars\")\n", "else:\n", "\tprint(\" --> None \")\n" ] }, { "cell_type": "markdown", "id": "47acb64f", "metadata": {}, "source": [ "Retrieve the number of mesh for a time point in the selected dataset\n", "\n", "**Parameters**\n", "\n", "t : (int)\n", "\ttime point on the dataset\n", "\n", "**Returns**\n", "\n", "number : (int)\n", "\tnumber of mesh\n" ] }, { "cell_type": "code", "execution_count": null, "id": "79ef6c49", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK get_number_of_mesh_at 0 : \"+str(mn.get_number_of_mesh_at(0)))\n", "print(\"->> OK get_number_of_mesh_at 5 : \"+str(mn.get_number_of_mesh_at(5)))" ] }, { "cell_type": "markdown", "id": "a5405cbf", "metadata": {}, "source": [ "DELETE all 3d data on MorphoNet , for the selected dataset at the given time point\n", "\n", "**Parameters**\n", "\n", "t : (int)\n", "\ttime point on the dataset\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "21a39488", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK clear_mesh_at 0 \"); mn.clear_mesh_at(0)\n", "print(\"->> OK clear_mesh_at 5 \"); mn.clear_mesh_at(5)" ] }, { "cell_type": "markdown", "id": "701bc32a", "metadata": {}, "source": [ "Read the 3d data in a file\n", "\n", "**Parameters**\n", "\n", "path : (string)\n", "\tpath to the data\n", "\n", "**Returns**\n", "\n", "data : (bytes)\n", "\t3d data for the file\n" ] }, { "cell_type": "code", "execution_count": null, "id": "4f2ac95a", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK read_mesh\"); data=mn.read_mesh(\"sphere.obj\")\n", "#print(\"TODO ->> OK upload_primitive \");mn.upload_primitive(\"sphere\",prim)\n", "\n", "print(\"->> OK read_mesh\"); prim_sphere=mn.read_mesh(\"primwithsphere.obj\")" ] }, { "cell_type": "markdown", "id": "7e711d8f", "metadata": {}, "source": [ "Add a primitive for the dataset on MorphoNet at given time point\n", "\n", "**Parameters**\n", "\n", "t : (int)\n", "\ttime point\n", " \n", "prim_sphere : (bytes)\n", "\t3d data for the primitive\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "493c41ad", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK upload_mesh_with_primitive_at\");mn.upload_mesh_with_primitive_at(0,prim_sphere)" ] }, { "cell_type": "markdown", "id": "59a05e64", "metadata": {}, "source": [ "Delete a primitive by its name on the server\n", "\n", "**Parameters**\n", "\n", "name : (string)\n", "\tname of the primitive mesh to remove on MorphoNet\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "dd4638f0", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK delete_primitive \");mn.delete_primitive(\"sphere\")\n", "print(\"->> OK delete_primitive \");mn.delete_primitive(\"cube\")" ] }, { "cell_type": "markdown", "id": "6c71594c", "metadata": {}, "source": [ "Removes all primitive on MorphoNet\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "95af79fe", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK delete_primitives \");mn.delete_primitives()" ] }, { "cell_type": "code", "execution_count": null, "id": "f382d8e9", "metadata": {}, "outputs": [], "source": [ "#RAWIMAGES\n", "factor=2 #specify the rescale Factor\n", "filenameraw=\"fuse_t{:03d}.inr.gz\"\n", "for t in range(3):\n", "\tim = imread(filenameraw.format(t))\n", "\tim=np.uint8(255*np.float32(im[::factor,::factor,::factor])/im.max()) #Convert it in 8 bits\n", "\t\"\"\" Upload a raw image for the selected dataset at time point\n", "\tParameters\n", "\t----------\n", "\tt : int\n", "\t\ttime point\n", "\tim : np.array with uint8 value format\n", "\t\tRaw images data\n", "\tscale : int\n", "\t\tscaling of the given image\n", "\t\"\"\"\n", "\tprint(\"->> OK upload_image_at \"+str(t));mn.upload_image_at(t,im,scale=factor)\n", "\t\"\"\" Check if given time point contains a raw image\n", "\tParameters\n", "\t----------\n", "\tt : int\n", "\t\ttime point\n", "\n", "\tReturns\n", "\t-------\n", "\tflag : bool\n", "\t\tTrue if Raw Images exist on MorphoNet server at this time point , False otherwise\n", "\t\"\"\"\n", "\tprint(\"->> OK is_image_at \"+str(t)); mn.is_image_at(t)\n", "\t\"\"\" If exist, retrieve image for the given time point\n", "\tParameters\n", "\t----------\n", "\tt : int\n", "\t\ttime point\n", "\n", "\tReturns\n", "\t-------\n", "\trawim : np.array\n", "\t\tdata for the raw image\n", "\t\"\"\"\n", "\tprint(\"->> OK get_image_at \"+str(t)); rawim=mn.get_image_at(t)" ] }, { "cell_type": "markdown", "id": "3e95618b", "metadata": {}, "source": [ "delete raw image on the server for a given time point\n", "\n", "**Parameters**\n", "\n", "t : (int)\n", "\ttime point\n" ] }, { "cell_type": "code", "execution_count": null, "id": "82177a86", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK delete_image_at \"+str(0)); mn.delete_image_at(0)\n", "print(\"->> OK delete_image_at \"+str()); mn.delete_image_at(5)" ] }, { "cell_type": "markdown", "id": "236041eb", "metadata": {}, "source": [ "Delete all raw images on the server\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "c3a6a201", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK delete_images \"); mn.delete_images()" ] }, { "cell_type": "markdown", "id": "dc866fdd", "metadata": {}, "source": [ "List all property types available\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "a4108d45", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK show_properties_type \");mn.show_properties_type()\n", "volume=read_file(\"volume.txt\")" ] }, { "cell_type": "markdown", "id": "4a344768", "metadata": {}, "source": [ "Upload a property for the selected dataset\n", "\n", "**Parameters**\n", "\n", "name : (string)\n", "\tname of the property\n", " \n", "text : (string)\n", "\tlist of lines for the property, matching morphonet property format\n", " \n", "**Returns**\n", "\n", "id : (int)\n", "\tid of the property created\n" ] }, { "cell_type": "code", "execution_count": null, "id": "4d3cdded", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK upload_property \");id_property=mn.upload_property(\"volume\",volume); print(\" --> id_property=\"+str(id_property))" ] }, { "cell_type": "markdown", "id": "96ce91e4", "metadata": {}, "source": [ "List all of the properties current user can access on the dataset\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "ffaeb46f", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK get_properties \");print(mn.get_properties())" ] }, { "cell_type": "markdown", "id": "f4956a05", "metadata": {}, "source": [ "Retrieve property by name on the dataset\n", "\n", "**Parameters**\n", "\n", "name : (string)\n", "\tname of the property\n", "\n", "**Returns**\n", "\n", "data : (string)\n", "\ttext of the property stored on the server\n" ] }, { "cell_type": "code", "execution_count": null, "id": "9a3e43d8", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK get_property_by_name \");print(mn.get_property_by_name(\"volume\"))" ] }, { "cell_type": "markdown", "id": "20764f0d", "metadata": {}, "source": [ "Retrieve property by id on the dataset\n", "\n", "**Parameters**\n", "\n", "id_property : (int)\n", "\tid of the property\n", "\n", "**Returns**\n", "\n", "data : (string)\n", "\ttext of the property stored on the server\n" ] }, { "cell_type": "code", "execution_count": null, "id": "5114e72a", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK get_property_by_id \");print(mn.get_property_by_id(id_property))\n", "print(\"->> NO get_property_by_id \");print(mn.get_property_by_id(0))" ] }, { "cell_type": "markdown", "id": "871dce3e", "metadata": {}, "source": [ "Get the list of objects of a property specified by its id\n", "\n", "**Parameters**\n", "\n", "id_property : (int)\n", " ID of the property\n", "\n", "**Returns**\n", "\n", "objects : (list)\n", " List of key/value corresponding to a split to the property data\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "0b729fdd", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK get_objects_from_property_by_id \");print(mn.get_objects_from_property_by_id(id_property))\n", "print(\"->> NO get_objects_from_property_by_id \");print(mn.get_objects_from_property_by_id(0))" ] }, { "cell_type": "markdown", "id": "c45742f1", "metadata": {}, "source": [ "Get the list of object of an property specified by its name\n", "\n", "**Parameters**\n", "\n", "name : (string)\n", " name of the property\n", "\n", "**Returns**\n", "\n", "objects : (list)\n", " List of key/value corresponding to a split to the property data\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "cbbd6dd6", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK get_objects_from_property_by_name \");print(mn.get_objects_from_property_by_name(\"volume\"))" ] }, { "cell_type": "markdown", "id": "b2dc1bb1", "metadata": {}, "source": [ "The property specified by its id becomes accessible to everyone you shared it (or public if you shared the property with public)\n", "\n", "**Parameters**\n", "\n", "id_property : (int)\n", " ID of the property\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "a1ae6742", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK share_property_by_id \");mn.share_property_by_id(id_property)\n", "print(\"->> NO share_property_by_id \");mn.share_property_by_id(0)" ] }, { "cell_type": "markdown", "id": "1f51483e", "metadata": {}, "source": [ "The property specified by its id become unaccessible to everyone you shared it (or public if you shared the property with public)\n", "\n", "**Parameters**\n", "\n", "id_property : (int)\n", "\tID of the property\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "a4147772", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK unshare_property_by_id \");mn.unshare_property_by_id(id_property)\n", "\n" ] }, { "cell_type": "markdown", "id": "2d3be1f3", "metadata": {}, "source": [ "Delete an property specified by its name on the server\n", "\n", "**Parameters**\n", "\n", "name : (string)\n", " Name of the property\n" ] }, { "cell_type": "code", "execution_count": null, "id": "b9b035de", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK delete_property_by_name \");mn.delete_property_by_name(\"volume\")\n", "print(\"->> NO delete_property_by_name \");mn.delete_property_by_name(\"sds\")\n", "\n", "volume=read_file(\"volume.txt\")\n", "print(\"->> OK upload_property \");id_property=mn.upload_property(\"volume\",volume); print(\" --> id_property=\"+str(id_property))" ] }, { "cell_type": "markdown", "id": "b0d1a163", "metadata": {}, "source": [ "Delete an property specified by its id on the server\n", "\n", "**Parameters**\n", "\n", "id : (int)\n", "\tId of the property\n", "\n" ] }, { "cell_type": "code", "execution_count": null, "id": "ac91fc6f", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK delete_property_by_id \");mn.delete_property_by_id(id_property)\n", "print(\"->> NO delete_property_by_id \");mn.delete_property_by_id(0)\n", "\n", "mn.update_dataset(id_NCBI=0)" ] }, { "cell_type": "markdown", "id": "30e692f4", "metadata": {}, "source": [ "Retrieve the corresponding developmental table of the specied of the dataset (avaible only for Ascidian )\n", "\n", " returns the list of developmental table property (id,id_datasettype,period,stage,developmentaltstage,description,hpf)\n" ] }, { "cell_type": "code", "execution_count": null, "id": "2bb7a484", "metadata": {}, "outputs": [], "source": [ "print(\"->> NO get_developmental_table =\"+str(mn.get_developmental_table()))" ] }, { "cell_type": "markdown", "id": "78257091", "metadata": {}, "source": [ "Retrieve the list of stages for this species\n", "\n", "FROM \"anissed all stages\"\n", "\n", "return a dictionnary with stage database id as key and (Stage) as value\n" ] }, { "cell_type": "code", "execution_count": null, "id": "b3974197", "metadata": {}, "outputs": [], "source": [ "print(\"->> NO get_stages =\"+str(mn.get_stages()))" ] }, { "cell_type": "markdown", "id": "544314c8", "metadata": {}, "source": [ "Retrieve the list of cells (with their expression value) for the gene passed in argument (gene id is the id inside the database)\n", "\n", "returns a dictionnary with database id as key as value tuple containing (cell,stage,value)\n" ] }, { "cell_type": "code", "execution_count": null, "id": "5805bee3", "metadata": {}, "outputs": [], "source": [ "print(\"->> NO get_cells_by_gene \"+str(mn.get_cells_by_gene(15270)))" ] }, { "cell_type": "markdown", "id": "621bd85b", "metadata": {}, "source": [ "Retrieve the list of cells (with their expression value) for the gene and the stage passed in argument (gene id and stage id are the id inside the database)\n", "\n", "return a dictionnary with database id as key as value tuple containing (cell,value)\n" ] }, { "cell_type": "code", "execution_count": null, "id": "da959547", "metadata": {}, "outputs": [], "source": [ "print(\"->> NO get_cells_by_gene_by_stage \"+str(mn.get_cells_by_gene_by_stage(15270,52)))\n", "\n", "mn.update_dataset(id_NCBI=59560)\n", "print(\"->> OK get_developmental_table \"+str(len(mn.get_developmental_table())));\n", "print(\"->> OK get_stages \"+str(len(mn.get_stages())))\n", "print(\"->> OK get_cells_by_gene \"+str(mn.get_cells_by_gene(15270)))\n", "print(\"->> NO get_cells_by_gene \"+str(mn.get_cells_by_gene(1)))\n", "print(\"->> OK get_cells_by_gene_by_stage \"+ str(mn.get_cells_by_gene_by_stage(15270,52)))" ] }, { "cell_type": "markdown", "id": "142bda34", "metadata": {}, "source": [ "Retrieve the list of genes for this specie\n", "\n", "returns a list with (id,Gene Model, Gene Name, Unique Gene id)\n" ] }, { "cell_type": "code", "execution_count": null, "id": "de76f6a0", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK get_genes \"+str(len(mn.get_genes())))" ] }, { "cell_type": "markdown", "id": "f69c148d", "metadata": {}, "source": [ "Retrieve the list of genes (with their expression value) for the cell name in argument\n", "\n", "returns a dictionnary with database id as key as value tuple containing (stage,gene,value)\n" ] }, { "cell_type": "code", "execution_count": null, "id": "a3d6982e", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK get_genes_by_cell \"+str(len(mn.get_genes_by_cell(\"a7.8\"))))" ] }, { "cell_type": "markdown", "id": "bab09265", "metadata": {}, "source": [ "Retrieve the list of genes (with their expression value) for the stage id in argument\n", "\n", "returns a dictionnary with database id as key as value tuple containing (gene,cell,value)\n" ] }, { "cell_type": "code", "execution_count": null, "id": "cbaf872a", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK get_genes_by_stage \"+str(len(mn.get_genes_by_stage(43))))" ] }, { "cell_type": "markdown", "id": "93479fc4", "metadata": {}, "source": [ "Remove the 3D data and all properties for the selected dataset\n" ] }, { "cell_type": "code", "execution_count": null, "id": "612f385f", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK clear_dataset\"); mn.clear_dataset()" ] }, { "cell_type": "markdown", "id": "2fadd38b", "metadata": {}, "source": [ "Remove the selected dataset from the server using its id\n" ] }, { "cell_type": "code", "execution_count": null, "id": "e0ff33a8", "metadata": {}, "outputs": [], "source": [ "print(\"->> OK delete_dataset\"); mn.delete_dataset()" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.7" } }, "nbformat": 4, "nbformat_minor": 5 }