In [1]:
import os
import pandas as pd
import matplotlib.pyplot as plt
import scipy
import numpy as np
from allensdk.core.mouse_connectivity_cache import MouseConnectivityCache
from allensdk.api.queries.ontologies_api import OntologiesApi

%matplotlib inline

In [2]:
def sem(data):
    return data.std()/np.sqrt(len(data))

In [3]:
#def conn_strength_2(strOne,strTwo):
#strOne must be a structure in thalamus
#strTwo is a layer of the primary motor cortex

drive_path = '/Volumes/Brain2016'


resolution_um=25
manifest_file = os.path.join(drive_path, "MouseConnectivity","manifest.json")
mcc = MouseConnectivityCache(manifest_file=manifest_file, resolution=resolution_um)

all_experiments = mcc.get_experiments(dataframe=True)

ontology = mcc.get_ontology()

strOne = 'MOp'
strTwo = 'DORsm'

str1 = ontology[strOne]
str1_desc = ontology.get_descendants(str1.id)



# get the adult mouse structures summary structures

oa = OntologiesApi()
set_name = [oa.quote_string('Mouse Connectivity - Summary')]
summary_structures = oa.get_structures(structure_set_names=set_name)
summary_structure_ids = [ s['id'] for s in summary_structures ]


cre_str1_experiments = mcc.get_experiments(cre = ['Chrna2-Cre_OE25','Etv1-CreERT2','Gpr26-Cre_KO250', 'Rbp4-Cre_KL100',
                                                  'Rorb-IRES2-Cre','Sim1-Cre_KJ18','Tlx3-Cre_PL56'], injection_structure_ids=str1['id'])
cre_str1_exps_df = pd.DataFrame(cre_str1_experiments)

str1_children = ontology[strTwo]
#print str1['id']
#print ('Structure Two ID:',str1_children['id'])


structure_unionizes_str1 = mcc.get_structure_unionizes([ e['id'] for e in cre_str1_experiments ], 
                                              is_injection=None,
                                              structure_ids=[str1['id'], str1_children['id']])

ipsi_source = structure_unionizes_str1[(structure_unionizes_str1.hemisphere_id == 3) & 
                                   (structure_unionizes_str1.normalized_projection_volume > .8) &
                                   (structure_unionizes_str1.is_injection == True) &
                                   (structure_unionizes_str1.structure_id == float(str1.id))]
X = ipsi_source.pivot(index='experiment_id', columns='structure_id', values='projection_volume')

ipsi_target = structure_unionizes_str1[(structure_unionizes_str1.hemisphere_id == 3) & 
                                   (structure_unionizes_str1.is_injection == False) &
                                   (structure_unionizes_str1.structure_id == float(str1_children.id))]
Ydash = ipsi_target.pivot(index='experiment_id', columns='structure_id', values='projection_volume')
Y = Ydash.loc[X.index]


trans = all_experiments.loc[Y.index]['transgenic-line']

weight = Y.values/X.values

df = pd.DataFrame(trans)
expt_ids = df.index.values
lines = df['transgenic-line'].values
weight = np.squeeze(weight)
data_dict = {}
data_dict['experiment_id']=expt_ids
data_dict['transgenic_line']=lines
data_dict['weight']=weight


xy = pd.DataFrame(data_dict)
#yz = xy.sort(columns = 'transgenic_line')    
df1 = xy.sort_values(['transgenic_line', 'weight'], ascending=[True, True])
mean1 =  df1.groupby('transgenic_line')['weight'].mean()
sd1 = df1.groupby('transgenic_line')['weight'].std()
sem1 = df1.groupby('transgenic_line')['weight'].sem()
    
data_dict2 = {}
data_dict2['mean'] = mean1
data_dict2['std'] = sd1
data_dict2['sem'] = sem1
df2 = pd.DataFrame(data_dict2)
df3 = df2.sort_values(['std'], ascending=[True])

In [19]:
df1


Out[19]:
experiment_id transgenic_line weight
14 298273313 Chrna2-Cre_OE25 0.155015
15 298325807 Chrna2-Cre_OE25 0.238137
6 267750528 Chrna2-Cre_OE25 0.403909
10 292173552 Chrna2-Cre_OE25 0.566995
4 167569313 Etv1-CreERT2 0.083535
1 156492394 Etv1-CreERT2 0.108246
5 181598954 Gpr26-Cre_KO250 0.459476
16 301267162 Gpr26-Cre_KO250 0.606287
2 166082128 Rbp4-Cre_KL100 0.327851
0 120814821 Rbp4-Cre_KL100 0.643804
3 166082842 Rbp4-Cre_KL100 0.672218
13 297946935 Sim1-Cre_KJ18 0.088383
7 287807030 Sim1-Cre_KJ18 0.103645
8 287807743 Sim1-Cre_KJ18 0.242343
11 297711339 Sim1-Cre_KJ18 0.258730
12 297714071 Sim1-Cre_KJ18 0.598619
9 288169842 Tlx3-Cre_PL56 0.000103

In [4]:
df3


Out[4]:
mean sem std
transgenic_line
Etv1-CreERT2 0.095891 0.012356 0.017474
Gpr26-Cre_KO250 0.532881 0.073405 0.103811
Chrna2-Cre_OE25 0.341014 0.091380 0.182759
Rbp4-Cre_KL100 0.547958 0.110359 0.191147
Sim1-Cre_KJ18 0.258344 0.091886 0.205464
Tlx3-Cre_PL56 0.000103 NaN NaN

In [6]:
df3.plot.bar(y = ['mean'],title = 'Variance in Cre Lines',stacked = True, yerr = ['sem'])


Out[6]:
<matplotlib.axes._subplots.AxesSubplot at 0x11502b610>

In [11]:
df1.boxplot(column='weight',by = 'transgenic_line',figsize = (20,10),rot = 90)
plt.title('Boxplot of variance within a Cre Line')
plt.xlabel('Cre Line')
plt.ylabel('Variance in Weight of projection')


Out[11]:
<matplotlib.text.Text at 0x117037d10>

In [12]:
df3.var()


Out[12]:
mean    0.050128
sem     0.001432
std     0.006263
dtype: float64

In [13]:
df3.cov()


Out[13]:
mean sem std
mean 0.050128 0.005227 0.007063
sem 0.005227 0.001432 0.002837
std 0.007063 0.002837 0.006263

In [14]:
df1.var()


Out[14]:
experiment_id    4.450137e+15
weight           5.140631e-02
dtype: float64

In [15]:
df1.corr()


Out[15]:
experiment_id weight
experiment_id 1.000000 -0.211427
weight -0.211427 1.000000

In [16]:
df3.corr()


Out[16]:
mean sem std
mean 1.000000 0.724214 0.467895
sem 0.724214 1.000000 0.947344
std 0.467895 0.947344 1.000000

In [17]:
df3.corr(df3.index)


---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-17-403d31dec572> in <module>()
----> 1 df3.corr(df3.index)

//anaconda/lib/python2.7/site-packages/pandas/core/frame.pyc in corr(self, method, min_periods)
   4553         mat = numeric_df.values
   4554 
-> 4555         if method == 'pearson':
   4556             correl = _algos.nancorr(com._ensure_float64(mat), minp=min_periods)
   4557         elif method == 'spearman':

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

In [18]:



Out[18]:
experiment_id   NaN
mean            NaN
sem             NaN
std             NaN
weight          NaN
dtype: float64

In [22]:



---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-22-66692df4abfc> in <module>()
----> 1 help(allensdk)

NameError: name 'allensdk' is not defined

In [24]:
help(OntologiesApi)


Help on class OntologiesApi in module allensdk.api.queries.ontologies_api:

class OntologiesApi(allensdk.api.queries.rma_template.RmaTemplate)
 |  See: `Atlas Drawings and Ontologies
 |  <http://help.brain-map.org/display/api/Atlas+Drawings+and+Ontologies>`_
 |  
 |  Method resolution order:
 |      OntologiesApi
 |      allensdk.api.queries.rma_template.RmaTemplate
 |      allensdk.api.queries.rma_api.RmaApi
 |      allensdk.api.api.Api
 |      __builtin__.object
 |  
 |  Methods defined here:
 |  
 |  __init__(self, base_uri=None)
 |  
 |  get_atlases(self)
 |  
 |  get_atlases_table(self, atlas_ids=None, brief=True)
 |      List Atlases available through the API
 |      with associated ontologies and structure graphs.
 |      
 |      Parameters
 |      ----------
 |      atlas_ids : integer or list of integers, optional
 |          only select specific atlases
 |      brief : boolean, optional
 |          True (default) requests only name and id fields.
 |      
 |      Returns
 |      -------
 |      dict : atlas metadata
 |      
 |      Notes
 |      -----
 |      This query is based on the
 |      `table of available Atlases <http://help.brain-map.org/display/api/Atlas+Drawings+and+Ontologies>`_.
 |      See also: `Class: Atlas <http://api.brain-map.org/doc/Atlas.html>`_
 |  
 |  get_structure_graphs(self)
 |  
 |  get_structure_sets(self)
 |  
 |  get_structures(self, structure_graph_ids=None, structure_graph_names=None, structure_set_ids=None, structure_set_names=None, order=['structures.graph_order'], num_rows='all', count=False)
 |      Retrieve data about anatomical structures.
 |      
 |      Parameters
 |      ----------
 |      structure_graph_ids : int or list of ints, optional
 |          database keys to get all structures in particular graphs
 |      structure_graph_names : string or list of strings, optional
 |          list of graph names to narrow the query
 |      structure_set_ids : int or list of ints, optional
 |          database keys to get all structures in a particular set
 |      structure_set_names : string or list of strings, optional
 |          list of set names to narrow the query.
 |      order : list of strings
 |          list of RMA order clauses for sorting
 |      num_rows : int
 |          how many records to retrieve
 |      
 |      Returns
 |      -------
 |      dict
 |          the parsed json response containing data from the API
 |      
 |      Notes
 |      -----
 |      Only one of the methods of limiting the query should be used at a time.
 |  
 |  unpack_structure_set_ancestors(self, structure_dataframe)
 |      Convert a slash-separated structure_id_path field to a list.
 |      
 |      Parameters
 |      ----------
 |      structure_dataframe : DataFrame
 |          structure data from the API
 |      
 |      Returns
 |      -------
 |      None
 |          A new column is added to the dataframe containing the ancestor list.
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |  
 |  rma_templates = {'ontology_queries': [{'count': False, 'criteria': '[g...
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from allensdk.api.queries.rma_template.RmaTemplate:
 |  
 |  template_query(self, template_name, entry_name, **kwargs)
 |  
 |  to_filter_rhs(self, rhs)
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from allensdk.api.queries.rma_api.RmaApi:
 |  
 |  build_query_url(self, stage_clauses, fmt='json')
 |      Combine one or more RMA query stages into a single RMA query.
 |      
 |      Parameters
 |      ----------
 |      stage_clauses : list of strings
 |          subqueries
 |      fmt : string, optional
 |          json (default), xml, or csv
 |      
 |      Returns
 |      -------
 |      string
 |          complete RMA url
 |  
 |  build_schema_query(self, clazz=None, fmt='json')
 |      Build the URL that will fetch the data schema.
 |      
 |      Parameters
 |      ----------
 |      clazz : string, optional
 |          Name of a specific class or None (default).
 |      fmt : string, optional
 |          json (default) or xml
 |      
 |      Returns
 |      -------
 |      url : string
 |          The constructed URL
 |      
 |      Notes
 |      -----
 |      If a class is specified, only the schema information for that class
 |      will be requested, otherwise the url requests the entire schema.
 |  
 |  debug_clause(self, debug_value=None)
 |      Construct a debug clause for use in an rma::options clause.
 |      Parameters
 |      ----------
 |      debug_value : string or boolean
 |          True, False, None (default) or 'preview'
 |      
 |      Returns
 |      -------
 |      clause : string
 |          The query clause for inclusion in an RMA query URL.
 |      
 |      Notes
 |      -----
 |      True will request debugging information in the response.
 |      False will request no debugging information.
 |      None will return an empty clause.
 |      'preview' will request debugging information without the query being run.
 |  
 |  filter(self, key, value)
 |      serialize a single RMA query filter clause.
 |      
 |      Parameters
 |      ----------
 |      key : string
 |          keys for narrowing a query.
 |      value : string
 |          value for narrowing a query.
 |      
 |      Returns
 |      -------
 |      string
 |          a single filter clause for an RMA query string.
 |  
 |  filters(self, filters)
 |      serialize RMA query filter clauses.
 |      
 |      Parameters
 |      ----------
 |      filters : dict
 |          keys and values for narrowing a query.
 |      
 |      Returns
 |      -------
 |      string
 |          filter clause for an RMA query string.
 |  
 |  get_schema(self, clazz=None)
 |      Retrieve schema information.
 |  
 |  model_query(self, *args, **kwargs)
 |      Construct and execute a model stage of an RMA query string.
 |      
 |      Parameters
 |      ----------
 |      model : string
 |          The top level data type
 |      filters : dict
 |          key, value comparisons applied to the top-level model to narrow the results.
 |      criteria : string
 |          raw RMA criteria clause to choose what object are returned
 |      include : string
 |          raw RMA include clause to return associated objects
 |      only : list of strings, optional
 |          to be joined into an rma::options only filter to limit what data is returned
 |      except : list of strings, optional
 |          to be joined into an rma::options except filter to limit what data is returned
 |      tabular : list of string, optional
 |          return columns as a tabular data structure rather than a nested tree.
 |      count : boolean, optional
 |          False to skip the extra database count query.
 |      debug : string, optional
 |          'true', 'false' or 'preview'
 |      num_rows : int or string, optional
 |          how many database rows are returned (may not correspond directly to JSON tree structure)
 |      start_row : int or string, optional
 |          which database row is start of returned data  (may not correspond directly to JSON tree structure)
 |      
 |      
 |      Notes
 |      -----
 |      See `RMA Path Syntax <http://help.brain-map.org/display/api/RMA+Path+Syntax#RMAPathSyntax-DoubleColonforAxis>`_
 |      for a brief overview of the normalized RMA syntax.
 |      Normalized RMA syntax differs from the legacy syntax
 |      used in much of the RMA documentation.
 |      Using the &debug=true option with an RMA URL will include debugging information in the
 |      response, including the normalized query.
 |  
 |  model_stage(self, model, **kwargs)
 |      Construct a model stage of an RMA query string.
 |      
 |      Parameters
 |      ----------
 |      model : string
 |          The top level data type
 |      filters : dict
 |          key, value comparisons applied to the top-level model to narrow the results.
 |      criteria : string
 |          raw RMA criteria clause to choose what object are returned
 |      include : string
 |          raw RMA include clause to return associated objects
 |      only : list of strings, optional
 |          to be joined into an rma::options only filter to limit what data is returned
 |      except : list of strings, optional
 |          to be joined into an rma::options except filter to limit what data is returned
 |      tabular : list of string, optional
 |          return columns as a tabular data structure rather than a nested tree.
 |      count : boolean, optional
 |          False to skip the extra database count query.
 |      debug : string, optional
 |          'true', 'false' or 'preview'
 |      num_rows : int or string, optional
 |          how many database rows are returned (may not correspond directly to JSON tree structure)
 |      start_row : int or string, optional
 |          which database row is start of returned data  (may not correspond directly to JSON tree structure)
 |      
 |      
 |      Notes
 |      -----
 |      See `RMA Path Syntax <http://help.brain-map.org/display/api/RMA+Path+Syntax#RMAPathSyntax-DoubleColonforAxis>`_
 |      for a brief overview of the normalized RMA syntax.
 |      Normalized RMA syntax differs from the legacy syntax
 |      used in much of the RMA documentation.
 |      Using the &debug=true option with an RMA URL will include debugging information in the
 |      response, including the normalized query.
 |  
 |  only_except_tabular_clause(self, filter_type, attribute_list)
 |      Construct a clause to filter which attributes are returned
 |      for use in an rma::options clause.
 |      
 |      Parameters
 |      ----------
 |      filter_type : string
 |          'only', 'except', or 'tabular'
 |      attribute_list : list of strings
 |          for example ['acronym', 'products.name', 'structure.id']
 |      
 |      Returns
 |      -------
 |      clause : string
 |          The query clause for inclusion in an RMA query URL.
 |      
 |      Notes
 |      -----
 |      The title of tabular columns can be set by adding '+as+<title>'
 |      to the attribute.
 |      The tabular filter type requests a response that is row-oriented
 |      rather than a nested structure.
 |      Because of this, the tabular option can mask the lazy query behavior
 |      of an rma::include clause.
 |      The tabular option does not mask the inner-join behavior of an rma::include
 |      clause.
 |      The tabular filter is required for .csv format RMA requests.
 |  
 |  options_clause(self, **kwargs)
 |      build rma:: options clause.
 |      
 |      Parameters
 |      ----------
 |      only : list of strings, optional
 |      except : list of strings, optional
 |      tabular : list of string, optional
 |      count : boolean, optional
 |      debug : string, optional
 |          'true', 'false' or 'preview'
 |      num_rows : int or string, optional
 |      start_row : int or string, optional
 |  
 |  order_clause(self, order_list=None)
 |      Construct a debug clause for use in an rma::options clause.
 |      
 |      Parameters
 |      ----------
 |      order_list : list of strings
 |          for example ['acronym', 'products.name+asc', 'structure.id+desc']
 |      
 |      Returns
 |      -------
 |      clause : string
 |          The query clause for inclusion in an RMA query URL.
 |      
 |      Notes
 |      -----
 |      Optionally adding '+asc' (default) or '+desc' after an attribute
 |      will change the sort order.
 |  
 |  pipe_stage(self, pipe_name, parameters)
 |      Connect model and service stages via their JSON responses.
 |      
 |      Notes
 |      -----
 |      See: `Service Pipelines <http://help.brain-map.org/display/api/Service+Pipelines>`_
 |      and
 |      `Connected Services and Pipes <http://help.brain-map.org/display/api/Connected+Services+and+Pipes>`_
 |  
 |  quote_string(self, the_string)
 |      Wrap a clause in single quotes.
 |      
 |      Parameters
 |      ----------
 |      the_string : string
 |          a clause to be included in an rma query that needs to be quoted
 |      
 |      Returns
 |      -------
 |      string
 |          input wrapped in single quotes
 |  
 |  service_query(self, *args, **kwargs)
 |      Construct and Execute a single-stage RMA query
 |      to send a request to a connected service.
 |      
 |      Parameters
 |      ----------
 |      service_name : string
 |          Name of a documented connected service.
 |      parameters : dict
 |          key-value pairs as in the online documentation.
 |      
 |      Notes
 |      -----
 |      See: `Service Pipelines <http://help.brain-map.org/display/api/Service+Pipelines>`_
 |      and
 |      `Connected Services and Pipes <http://help.brain-map.org/display/api/Connected+Services+and+Pipes>`_
 |  
 |  service_stage(self, service_name, parameters=None)
 |      Construct an RMA query fragment to send a request to a connected service.
 |      
 |      Parameters
 |      ----------
 |      service_name : string
 |          Name of a documented connected service.
 |      parameters : dict
 |          key-value pairs as in the online documentation.
 |      
 |      Notes
 |      -----
 |      See: `Service Pipelines <http://help.brain-map.org/display/api/Service+Pipelines>`_
 |      and
 |      `Connected Services and Pipes <http://help.brain-map.org/display/api/Connected+Services+and+Pipes>`_
 |  
 |  tuple_filters(self, filters)
 |      Construct an RMA filter clause.
 |      
 |      Notes
 |      -----
 |      
 |      See `RMA Path Syntax - Square Brackets for Filters <http://help.brain-map.org/display/api/RMA+Path+Syntax#RMAPathSyntax-SquareBracketsforFilters>`_ for additional documentation.
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes inherited from allensdk.api.queries.rma_api.RmaApi:
 |  
 |  ALL = 'all'
 |  
 |  COUNT = 'count'
 |  
 |  CRITERIA = 'rma::criteria'
 |  
 |  DEBUG = 'debug'
 |  
 |  EQ = '$eq'
 |  
 |  EXCEPT = 'except'
 |  
 |  FALSE = 'false'
 |  
 |  INCLUDE = 'rma::include'
 |  
 |  IS = '$is'
 |  
 |  MODEL = 'model::'
 |  
 |  NUM_ROWS = 'num_rows'
 |  
 |  ONLY = 'only'
 |  
 |  OPTIONS = 'rma::options'
 |  
 |  ORDER = 'order'
 |  
 |  PIPE = 'pipe::'
 |  
 |  PREVIEW = 'preview'
 |  
 |  SERVICE = 'service::'
 |  
 |  START_ROW = 'start_row'
 |  
 |  TABULAR = 'tabular'
 |  
 |  TRUE = 'true'
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from allensdk.api.api.Api:
 |  
 |  construct_well_known_file_download_url(self, well_known_file_id)
 |      Join data api endpoint and id.
 |      
 |      Parameters
 |      ----------
 |      well_known_file_id : integer or string representing an integer
 |          well known file id
 |      
 |      Returns
 |      -------
 |      string
 |          the well-known-file download url for the current api api server
 |      
 |      See Also
 |      --------
 |      retrieve_file_over_http: Can be used to retrieve the file from the url.
 |  
 |  do_query(self, url_builder_fn, json_traversal_fn, *args, **kwargs)
 |      Bundle an query url construction function
 |      with a corresponding response json traversal function.
 |      
 |      Parameters
 |      ----------
 |      url_builder_fn : function
 |          A function that takes parameters and returns an rma url.
 |      json_traversal_fn : function
 |          A function that takes a json-parsed python data structure and returns data from it.
 |      post : boolean, optional kwarg
 |          True does an HTTP POST, False (default) does a GET
 |      args : arguments
 |          Arguments to be passed to the url builder function.
 |      kwargs : keyword arguments
 |          Keyword arguments to be passed to the rma builder function.
 |      
 |      Returnsurllib_re
 |      -------
 |      any type
 |          The data extracted from the json response.
 |      
 |      Examples
 |      --------
 |      `A simple Api subclass example
 |      <data_api_client.html#creating-new-api-query-classes>`_.
 |  
 |  do_rma_query(self, rma_builder_fn, json_traversal_fn, *args, **kwargs)
 |      Bundle an RMA query url construction function
 |      with a corresponding response json traversal function.
 |      
 |      ..note:: Deprecated in AllenSDK 0.9.2
 |          `do_rma_query` will be removed in AllenSDK 1.0, it is replaced by
 |          `do_query` because the latter is more general.
 |      
 |      Parameters
 |      ----------
 |      rma_builder_fn : function
 |          A function that takes parameters and returns an rma url.
 |      json_traversal_fn : function
 |          A function that takes a json-parsed python data structure and returns data from it.
 |      args : arguments
 |          Arguments to be passed to the rma builder function.
 |      kwargs : keyword arguments
 |          Keyword arguments to be passed to the rma builder function.
 |      
 |      Returns
 |      -------
 |      any type
 |          The data extracted from the json response.
 |      
 |      Examples
 |      --------
 |      `A simple Api subclass example
 |      <data_api_client.html#creating-new-api-query-classes>`_.
 |  
 |  json_msg_query(self, url, dataframe=False)
 |      Common case where the url is fully constructed
 |          and the response data is stored in the 'msg' field.
 |      
 |      Parameters
 |      ----------
 |      url : string
 |          Where to get the data in json form
 |      dataframe : boolean
 |          True converts to a pandas dataframe, False (default) doesn't
 |      
 |      Returns
 |      -------
 |      dict or DataFrame
 |          returned data; type depends on dataframe option
 |  
 |  load_api_schema(self)
 |      Download the RMA schema from the current RMA endpoint
 |      
 |      Returns
 |      -------
 |      dict
 |          the parsed json schema message
 |      
 |      Notes
 |      -----
 |      This information and other
 |      `Allen Brain Atlas Data Portal Data Model <http://help.brain-map.org/display/api/Data+Model>`_
 |      documentation is also available as a
 |      `Class Hierarchy <http://api.brain-map.org/class_hierarchy>`_
 |      and `Class List <http://api.brain-map.org/class_hierarchy>`_.
 |  
 |  read_data(self, parsed_json)
 |      Return the message data from the parsed query.
 |      
 |      Parameters
 |      ----------
 |      parsed_json : dict
 |          A python structure corresponding to the JSON data returned from the API.
 |      
 |      Notes
 |      -----
 |      See `API Response Formats - Response Envelope <http://help.brain-map.org/display/api/API+Response+Formats#APIResponseFormats-ResponseEnvelope>`_
 |      for additional documentation.
 |  
 |  retrieve_file_over_http(self, url, file_path)
 |      Get a file from the data api and save it.
 |      
 |      Parameters
 |      ----------
 |      url : string
 |          Url[1]_ from which to get the file.
 |      file_path : string
 |          Absolute path including the file name to save.
 |      
 |      See Also
 |      --------
 |      construct_well_known_file_download_url: Can be used to construct the url.
 |      
 |      References
 |      ----------
 |      .. [1] Allen Brain Atlas Data Portal: `Downloading a WellKnownFile <http://help.brain-map.org/display/api/Downloading+a+WellKnownFile>`_.
 |  
 |  retrieve_parsed_json_over_http(self, url, post=False)
 |      Get the document and put it in a Python data structure
 |      
 |      Parameters
 |      ----------
 |      url : string
 |          Full API query url.
 |      post : boolean
 |          True does an HTTP POST, False (default) encodes the URL and does a GET
 |      
 |      Returns
 |      -------
 |      dict
 |          Result document as parsed by the JSON library.
 |  
 |  retrieve_xml_over_http(self, url)
 |      Get the document and put it in a Python data structure
 |      
 |      Parameters
 |      ----------
 |      url : string
 |          Full API query url.
 |      
 |      Returns
 |      -------
 |      string
 |          Unparsed xml string.
 |  
 |  set_api_urls(self, api_base_url_string)
 |      Set the internal RMA and well known file download endpoint urls
 |      based on a api server endpoint.
 |      
 |      Parameters
 |      ----------
 |      api_base_url_string : string
 |          url of the api to point to
 |  
 |  set_default_working_directory(self, working_directory)
 |      Set the working directory where files will be saved.
 |      
 |      Parameters
 |      ----------
 |      working_directory : string
 |           the absolute path string of the working directory.
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from allensdk.api.api.Api:
 |  
 |  __dict__
 |      dictionary for instance variables (if defined)
 |  
 |  __weakref__
 |      list of weak references to the object (if defined)
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes inherited from allensdk.api.api.Api:
 |  
 |  default_api_url = 'http://api.brain-map.org'
 |  
 |  download_url = 'http://download.alleninstitute.org'


In [25]:
conn_strength('TH','MOp')


---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-25-957eeadfd9b8> in <module>()
----> 1 conn_strength('TH','MOp')

NameError: name 'conn_strength' is not defined

In [ ]:
from