idx int64 0 63k | question stringlengths 61 4.03k | target stringlengths 6 1.23k |
|---|---|---|
56,000 | def from_der_private_key ( data : bytes , password : Optional [ str ] = None ) -> _RSAPrivateKey : return serialization . load_der_private_key ( data , password , default_backend ( ) ) | Convert private key in DER encoding to a Private key object |
56,001 | async def get_object ( self , Bucket : str , Key : str , ** kwargs ) -> dict : if self . _s3_client is None : await self . setup ( ) _range = kwargs . get ( 'Range' ) actual_range_start = None desired_range_start = None desired_range_end = None if _range : range_match = RANGE_REGEX . match ( _range ) if not range_match... | S3 GetObject . Takes same args as Boto3 documentation |
56,002 | async def put_object ( self , Body : Union [ bytes , IO ] , Bucket : str , Key : str , Metadata : Dict = None , ** kwargs ) : if self . _s3_client is None : await self . setup ( ) if hasattr ( Body , 'read' ) : if inspect . iscoroutinefunction ( Body . read ) : Body = await Body . read ( ) else : Body = Body . read ( )... | PutObject . Takes same args as Boto3 documentation |
56,003 | def histogram1d ( x , bins , range , weights = None ) : nx = bins if not np . isscalar ( bins ) : raise TypeError ( 'bins should be an integer' ) xmin , xmax = range if not np . isfinite ( xmin ) : raise ValueError ( "xmin should be finite" ) if not np . isfinite ( xmax ) : raise ValueError ( "xmax should be finite" ) ... | Compute a 1D histogram assuming equally spaced bins . |
56,004 | def histogram2d ( x , y , bins , range , weights = None ) : if isinstance ( bins , numbers . Integral ) : nx = ny = bins else : nx , ny = bins if not np . isscalar ( nx ) or not np . isscalar ( ny ) : raise TypeError ( 'bins should be an iterable of two integers' ) ( xmin , xmax ) , ( ymin , ymax ) = range if not np . ... | Compute a 2D histogram assuming equally spaced bins . |
56,005 | def to_networkx ( self ) : return nx_util . to_networkx ( self . session . get ( self . __url ) . json ( ) ) | Return this network in NetworkX graph object . |
56,006 | def to_dataframe ( self , extra_edges_columns = [ ] ) : return df_util . to_dataframe ( self . session . get ( self . __url ) . json ( ) , edges_attr_cols = extra_edges_columns ) | Return this network in pandas DataFrame . |
56,007 | def add_node ( self , node_name , dataframe = False ) : if node_name is None : return None return self . add_nodes ( [ node_name ] , dataframe = dataframe ) | Add a single node to the network . |
56,008 | def add_nodes ( self , node_name_list , dataframe = False ) : res = self . session . post ( self . __url + 'nodes' , data = json . dumps ( node_name_list ) , headers = HEADERS ) check_response ( res ) nodes = res . json ( ) if dataframe : return pd . DataFrame ( nodes ) . set_index ( [ 'SUID' ] ) else : return { node [... | Add new nodes to the network |
56,009 | def add_edge ( self , source , target , interaction = '-' , directed = True , dataframe = True ) : new_edge = { 'source' : source , 'target' : target , 'interaction' : interaction , 'directed' : directed } return self . add_edges ( [ new_edge ] , dataframe = dataframe ) | Add a single edge from source to target . |
56,010 | def get_views ( self ) : url = self . __url + 'views' return self . session . get ( url ) . json ( ) | Get views as a list of SUIDs |
56,011 | def diffuse_advanced ( self , heatColumnName = None , time = None , verbose = False ) : PARAMS = set_param ( [ "heatColumnName" , "time" ] , [ heatColumnName , time ] ) response = api ( url = self . __url + "/diffuse_advanced" , PARAMS = PARAMS , method = "POST" , verbose = verbose ) return response | Diffusion will send the selected network view and its selected nodes to a web - based REST service to calculate network propagation . Results are returned and represented by columns in the node table . Columns are created for each execution of Diffusion and their names are returned in the response . |
56,012 | def to_networkx ( cyjs , directed = True ) : if directed : g = nx . MultiDiGraph ( ) else : g = nx . MultiGraph ( ) network_data = cyjs [ DATA ] if network_data is not None : for key in network_data . keys ( ) : g . graph [ key ] = network_data [ key ] nodes = cyjs [ ELEMENTS ] [ NODES ] edges = cyjs [ ELEMENTS ] [ EDG... | Convert Cytoscape . js - style JSON object into NetworkX object . |
56,013 | def dialog ( self = None , wid = None , text = None , title = None , url = None , debug = False , verbose = False ) : PARAMS = set_param ( [ "id" , "text" , "title" , "url" , "debug" ] , [ wid , text , title , url , debug ] ) response = api ( url = self . __url + "/dialog?" , PARAMS = PARAMS , method = "GET" , verbose ... | Launch and HTML browser in a separate window . |
56,014 | def hide ( self , wid , verbose = False ) : PARAMS = { "id" : wid } response = api ( url = self . __url + "/hide?" , PARAMS = PARAMS , method = "GET" , verbose = verbose ) return response | Hide and HTML browser in the Results Panel . |
56,015 | def show ( self , wid = None , text = None , title = None , url = None , verbose = False ) : PARAMS = { } for p , v in zip ( [ "id" , "text" , "title" , "url" ] , [ wid , text , title , url ] ) : if v : PARAMS [ p ] = v response = api ( url = self . __url + "/show?" , PARAMS = PARAMS , method = "GET" , verbose = verbos... | Launch an HTML browser in the Results Panel . |
56,016 | def check_response ( res ) : try : res . raise_for_status ( ) except Exception as exc : try : err_info = res . json ( ) err_msg = err_info [ 'message' ] except ValueError : err_msg = res . text [ : 40 ] except KeyError : err_msg = res . text [ : 40 ] + ( "(No 'message' in err_info dict: %s" % list ( err_info . keys ( )... | Check HTTP response and raise exception if response is not OK . |
56,017 | def from_dataframe ( df , source_col = 'source' , target_col = 'target' , interaction_col = 'interaction' , name = 'From DataFrame' , edge_attr_cols = [ ] ) : network = cyjs . get_empty_network ( name = name ) nodes = set ( ) if edge_attr_cols is None : edge_attr_cols = [ ] for index , row in df . iterrows ( ) : s = ro... | Utility to convert Pandas DataFrame object into Cytoscape . js JSON |
56,018 | def to_dataframe ( network , interaction = 'interaction' , default_interaction = '-' , edges_attr_cols = [ ] ) : edges = network [ 'elements' ] [ 'edges' ] if edges_attr_cols is None : edges_attr_cols = [ ] edges_attr_cols = sorted ( edges_attr_cols ) network_array = [ ] valid_extra_cols = set ( ) for edge in edges : e... | Utility to convert a Cytoscape dictionary into a Pandas Dataframe . |
56,019 | def render ( network , style = DEF_STYLE , layout_algorithm = DEF_LAYOUT , background = DEF_BACKGROUND_COLOR , height = DEF_HEIGHT , width = DEF_WIDTH , style_file = STYLE_FILE , def_nodes = DEF_NODES , def_edges = DEF_EDGES ) : from jinja2 import Template from IPython . core . display import display , HTML STYLES = se... | Render network data with embedded Cytoscape . js widget . |
56,020 | def create_attribute ( self , column = None , listType = None , namespace = None , network = None , atype = None , verbose = False ) : network = check_network ( self , network , verbose = verbose ) PARAMS = set_param ( [ "column" , "listType" , "namespace" , "network" , "type" ] , [ column , listType , namespace , netw... | Creates a new edge column . |
56,021 | def get ( self , edge = None , network = None , sourceNode = None , targetNode = None , atype = None , verbose = False ) : network = check_network ( self , network , verbose = verbose ) PARAMS = set_param ( [ "edge" , "network" , "sourceNode" , "targetNode" , "type" ] , [ edge , network , sourceNode , targetNode , atyp... | Returns the SUID of an edge that matches the passed parameters . If multiple edges are found only one will be returned and a warning will be reported in the Cytoscape Task History dialog . |
56,022 | def add_edge ( self , isDirected = None , name = None , network = None , sourceName = None , targetName = None , verbose = False ) : network = check_network ( self , network , verbose = verbose ) PARAMS = set_param ( [ "isDirected" , "name" , "network" , "sourceName" , "targetName" ] , [ isDirected , name , network , s... | Add a new edge between two existing nodes in a network . The names of the nodes must be specified and much match the value in the name column for each node . |
56,023 | def create ( self , edgeList = None , excludeEdges = None , networkName = None , nodeList = None , source = None , verbose = False ) : network = check_network ( self , source , verbose = verbose ) PARAMS = set_param ( [ "edgeList" , "excludeEdges" , "networkName" , "nodeList" , "source" ] , [ edgeList , excludeEdges , ... | Create a new network from a list of nodes and edges in an existing source network . The SUID of the network and view are returned . |
56,024 | def create_empty ( self , name = None , renderers = None , RootNetworkList = None , verbose = False ) : PARAMS = set_param ( [ "name" , "renderers" , "RootNetworkList" ] , [ name , renderers , RootNetworkList ] ) response = api ( url = self . __url + "/create empty" , PARAMS = PARAMS , method = "POST" , verbose = verbo... | Create a new empty network . The new network may be created as part of an existing network collection or a new network collection . |
56,025 | def list ( self , verbose = False ) : response = api ( url = self . __url + "/list" , method = "POST" , verbose = verbose ) return response | List all of the networks in the current session . |
56,026 | def list_attributes ( self , namespace = None , network = None , verbose = False ) : network = check_network ( self , network , verbose = verbose ) PARAMS = set_param ( [ "namespace" , "network" ] , [ namespace , network ] ) response = api ( url = self . __url + "/list attributes" , PARAMS = PARAMS , method = "POST" , ... | Returns a list of column names assocated with a network . |
56,027 | def rename ( self , name = None , sourceNetwork = None , verbose = False ) : sourceNetwork = check_network ( self , sourceNetwork , verbose = verbose ) PARAMS = set_param ( [ "name" , "sourceNetwork" ] , [ name , sourceNetwork ] ) response = api ( url = self . __url + "/rename" , PARAMS = PARAMS , method = "POST" , ver... | Rename an existing network . The SUID of the network is returned |
56,028 | def new ( self , verbose = False ) : response = api ( url = self . __url + "/new" , verbose = verbose ) return response | Destroys the current session and creates a new empty one . |
56,029 | def open ( self , session_file = None , session_url = None , verbose = False ) : PARAMS = set_param ( [ "file" , "url" ] , [ session_file , session_url ] ) response = api ( url = self . __url + "/open" , PARAMS = PARAMS , verbose = verbose ) return response | Opens a session from a local file or URL . |
56,030 | def save ( self , session_file , verbose = False ) : PARAMS = { "file" : session_file } response = api ( url = self . __url + "/save" , PARAMS = PARAMS , verbose = verbose ) return response | Saves the current session to an existing file which will be replaced . If this is a new session that has not been saved yet use save as instead . |
56,031 | def apply ( self , styles = None , verbose = False ) : PARAMS = set_param ( [ "styles" ] , [ styles ] ) response = api ( url = self . __url + "/apply" , PARAMS = PARAMS , method = "POST" , verbose = verbose ) return response | Applies the specified style to the selected views and returns the SUIDs of the affected views . |
56,032 | def create_style ( self , title = None , defaults = None , mappings = None , verbose = VERBOSE ) : u = self . __url host = u . split ( "//" ) [ 1 ] . split ( ":" ) [ 0 ] port = u . split ( ":" ) [ 2 ] . split ( "/" ) [ 0 ] version = u . split ( ":" ) [ 2 ] . split ( "/" ) [ 1 ] if defaults : defaults_ = [ ] for d in de... | Creates a new visual style |
56,033 | def update_style ( self , title = None , defaults = None , mappings = None , verbose = False ) : u = self . __url host = u . split ( "//" ) [ 1 ] . split ( ":" ) [ 0 ] port = u . split ( ":" ) [ 2 ] . split ( "/" ) [ 0 ] version = u . split ( ":" ) [ 2 ] . split ( "/" ) [ 1 ] if defaults : defaults_ = [ ] for d in defa... | Updates a visual style |
56,034 | def simple_defaults ( self , defaults_dic ) : defaults = [ ] for d in defaults_dic . keys ( ) : dic = { } dic [ "visualProperty" ] = d dic [ "value" ] = defaults_dic [ d ] defaults . append ( dic ) return defaults | Simplifies defaults . |
56,035 | def attribute_circle ( self , EdgeAttribute = None , network = None , NodeAttribute = None , nodeList = None , singlePartition = None , spacing = None , verbose = False ) : network = check_network ( self , network , verbose = verbose ) PARAMS = set_param ( [ "EdgeAttribute" , "network" , "NodeAttribute" , "nodeList" , ... | Execute the Attribute Circle Layout on a network . |
56,036 | def attributes_layout ( self , EdgeAttribute = None , maxwidth = None , minrad = None , network = None , NodeAttribute = None , nodeList = None , radmult = None , spacingx = None , spacingy = None , verbose = False ) : network = check_network ( self , network , verbose = verbose ) PARAMS = set_param ( [ "EdgeAttribute"... | Execute the Group Attributes Layout on a network |
56,037 | def circular ( self , EdgeAttribute = None , leftEdge = None , network = None , NodeAttribute = None , nodeHorizontalSpacing = None , nodeList = None , nodeVerticalSpacing = None , rightMargin = None , singlePartition = None , topEdge = None , verbose = None ) : network = check_network ( self , network , verbose = verb... | Execute the Circular Layout on a network |
56,038 | def copycat ( self , gridUnmapped = None , selectUnmapped = None , sourceColumn = None , sourceNetwork = None , targetColumn = None , targetNetwork = None , verbose = None ) : PARAMS = set_param ( [ 'gridUnmapped' , 'selectUnmapped' , 'sourceColumn' , 'sourceNetwork' , 'targetColumn' , 'targetNetwork' ] , [ gridUnmappe... | Sets the coordinates for each node in the target network to the coordinates of a matching node in the source network . Optional parameters such as gridUnmapped and selectUnmapped determine the behavior of target network nodes that could not be matched . |
56,039 | def degree_circle ( self , EdgeAttribute = None , network = None , NodeAttribute = None , nodeList = None , singlePartition = None , verbose = None ) : network = check_network ( self , network , verbose = verbose ) PARAMS = set_param ( [ 'EdgeAttribute' , 'network' , 'NodeAttribute' , 'nodeList' , 'singlePartition' ] ,... | Execute the Degree Sorted Circle Layout on a network . |
56,040 | def force_directed ( self , defaultEdgeWeight = None , defaultNodeMass = None , defaultSpringCoefficient = None , defaultSpringLength = None , EdgeAttribute = None , isDeterministic = None , maxWeightCutoff = None , minWeightCutoff = None , network = None , NodeAttribute = None , nodeList = None , numIterations = None ... | Execute the Prefuse Force Directed Layout on a network |
56,041 | def genemania_force_directed ( self , curveSteepness = None , defaultEdgeWeight = None , defaultSpringCoefficient = None , defaultSpringLength = None , EdgeAttribute = None , ignoreHiddenElements = None , isDeterministic = None , maxNodeMass = None , maxWeightCutoff = None , midpointEdges = None , minNodeMass = None , ... | Execute the GeneMANIA Force Directed Layout on a network . |
56,042 | def get_preferred ( self , network = None , verbose = None ) : network = check_network ( self , network , verbose = verbose ) PARAMS = set_param ( [ 'network' ] , [ network ] ) response = api ( url = self . __url + "/get preferred" , PARAMS = PARAMS , method = "POST" , verbose = verbose ) return response | Returns the name of the current preferred layout or empty string if not set . Default is grid . |
56,043 | def grid ( self , EdgeAttribute = None , network = None , NodeAttribute = None , nodeHorizontalSpacing = None , nodeList = None , nodeVerticalSpacing = None , verbose = None ) : network = check_network ( self , network , verbose = verbose ) PARAMS = set_param ( [ 'EdgeAttribute' , 'network' , 'NodeAttribute' , 'nodeHor... | Execute the Grid Layout on a network . |
56,044 | def hierarchical ( self , bandGap = None , componentSpacing = None , EdgeAttribute = None , leftEdge = None , network = None , NodeAttribute = None , nodeHorizontalSpacing = None , nodeList = None , nodeVerticalSpacing = None , rightMargin = None , topEdge = None , verbose = None ) : network = check_network ( self , ne... | Execute the Hierarchical Layout on a network . |
56,045 | def isom ( self , coolingFactor = None , EdgeAttribute = None , initialAdaptation = None , maxEpoch = None , minAdaptation = None , minRadius = None , network = None , NodeAttribute = None , nodeList = None , radius = None , radiusConstantTime = None , singlePartition = None , sizeFactor = None , verbose = None ) : net... | Execute the Inverted Self - Organizing Map Layout on a network . |
56,046 | def kamada_kawai ( self , defaultEdgeWeight = None , EdgeAttribute = None , m_anticollisionSpringStrength = None , m_averageIterationsPerNode = None , m_disconnectedNodeDistanceSpringRestLength = None , m_disconnectedNodeDistanceSpringStrength = None , m_layoutPass = None , m_nodeDistanceRestLengthConstant = None , m_n... | Execute the Edge - weighted Spring Embedded Layout on a network . |
56,047 | def set_preferred ( self , preferredLayout = None , verbose = None ) : PARAMS = set_param ( [ 'preferredLayout' ] , [ preferredLayout ] ) response = api ( url = self . __url + "/set preferred" , PARAMS = PARAMS , method = "POST" , verbose = verbose ) return response | Sets the preferred layout . Takes a specific name as defined in the API Default is grid . |
56,048 | def stacked_node_layout ( self , EdgeAttribute = None , network = None , NodeAttribute = None , nodeList = None , x_position = None , y_start_position = None , verbose = None ) : network = check_network ( self , network , verbose = verbose ) PARAMS = set_param ( [ 'EdgeAttribute' , 'network' , 'NodeAttribute' , 'nodeLi... | Execute the Stacked Node Layout on a network . |
56,049 | def create_column ( self , columnName = None , listType = None , table = None , ntype = None , verbose = None ) : PARAMS = set_param ( [ 'columnName' , 'listType' , 'table' , 'type' ] , [ columnName , listType , table , ntype ] ) response = api ( url = self . __url + "/create column" , PARAMS = PARAMS , method = "POST"... | Appends an additional column of attribute values to the current table . |
56,050 | def create_table ( self , keyColumn = None , keyColumnType = None , title = None , verbose = None ) : PARAMS = set_param ( [ 'keyColumn' , 'keyColumnType' , 'title' ] , [ keyColumn , keyColumnType , title ] ) response = api ( url = self . __url + "/create table" , PARAMS = PARAMS , method = "POST" , verbose = verbose )... | Adds a new table to the network . |
56,051 | def delete_column ( self , column = None , table = None , verbose = None ) : PARAMS = set_param ( [ 'column' , 'table' ] , [ column , table ] ) response = api ( url = self . __url + "/delete column" , PARAMS = PARAMS , method = "POST" , verbose = verbose ) return response | Remove a column from a table specified by its name . Returns the name of the column removed . |
56,052 | def delete_row ( self , keyValue = None , table = None , verbose = None ) : PARAMS = set_param ( [ 'keyValue' , 'table' ] , [ keyValue , table ] ) response = api ( url = self . __url + "/delete row" , PARAMS = PARAMS , method = "POST" , verbose = verbose ) return response | Deletes a row from a table . Requires the table name or SUID and the row key . |
56,053 | def get_value ( self , column = None , keyValue = None , table = None , verbose = None ) : PARAMS = set_param ( [ 'column' , 'keyValue' , 'table' ] , [ column , keyValue , table ] ) response = api ( url = self . __url + "/get value" , PARAMS = PARAMS , method = "POST" , verbose = verbose ) return response | Returns the value from a cell as specified by row and column ids . |
56,054 | def import_url ( self , caseSensitiveNetworkCollectionKeys = None , caseSensitiveNetworkKeys = None , dataTypeList = None , DataTypeTargetForNetworkCollection = None , DataTypeTargetForNetworkList = None , delimiters = None , delimitersForDataList = None , firstRowAsColumnNames = None , KeyColumnForMapping = None , Key... | Similar to Import Table this uses a long list of input parameters to specify the attributes of the table the mapping keys and the destination table for the input . |
56,055 | def list_tables ( self , includePrivate = None , namespace = None , atype = None , verbose = None ) : PARAMS = set_param ( [ 'includePrivate' , 'namespace' , 'type' ] , [ includePrivate , namespace , atype ] ) response = api ( url = self . __url + "/list" , PARAMS = PARAMS , method = "POST" , verbose = verbose ) return... | Returns a list of the table SUIDs associated with the passed network parameter . |
56,056 | def list_columns ( self , table = None , verbose = None ) : PARAMS = set_param ( [ 'table' ] , [ table ] ) response = api ( url = self . __url + "/list columns" , PARAMS = PARAMS , method = "POST" , verbose = verbose ) return response | Returns the list of columns in the table . |
56,057 | def list_rows ( self , rowList = None , table = None , verbose = None ) : PARAMS = set_param ( [ 'rowList' , 'table' ] , [ rowList , table ] ) response = api ( url = self . __url + "/list rows" , PARAMS = PARAMS , method = "POST" , verbose = verbose ) return response | Returns the list of primary keys for each of the rows in the specified table . |
56,058 | def merge ( self , DataTypeTargetForNetworkCollection = None , dataTypeTargetForNetworkList = None , mergeType = None , SourceMergeColumns = None , SourceMergeKey = None , SourceTable = None , TargetKeyNetworkCollection = None , TargetMergeKey = None , TargetNetworkCollection = None , TargetNetworkList = None , Unassig... | Merge tables together joining around a designated key column . Depending on the arguments might merge into multiple local tables . |
56,059 | def rename_column ( self , columnName = None , newColumnName = None , table = None , verbose = None ) : PARAMS = set_param ( [ 'columnName' , 'newColumnName' , 'table' ] , [ columnName , newColumnName , table ] ) response = api ( url = self . __url + "/rename column" , PARAMS = PARAMS , method = "POST" , verbose = verb... | Changes the name of a specified column in the table . |
56,060 | def set_title ( self , table = None , title = None , verbose = None ) : PARAMS = set_param ( [ 'table' , 'title' ] , [ table , title ] ) response = api ( url = self . __url + "/set title" , PARAMS = PARAMS , method = "POST" , verbose = verbose ) return response | Changes the visible identifier of a single table . |
56,061 | def set_values ( self , columnName = None , rowList = None , table = None , value = None , verbose = None ) : PARAMS = set_param ( [ 'columnName' , 'rowList' , 'table' , 'value' ] , [ columnName , rowList , table , value ] ) response = api ( url = self . __url + "/set values" , PARAMS = PARAMS , method = "POST" , verbo... | Set all the values in the specified list of rows with a single value . |
56,062 | def getTable ( self , columns = None , table = None , network = "current" , namespace = 'default' , verbose = VERBOSE ) : u = self . __url host = u . split ( "//" ) [ 1 ] . split ( ":" ) [ 0 ] port = u . split ( ":" ) [ 2 ] . split ( "/" ) [ 0 ] version = u . split ( ":" ) [ 2 ] . split ( "/" ) [ 1 ] if type ( network ... | Gets tables from cytoscape . |
56,063 | def loadTableData ( self , df , df_key = 'index' , table = "node" , table_key_column = "name" , network = "current" , namespace = "default" , verbose = False ) : u = self . __url host = u . split ( "//" ) [ 1 ] . split ( ":" ) [ 0 ] port = u . split ( ":" ) [ 2 ] . split ( "/" ) [ 0 ] version = u . split ( ":" ) [ 2 ] ... | Loads tables into cytoscape . |
56,064 | def getTableCount ( verbose = None ) : response = api ( url = self . url + 'tables/count' , method = "GET" , verbose = verbose , parse_params = False ) return response | Returns the number of global tables . |
56,065 | def set_value ( self , visual_property , value ) : if visual_property is None or value is None : raise ValueError ( 'Both VP and value are required.' ) new_value = [ { 'visualProperty' : visual_property , "value" : value } ] requests . put ( self . url , data = json . dumps ( new_value ) , headers = HEADERS ) | Set a single Visual Property Value |
56,066 | def set_values ( self , values ) : if values is None : raise ValueError ( 'Values are required.' ) new_values = [ ] for vp in values . keys ( ) : new_val = { 'visualProperty' : vp , 'value' : values [ vp ] } new_values . append ( new_val ) requests . put ( self . url , data = json . dumps ( new_values ) , headers = HEA... | Set multiple Visual properties at once . |
56,067 | def get_value ( self , visual_property ) : res = requests . get ( self . url + '/' + visual_property ) return res . json ( ) [ 'value' ] | Get a value for the Visual Property |
56,068 | def get_values ( self ) : results = requests . get ( self . url ) . json ( ) values = { } for entry in results : values [ entry [ 'visualProperty' ] ] = entry [ 'value' ] return values | Get all visual property values for the object |
56,069 | def update_network_view ( self , visual_property = None , value = None ) : new_value = [ { "visualProperty" : visual_property , "value" : value } ] res = requests . put ( self . __url + '/network' , data = json . dumps ( new_value ) , headers = HEADERS ) check_response ( res ) | Updates single value for Network - related VP . |
56,070 | def export ( self , Height = None , options = None , outputFile = None , Resolution = None , Units = None , Width = None , Zoom = None , view = "current" , verbose = False ) : PARAMS = set_param ( [ "Height" , "options" , "outputFile" , "Resolution" , "Units" , "Width" , "Zoom" , "view" ] , [ Height , options , outputF... | Exports the current view to a graphics file and returns the path to the saved file . PNG and JPEG formats have options for scaling while other formats only have the option exportTextAsFont . For the PDF format exporting text as font does not work for two - byte characters such as Chinese or Japanese . To avoid corrupte... |
56,071 | def fit_content ( self , verbose = False ) : PARAMS = { } response = api ( url = self . __url + "/fit content" , PARAMS = PARAMS , method = "POST" , verbose = verbose ) return response | Zooms out the current view in order to display all of its elements . |
56,072 | def get_current ( self , layout = None , network = None , verbose = False ) : PARAMS = { } response = api ( url = self . __url + "/get_current" , PARAMS = PARAMS , method = "POST" , verbose = verbose ) return response | Returns the current view or null if there is none . |
56,073 | def update_defaults ( self , prop_value_dict ) : body = [ ] for key in prop_value_dict : entry = { 'visualProperty' : key , 'value' : prop_value_dict [ key ] } body . append ( entry ) url = self . __url + 'defaults' requests . put ( url , data = json . dumps ( body ) , headers = HEADERS ) | Updates the value of one or more visual properties . |
56,074 | def status ( self , verbose = False ) : try : response = api ( url = self . __url , method = "GET" , verbose = verbose ) except Exception as e : print ( 'Could not get status from CyREST:\n\n' + str ( e ) ) else : print ( 'CyREST online!' ) | Checks the status of your CyREST server . |
56,075 | def version ( self , verbose = False ) : response = api ( url = self . __url + "version" , method = "H" , verbose = verbose ) response = json . loads ( response ) for k in response . keys ( ) : print ( k , response [ k ] ) | Checks Cytoscape version |
56,076 | def map_column ( self , only_use_one = None , source_column = None , species = None , target_selection = None , verbose = False ) : PARAMS = set_param ( [ "only_use_one" , "source_column" , "species" , "target_selection" ] , [ only_use_one , source_column , species , target_selection ] ) response = api ( url = self . _... | Uses the BridgeDB service to look up analogous identifiers from a wide selection of other databases |
56,077 | def echo ( self , variableName , verbose = False ) : PARAMS = { "variableName" : variableName } response = api ( url = self . __url + "/echo" , PARAMS = PARAMS , verbose = verbose ) return response | The echo command will display the value of the variable specified by the variableName argument or all variables if variableName is not provided . |
56,078 | def open_dialog ( self , verbose = False ) : response = api ( url = self . __url + "/open dialog" , verbose = verbose ) return response | The command line dialog provides a field to enter commands and view results . It also provides the help command to display namespaces commands and arguments . |
56,079 | def pause ( self , message = None , verbose = False ) : PARAMS = set_param ( [ "message" ] , [ message ] ) response = api ( url = self . __url + "/pause" , PARAMS = PARAMS , verbose = verbose ) return response | The pause command displays a dialog with the text provided in the message argument and waits for the user to click OK |
56,080 | def quit ( self , verbose = False ) : response = api ( url = self . __url + "/quit" , verbose = verbose ) return response | This command causes Cytoscape to exit . It is typically used at the end of a script file . |
56,081 | def run ( self , script_file , args = None , verbose = False ) : PARAMS = set_param ( [ "file" , "args" ] , [ script_file , args ] ) response = api ( url = self . __url + "/run" , PARAMS = PARAMS , verbose = verbose ) return response | The run command will execute a command script from the file pointed to by the file argument which should contain Cytoscape commands one per line . Arguments to the script are provided by the args argument . |
56,082 | def sleep ( self , duration , verbose = False ) : PARAMS = { "duration" : str ( duration ) } response = api ( url = self . __url + "/sleep" , PARAMS = PARAMS , verbose = verbose ) return response | The sleep command will pause processing for a period of time as specified by duration seconds . It is typically used as part of a command script . |
56,083 | def to_curl ( request , compressed = False , verify = True ) : parts = [ ( 'curl' , None ) , ( '-X' , request . method ) , ] for k , v in sorted ( request . headers . items ( ) ) : parts += [ ( '-H' , '{0}: {1}' . format ( k , v ) ) ] if request . body : body = request . body if isinstance ( body , bytes ) : body = bod... | Returns string with curl command by provided request object |
56,084 | def shared_options ( rq ) : "Default class options to pass to the CLI commands." return { 'url' : rq . redis_url , 'config' : None , 'worker_class' : rq . worker_class , 'job_class' : rq . job_class , 'queue_class' : rq . queue_class , 'connection_class' : rq . connection_class , } | Default class options to pass to the CLI commands . |
56,085 | def empty ( rq , ctx , all , queues ) : "Empty given queues." return ctx . invoke ( rq_cli . empty , all = all , queues = queues or rq . queues , ** shared_options ( rq ) ) | Empty given queues . |
56,086 | def requeue ( rq , ctx , all , job_ids ) : "Requeue failed jobs." return ctx . invoke ( rq_cli . requeue , all = all , job_ids = job_ids , ** shared_options ( rq ) ) | Requeue failed jobs . |
56,087 | def info ( rq , ctx , path , interval , raw , only_queues , only_workers , by_queue , queues ) : "RQ command-line monitor." return ctx . invoke ( rq_cli . info , path = path , interval = interval , raw = raw , only_queues = only_queues , only_workers = only_workers , by_queue = by_queue , queues = queues or rq . queues... | RQ command - line monitor . |
56,088 | def worker ( rq , ctx , burst , logging_level , name , path , results_ttl , worker_ttl , verbose , quiet , sentry_dsn , exception_handler , pid , queues ) : "Starts an RQ worker." ctx . invoke ( rq_cli . worker , burst = burst , logging_level = logging_level , name = name , path = path , results_ttl = results_ttl , wor... | Starts an RQ worker . |
56,089 | def suspend ( rq , ctx , duration ) : "Suspends all workers." ctx . invoke ( rq_cli . suspend , duration = duration , ** shared_options ( rq ) ) | Suspends all workers . |
56,090 | def scheduler ( rq , ctx , verbose , burst , queue , interval , pid ) : "Periodically checks for scheduled jobs." scheduler = rq . get_scheduler ( interval = interval , queue = queue ) if pid : with open ( os . path . expanduser ( pid ) , 'w' ) as fp : fp . write ( str ( os . getpid ( ) ) ) if verbose : level = 'DEBUG'... | Periodically checks for scheduled jobs . |
56,091 | def init_cli ( self , app ) : if click is None : raise RuntimeError ( 'Cannot import click. Is it installed?' ) from . cli import add_commands add_commands ( app . cli , self ) | Initialize the Flask CLI support in case it was enabled for the app . |
56,092 | def set_trace ( host = None , port = None , patch_stdstreams = False ) : if host is None : host = os . environ . get ( 'REMOTE_PDB_HOST' , '127.0.0.1' ) if port is None : port = int ( os . environ . get ( 'REMOTE_PDB_PORT' , '0' ) ) rdb = RemotePdb ( host = host , port = port , patch_stdstreams = patch_stdstreams ) rdb... | Opens a remote PDB on first available port . |
56,093 | def quasi_newton_uniform_lloyd ( points , cells , * args , omega = 1.0 , ** kwargs ) : def get_new_points ( mesh ) : x = ( mesh . node_coords - omega / 2 * jac_uniform ( mesh ) / mesh . control_volumes [ : , None ] ) idx = mesh . is_boundary_node & ~ ghosted_mesh . is_ghost_point x [ idx ] = mesh . node_coords [ idx ] ... | Relaxed Lloyd s algorithm . omega = 1 leads to Lloyd s algorithm overrelaxation omega = 2 gives good results . Check out |
56,094 | def _energy_uniform_per_node ( X , cells ) : dim = 2 mesh = MeshTri ( X , cells ) star_integrals = numpy . zeros ( mesh . node_coords . shape [ 0 ] ) for cell , cell_volume in zip ( mesh . cells [ "nodes" ] , mesh . cell_volumes ) : for idx in cell : xi = mesh . node_coords [ idx ] tri = mesh . node_coords [ cell ] val... | The CPT mesh energy is defined as |
56,095 | def jac_uniform ( X , cells ) : dim = 2 mesh = MeshTri ( X , cells ) jac = numpy . zeros ( X . shape ) for k in range ( mesh . cells [ "nodes" ] . shape [ 1 ] ) : i = mesh . cells [ "nodes" ] [ : , k ] fastfunc . add . at ( jac , i , ( ( mesh . node_coords [ i ] - mesh . cell_barycenters ) . T * mesh . cell_volumes ) .... | The approximated Jacobian is |
56,096 | def solve_hessian_approx_uniform ( X , cells , rhs ) : dim = 2 mesh = MeshTri ( X , cells ) row_idx = [ ] col_idx = [ ] val = [ ] cells = mesh . cells [ "nodes" ] . T n = X . shape [ 0 ] a = mesh . cell_volumes * ( 2 / ( dim + 1 ) ) for i in [ 0 , 1 , 2 ] : row_idx += [ cells [ i ] ] col_idx += [ cells [ i ] ] val += [... | As discussed above the approximated Jacobian is |
56,097 | def quasi_newton_uniform ( points , cells , * args , ** kwargs ) : def get_new_points ( mesh ) : x = mesh . node_coords . copy ( ) cells = mesh . cells [ "nodes" ] jac_x = jac_uniform ( x , cells ) x -= solve_hessian_approx_uniform ( x , cells , jac_x ) return x mesh = MeshTri ( points , cells ) runner ( get_new_points... | Like linear_solve above but assuming rho == 1 . Note that the energy gradient |
56,098 | def fixed_point ( points , cells , * args , ** kwargs ) : def get_new_points ( mesh ) : num_neighbors = numpy . zeros ( len ( mesh . node_coords ) , dtype = int ) idx = mesh . edges [ "nodes" ] fastfunc . add . at ( num_neighbors , idx , numpy . ones ( idx . shape , dtype = int ) ) new_points = numpy . zeros ( mesh . n... | Perform k steps of Laplacian smoothing to the mesh i . e . moving each interior vertex to the arithmetic average of its neighboring points . |
56,099 | def energy ( mesh , uniform_density = False ) : dim = mesh . cells [ "nodes" ] . shape [ 1 ] - 1 star_volume = numpy . zeros ( mesh . node_coords . shape [ 0 ] ) for i in range ( 3 ) : idx = mesh . cells [ "nodes" ] [ : , i ] if uniform_density : fastfunc . add . at ( star_volume , idx , mesh . cell_volumes ) else : fa... | The mesh energy is defined as |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.