In [1]:
import GenomicIntervals
import importlib
import pandas
import os, sys

In [2]:
import time

class Timer:    
    def __enter__(self):
        self.start = time.clock()
        return self

    def __exit__(self, *args):
        self.end = time.clock()
        self.interval = self.end - self.start
        print(self.interval)

In [3]:
import ipyparallel
from ipyparallel import depend, require

# create client & view
rc = ipyparallel.Client()
dview = rc[:]
bview = rc.load_balanced_view() # you can set block=True to have this apply globally

# scatter 'id', so id=0,1,2 on engines 0,1,2
dview.scatter('node_id', rc.ids, flatten=True)
print("Engine IDs: ", dview['node_id'])
# create a Reference to `id`. This will be a different value on each engine
ref = ipyparallel.Reference('node_id')


Engine IDs:  [0, 1, 2, 3]

In [16]:
#importlib.reload(GenomicIntervals) ;

#annot = pd.DataFrame({'chrom': 'chr1', 'start': [0], 'end': [100]})
#query = pd.DataFrame({'chrom': 'chr1', 'start': [50], 'end': [150]})

annot = pandas.DataFrame({'chrom': 'chr1', 'start': range(0, 100, 4), 'end': range(2, 102, 4)})
query = pandas.DataFrame({'chrom': 'chr1', 'start': [1], 'end': [3]})

#print(GenomicIntervals.interval_jaccard(query, annot, samples=1000, 
#                                            chromosome_sizes={'chr1': 11}))

annot = pandas.DataFrame({'chrom': 'chr1', 
                          'start': range(0, 10000, 4), 
                          'end': range(2, 10002, 4)})
query = pandas.DataFrame({'chrom': 'chr1', 
                          'start': range(1, 10001, 4), 
                          'end': range(3, 10003, 4)})

#print(annot)
#print(query)

#interval_jaccard = GenomicIntervals.interval_jaccard


def scatter_func(f):
    dview.scatter(f.__name__, [f]*len(bview), flatten=True)    



with Timer():
    print(interval_jaccard(query, annot, samples=100,# dview=dview,
                                            chromosome_sizes={'chr1': 10010}))


10.672588999999988
---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-16-0256f1e626ff> in <module>()
     30 with Timer():
     31     print(interval_jaccard(query, annot, samples=100,# dview=dview,
---> 32                                             chromosome_sizes={'chr1': 10010}))

<ipython-input-6-4600f01d91d4> in interval_jaccard(query, annot, samples, chromosome_sizes, dview)
    280         null_distr = list(dview.map_sync(jaccard_stat_perm, [query] * samples, [annot] * samples))
    281     else:
--> 282         null_distr = list(map(jaccard_stat_perm, [query] * samples, [annot] * samples))
    283 
    284     # get p value

<ipython-input-6-4600f01d91d4> in jaccard_stat(a, b, chromosome_sizes, permute)
    247         a = interval_permute(a, chromosome_sizes=chromosome_sizes)
    248 
--> 249     inter = interval_intersect(a, b)
    250     union = interval_union(a, b)
    251 

<ipython-input-6-4600f01d91d4> in wrapper(*args)
     60             for i, df in enumerate(data_frames):
     61                 func_args.append(df.loc[idx[i][chrom]])
---> 62             results.append(func(*func_args))
     63 
     64         return pd.concat(results).reset_index()

<ipython-input-6-4600f01d91d4> in wrapper(*args)
     79         assert len(chrom_set) == 1
     80         chrom = chrom_set.pop()
---> 81         res_df = pd.DataFrame.from_records(func(*tps_list), columns = ['start', 'end'])
     82         res_df['chrom'] = chrom
     83         return res_df

<ipython-input-6-4600f01d91d4> in interval_intersect(a, b)
    147 @with_chrom
    148 def interval_intersect(a, b):
--> 149     return merge(a, b, lambda in_a, in_b: in_a and in_b)
    150 
    151 

<ipython-input-6-4600f01d91d4> in merge(a_tps, b_tps, op)
    119         in_a = not ((scan < a_endpoints[a_index]) ^ (a_index % 2))
    120         in_b = not ((scan < b_endpoints[b_index]) ^ (b_index % 2))
--> 121         in_res = op(in_a, in_b)
    122 
    123         if in_res ^ (len(res) % 2):

<ipython-input-6-4600f01d91d4> in <lambda>(in_a, in_b)
    147 @with_chrom
    148 def interval_intersect(a, b):
--> 149     return merge(a, b, lambda in_a, in_b: in_a and in_b)
    150 
    151 

KeyboardInterrupt: 

In [4]:
import cProfile
cProfile.run("GenomicIntervals.interval_jaccard(query, annot, samples=1000, chromosome_sizes={'chr1': 4})")


         85593 function calls (85421 primitive calls) in 0.353 seconds

   Ordered by: standard name

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
      180    0.000    0.000    0.000    0.000 <frozen importlib._bootstrap>:2264(_handle_fromlist)
        1    0.000    0.000    0.353    0.353 <string>:1(<module>)
        2    0.181    0.090    0.308    0.154 GenomicIntervals.py:103(merge)
        1    0.000    0.000    0.146    0.146 GenomicIntervals.py:140(interval_union)
    10000    0.002    0.000    0.002    0.000 GenomicIntervals.py:143(<lambda>)
        1    0.000    0.000    0.162    0.162 GenomicIntervals.py:146(interval_intersect)
    10000    0.002    0.000    0.002    0.000 GenomicIntervals.py:149(<lambda>)
        1    0.000    0.000    0.353    0.353 GenomicIntervals.py:209(interval_jaccard)
        2    0.000    0.000    0.353    0.176 GenomicIntervals.py:213(jaccard_stat)
        1    0.000    0.000    0.004    0.004 GenomicIntervals.py:219(interval_permute)
        2    0.001    0.000    0.347    0.173 GenomicIntervals.py:36(wrapper)
        2    0.000    0.000    0.005    0.003 GenomicIntervals.py:40(<listcomp>)
        8    0.000    0.000    0.000    0.000 GenomicIntervals.py:51(<genexpr>)
        2    0.001    0.000    0.324    0.162 GenomicIntervals.py:71(wrapper)
        4    0.000    0.000    0.113    0.028 GenomicIntervals.py:91(flatten)
    10000    0.069    0.000    0.069    0.000 GenomicIntervals.py:93(<lambda>)
        2    0.000    0.000    0.002    0.001 GenomicIntervals.py:96(unflatten)
        2    0.002    0.001    0.002    0.001 GenomicIntervals.py:99(<listcomp>)
       73    0.000    0.000    0.000    0.000 __init__.py:175(iteritems)
       21    0.000    0.000    0.000    0.000 __init__.py:87(__iter__)
        5    0.000    0.000    0.000    0.000 _methods.py:25(_amax)
        4    0.000    0.000    0.000    0.000 _methods.py:28(_amin)
        1    0.000    0.000    0.000    0.000 _methods.py:31(_sum)
        2    0.000    0.000    0.000    0.000 _methods.py:34(_prod)
       33    0.000    0.000    0.000    0.000 _methods.py:37(_any)
       11    0.000    0.000    0.000    0.000 _methods.py:40(_all)
        3    0.000    0.000    0.001    0.000 algorithms.py:1010(take_nd)
        5    0.000    0.000    0.001    0.000 algorithms.py:166(safe_sort)
        5    0.000    0.000    0.002    0.000 algorithms.py:264(factorize)
        5    0.000    0.000    0.000    0.000 algorithms.py:786(_get_data_algo)
        3    0.000    0.000    0.000    0.000 algorithms.py:977(_get_take_nd_function)
        2    0.000    0.000    0.000    0.000 api.py:25(_get_combined_index)
        2    0.000    0.000    0.000    0.000 api.py:41(_get_distinct_indexes)
        4    0.000    0.000    0.000    0.000 api.py:42(<genexpr>)
       14    0.000    0.000    0.000    0.000 base.py:1097(is_unique)
        4    0.000    0.000    0.000    0.000 base.py:1112(is_floating)
        2    0.000    0.000    0.000    0.000 base.py:1121(is_categorical)
        1    0.000    0.000    0.000    0.000 base.py:1175(_convert_slice_indexer)
        4    0.000    0.000    0.000    0.000 base.py:1250(_convert_list_indexer)
       28    0.000    0.000    0.000    0.000 base.py:1302(_engine)
       28    0.000    0.000    0.000    0.000 base.py:1305(<lambda>)
        5    0.000    0.000    0.000    0.000 base.py:1345(__iter__)
       54    0.000    0.000    0.001    0.000 base.py:1392(__contains__)
       30    0.000    0.000    0.000    0.000 base.py:1406(__getitem__)
    39/31    0.001    0.000    0.003    0.000 base.py:142(__new__)
        2    0.000    0.000    0.000    0.000 base.py:1440(append)
        2    0.000    0.000    0.000    0.000 base.py:1464(<listcomp>)
        2    0.000    0.000    0.000    0.000 base.py:1478(_append_same_dtype)
        5    0.000    0.000    0.000    0.000 base.py:1506(take)
        4    0.000    0.000    0.000    0.000 base.py:1542(_isnan)
        4    0.000    0.000    0.000    0.000 base.py:1561(hasnans)
        9    0.000    0.000    0.001    0.000 base.py:1643(equals)
       52    0.000    0.000    0.000    0.000 base.py:2104(get_loc)
        4    0.000    0.000    0.001    0.000 base.py:2217(get_indexer)
        4    0.000    0.000    0.001    0.000 base.py:2383(get_indexer_for)
        4    0.000    0.000    0.000    0.000 base.py:2390(_possibly_promote)
        4    0.000    0.000    0.001    0.000 base.py:2400(groupby)
        4    0.000    0.000    0.000    0.000 base.py:2424(<dictcomp>)
        4    0.000    0.000    0.001    0.000 base.py:2496(reindex)
        2    0.000    0.000    0.000    0.000 base.py:3007(_maybe_cast_indexer)
        3    0.000    0.000    0.000    0.000 base.py:3022(_validate_indexer)
        8    0.000    0.000    0.002    0.000 base.py:3223(insert)
       53    0.000    0.000    0.001    0.000 base.py:334(_simple_new)
       97    0.000    0.000    0.001    0.000 base.py:3637(_ensure_index)
        4    0.000    0.000    0.000    0.000 base.py:3681(_ensure_has_len)
       18    0.000    0.000    0.000    0.000 base.py:371(_shallow_copy)
       10    0.000    0.000    0.001    0.000 base.py:379(_shallow_copy_with_infer)
        9    0.000    0.000    0.000    0.000 base.py:465(is_)
       69    0.000    0.000    0.000    0.000 base.py:485(_reset_identity)
  147/143    0.000    0.000    0.000    0.000 base.py:491(__len__)
        8    0.000    0.000    0.000    0.000 base.py:497(__array__)
       15    0.000    0.000    0.000    0.000 base.py:512(dtype)
       94    0.000    0.000    0.000    0.000 base.py:522(values)
       14    0.000    0.000    0.000    0.000 base.py:527(get_values)
        6    0.000    0.000    0.000    0.000 base.py:590(_coerce_to_ndarray)
       38    0.000    0.000    0.000    0.000 base.py:606(_get_attributes_dict)
       38    0.000    0.000    0.000    0.000 base.py:608(<listcomp>)
       24    0.000    0.000    0.001    0.000 base.py:610(view)
        8    0.000    0.000    0.001    0.000 base.py:622(_coerce_scalar_to_index)
        8    0.000    0.000    0.000    0.000 base.py:819(ndim)
        4    0.000    0.000    0.000    0.000 base.py:857(size)
       46    0.000    0.000    0.000    0.000 base.py:874(_values)
        4    0.000    0.000    0.001    0.000 base.py:965(unique)
        1    0.000    0.000    0.000    0.000 cast.py:142(_maybe_upcast_putmask)
        2    0.000    0.000    0.000    0.000 cast.py:227(_maybe_promote)
        2    0.000    0.000    0.000    0.000 cast.py:312(_infer_dtype_from_scalar)
        4    0.000    0.000    0.000    0.000 cast.py:439(_coerce_indexer_dtype)
        6    0.000    0.000    0.000    0.000 cast.py:660(_possibly_castable)
       10    0.000    0.000    0.000    0.000 cast.py:672(_possibly_infer_to_datetimelike)
       12    0.000    0.000    0.000    0.000 cast.py:765(_possibly_cast_to_datetime)
        4    0.000    0.000    0.000    0.000 categorical.py:1703(_reverse_indexer)
        4    0.000    0.000    0.000    0.000 categorical.py:1737(<listcomp>)
        4    0.000    0.000    0.000    0.000 categorical.py:233(__init__)
        4    0.000    0.000    0.001    0.000 categorical.py:432(from_codes)
        4    0.000    0.000    0.000    0.000 categorical.py:479(_get_codes)
        4    0.000    0.000    0.000    0.000 categorical.py:513(_validate_ordered)
        8    0.000    0.000    0.001    0.000 categorical.py:532(_validate_categories)
        4    0.000    0.000    0.000    0.000 categorical.py:596(_get_categories)
      129    0.000    0.000    0.001    0.000 common.py:102(is_categorical_dtype)
       19    0.000    0.000    0.000    0.000 common.py:106(is_string_dtype)
       14    0.000    0.000    0.000    0.000 common.py:129(is_datetimelike)
       12    0.000    0.000    0.000    0.000 common.py:135(is_dtype_equal)
        2    0.000    0.000    0.000    0.000 common.py:145(_maybe_match_name)
       14    0.000    0.000    0.000    0.000 common.py:153(is_integer_dtype)
        2    0.000    0.000    0.000    0.000 common.py:164(is_int_or_datetime_dtype)
       39    0.000    0.000    0.000    0.000 common.py:170(is_datetime64_any_dtype)
       27    0.000    0.000    0.000    0.000 common.py:188(is_datetime_or_timedelta_dtype)
       13    0.000    0.000    0.000    0.000 common.py:194(is_bool_indexer)
        8    0.000    0.000    0.000    0.000 common.py:217(_default_index)
        5    0.000    0.000    0.000    0.000 common.py:231(is_datetimelike_v_numeric)
       26    0.000    0.000    0.001    0.000 common.py:264(needs_i8_conversion)
        6    0.000    0.000    0.000    0.000 common.py:276(is_string_like_dtype)
       18    0.000    0.000    0.000    0.000 common.py:282(is_float_dtype)
       27    0.000    0.000    0.000    0.000 common.py:292(is_bool_dtype)
       16    0.000    0.000    0.000    0.000 common.py:301(is_extension_type)
        5    0.000    0.000    0.000    0.000 common.py:315(is_complex_dtype)
       49    0.000    0.000    0.000    0.000 common.py:333(_get_dtype)
      222    0.000    0.000    0.001    0.000 common.py:357(_get_dtype_type)
       33    0.000    0.000    0.001    0.000 common.py:365(_asarray_tuplesafe)
       33    0.000    0.000    0.000    0.000 common.py:447(_apply_if_callable)
        4    0.000    0.000    0.000    0.000 common.py:47(_ensure_categorical)
       21    0.000    0.000    0.000    0.000 common.py:54(is_object_dtype)
       22    0.000    0.000    0.000    0.000 common.py:59(is_sparse)
       27    0.000    0.000    0.000    0.000 common.py:64(is_categorical)
       51    0.000    0.000    0.001    0.000 common.py:69(is_datetimetz)
       55    0.000    0.000    0.000    0.000 common.py:81(is_datetime64_dtype)
      124    0.000    0.000    0.001    0.000 common.py:89(is_datetime64tz_dtype)
       53    0.000    0.000    0.000    0.000 common.py:93(is_timedelta64_dtype)
       36    0.000    0.000    0.000    0.000 common.py:98(is_period_dtype)
        2    0.000    0.000    0.000    0.000 concat.py:24(get_dtype_kinds)
        2    0.000    0.000    0.000    0.000 concat.py:392(_concat_index_asobject)
        2    0.000    0.000    0.000    0.000 concat.py:399(<listcomp>)
        2    0.000    0.000    0.000    0.000 concat.py:407(<listcomp>)
        2    0.000    0.000    0.000    0.000 concat.py:86(_get_frame_result_type)
        6    0.000    0.000    0.000    0.000 concat.py:92(<genexpr>)
       32    0.000    0.000    0.000    0.000 dtypes.py:132(construct_from_string)
        3    0.000    0.000    0.000    0.000 dtypes.py:170(__new__)
        3    0.000    0.000    0.000    0.000 dtypes.py:221(construct_from_string)
       36    0.000    0.000    0.000    0.000 dtypes.py:347(is_dtype)
      289    0.001    0.000    0.001    0.000 dtypes.py:74(is_dtype)
        2    0.000    0.000    0.000    0.000 expressions.py:162(_has_bool_dtype)
        2    0.000    0.000    0.000    0.000 expressions.py:172(_bool_arith_check)
        2    0.000    0.000    0.000    0.000 expressions.py:191(evaluate)
        2    0.000    0.000    0.000    0.000 expressions.py:58(_evaluate_standard)
        2    0.000    0.000    0.000    0.000 expressions.py:66(_can_use_numexpr)
        2    0.000    0.000    0.000    0.000 expressions.py:91(_evaluate_numexpr)
       26    0.000    0.000    0.005    0.000 frame.py:2035(__getitem__)
       26    0.000    0.000    0.004    0.000 frame.py:2061(_getitem_column)
       25    0.000    0.000    0.002    0.000 frame.py:2393(_box_item_values)
       25    0.000    0.000    0.001    0.000 frame.py:2400(_box_col_values)
        2    0.000    0.000    0.001    0.001 frame.py:2405(__setitem__)
       12    0.000    0.000    0.000    0.000 frame.py:241(_constructor)
        8    0.000    0.000    0.000    0.000 frame.py:2456(_ensure_valid_index)
        2    0.000    0.000    0.001    0.001 frame.py:2473(_set_item)
        6    0.000    0.000    0.004    0.001 frame.py:2494(insert)
       16    0.000    0.000    0.000    0.000 frame.py:252(__init__)
        8    0.000    0.000    0.001    0.000 frame.py:2593(_sanitize_column)
        4    0.000    0.000    0.003    0.001 frame.py:2823(reindex_axis)
        6    0.000    0.000    0.007    0.001 frame.py:2940(reset_index)
        6    0.000    0.000    0.000    0.000 frame.py:2976(_maybe_casted_values)
        2    0.000    0.000    0.000    0.000 frame.py:484(shape)
        2    0.000    0.000    0.001    0.001 frame.py:5391(_arrays_to_mgr)
        2    0.000    0.000    0.000    0.000 frame.py:5411(extract_index)
        2    0.000    0.000    0.003    0.002 frame.py:5497(_to_arrays)
        2    0.000    0.000    0.003    0.002 frame.py:5591(_list_to_arrays)
        2    0.000    0.000    0.003    0.002 frame.py:5650(_convert_object_array)
        4    0.000    0.000    0.003    0.001 frame.py:5660(convert)
        2    0.000    0.000    0.003    0.002 frame.py:5666(<listcomp>)
        2    0.000    0.000    0.000    0.000 frame.py:5689(_homogenize)
        8    0.000    0.000    0.000    0.000 frame.py:769(__len__)
        2    0.000    0.000    0.005    0.003 frame.py:943(from_records)
        4    0.000    0.000    0.000    0.000 fromnumeric.py:1383(ravel)
        4    0.000    0.000    0.000    0.000 fromnumeric.py:1987(all)
        2    0.000    0.000    0.000    0.000 fromnumeric.py:2433(prod)
        2    0.000    0.000    0.000    0.000 fromnumeric.py:353(repeat)
        2    0.000    0.000    0.000    0.000 fromnumeric.py:42(_wrapit)
        4    0.000    0.000    0.000    0.000 fromnumeric.py:828(argsort)
        7    0.000    0.000    0.000    0.000 function.py:37(__call__)
       12    0.000    0.000    0.000    0.000 function_base.py:4323(insert)
        4    0.000    0.000    0.000    0.000 function_base.py:4534(append)
       43    0.000    0.000    0.000    0.000 generic.py:114(__init__)
        5    0.000    0.000    0.000    0.000 generic.py:1348(_indexer)
       26    0.000    0.000    0.004    0.000 generic.py:1381(_get_item_cache)
       25    0.000    0.000    0.000    0.000 generic.py:1395(_set_as_cached)
       16    0.000    0.000    0.000    0.000 generic.py:144(_init_mgr)
       12    0.000    0.000    0.000    0.000 generic.py:1477(_clear_item_cache)
        1    0.000    0.000    0.000    0.000 generic.py:1483(_slice)
        2    0.000    0.000    0.001    0.000 generic.py:1499(_set_item)
        1    0.000    0.000    0.000    0.000 generic.py:1503(_set_is_copy)
        2    0.000    0.000    0.000    0.000 generic.py:1533(_check_setitem_copy)
        1    0.000    0.000    0.002    0.002 generic.py:1650(take)
        4    0.000    0.000    0.003    0.001 generic.py:2337(reindex_axis)
        4    0.000    0.000    0.002    0.000 generic.py:2350(_reindex_with_indexers)
       14    0.000    0.000    0.000    0.000 generic.py:2713(__finalize__)
    32/27    0.000    0.000    0.001    0.000 generic.py:2730(__getattr__)
      101    0.000    0.000    0.001    0.000 generic.py:2746(__setattr__)
       12    0.000    0.000    0.002    0.000 generic.py:2785(_protect_consolidate)
       12    0.000    0.000    0.002    0.000 generic.py:2795(_consolidate_inplace)
       12    0.000    0.000    0.002    0.000 generic.py:2798(f)
        2    0.000    0.000    0.000    0.000 generic.py:2803(consolidate)
        6    0.000    0.000    0.002    0.000 generic.py:3057(copy)
        2    0.000    0.000    0.000    0.000 generic.py:315(_from_axes)
       19    0.000    0.000    0.000    0.000 generic.py:327(_get_axis_number)
       32    0.000    0.000    0.000    0.000 generic.py:340(_get_axis_name)
       28    0.000    0.000    0.000    0.000 generic.py:353(_get_axis)
        6    0.000    0.000    0.000    0.000 generic.py:357(_get_block_manager_axis)
        5    0.000    0.000    0.004    0.001 generic.py:3937(groupby)
       11    0.000    0.000    0.000    0.000 generic.py:401(_info_axis)
       11    0.000    0.000    0.000    0.000 generic.py:421(ndim)
        6    0.000    0.000    0.000    0.000 generic.py:447(_set_axis)
        1    0.000    0.000    0.000    0.000 generic.py:5618(stat_func)
      267    0.000    0.000    0.000    0.000 generic.py:7(_check)
        6    0.000    0.000    0.000    0.000 generic.py:869(__contains__)
        5    0.000    0.000    0.004    0.001 groupby.py:1502(groupby)
        5    0.000    0.000    0.000    0.000 groupby.py:1538(__init__)
        2    0.000    0.000    0.004    0.002 groupby.py:1558(get_iterator)
        1    0.000    0.000    0.001    0.001 groupby.py:1572(_get_splitter)
        1    0.000    0.000    0.000    0.000 groupby.py:1576(_get_group_keys)
        1    0.000    0.000    0.000    0.000 groupby.py:1633(levels)
        1    0.000    0.000    0.000    0.000 groupby.py:1635(<listcomp>)
        4    0.000    0.000    0.004    0.001 groupby.py:1663(groups)
        1    0.000    0.000    0.001    0.001 groupby.py:1678(group_info)
        1    0.000    0.000    0.001    0.001 groupby.py:1686(_get_compressed_labels)
        1    0.000    0.000    0.001    0.001 groupby.py:1687(<listcomp>)
        5    0.000    0.000    0.000    0.000 groupby.py:2184(__init__)
        6    0.000    0.000    0.003    0.000 groupby.py:2315(labels)
        6    0.000    0.000    0.000    0.000 groupby.py:2321(group_index)
        5    0.000    0.000    0.003    0.001 groupby.py:2327(_make_labels)
        4    0.000    0.000    0.004    0.001 groupby.py:2334(groups)
        5    0.000    0.000    0.001    0.000 groupby.py:2340(_get_grouper)
       10    0.000    0.000    0.000    0.000 groupby.py:2410(<genexpr>)
       10    0.000    0.000    0.000    0.000 groupby.py:2411(<genexpr>)
       10    0.000    0.000    0.000    0.000 groupby.py:2412(<genexpr>)
       10    0.000    0.000    0.000    0.000 groupby.py:2417(<genexpr>)
        5    0.000    0.000    0.000    0.000 groupby.py:2439(is_in_axis)
        5    0.000    0.000    0.000    0.000 groupby.py:2449(is_in_obj)
        5    0.000    0.000    0.000    0.000 groupby.py:2497(_is_label_like)
        5    0.000    0.000    0.000    0.000 groupby.py:2502(_convert_grouper)
        5    0.000    0.000    0.004    0.001 groupby.py:341(__init__)
        4    0.000    0.000    0.000    0.000 groupby.py:387(_assure_grouper)
        4    0.000    0.000    0.004    0.001 groupby.py:394(groups)
        1    0.000    0.000    0.000    0.000 groupby.py:3995(__init__)
        1    0.000    0.000    0.000    0.000 groupby.py:4002(slabels)
        1    0.000    0.000    0.000    0.000 groupby.py:4007(sort_idx)
        2    0.000    0.000    0.002    0.001 groupby.py:4012(__iter__)
        1    0.000    0.000    0.002    0.002 groupby.py:4029(_get_sorted_data)
        1    0.000    0.000    0.000    0.000 groupby.py:4051(__init__)
        1    0.000    0.000    0.001    0.001 groupby.py:4067(_chop)
        1    0.000    0.000    0.000    0.000 groupby.py:4095(get_splitter)
        1    0.000    0.000    0.000    0.000 groupby.py:4379(_get_group_index_sorter)
        1    0.000    0.000    0.000    0.000 groupby.py:622(__iter__)
        6    0.000    0.000    0.000    0.000 index_tricks.py:231(_retval)
        6    0.000    0.000    0.001    0.000 index_tricks.py:251(__getitem__)
        4    0.000    0.000    0.004    0.001 indexing.py:1034(_getitem_iterable)
        1    0.000    0.000    0.000    0.000 indexing.py:107(_slice)
        5    0.000    0.000    0.005    0.001 indexing.py:1302(__getitem__)
        4    0.000    0.000    0.001    0.000 indexing.py:1371(_has_valid_type)
        4    0.000    0.000    0.000    0.000 indexing.py:1423(_get_partial_string_timestamp_match_key)
        4    0.000    0.000    0.004    0.001 indexing.py:1447(_getitem_axis)
        1    0.000    0.000    0.000    0.000 indexing.py:1514(_has_valid_type)
        4    0.000    0.000    0.000    0.000 indexing.py:155(_should_validate_iterable)
        1    0.000    0.000    0.000    0.000 indexing.py:1587(_get_slice_axis)
        1    0.000    0.000    0.000    0.000 indexing.py:1599(_getitem_axis)
        2    0.000    0.000    0.000    0.000 indexing.py:1769(convert_to_index_sliceable)
        1    0.000    0.000    0.000    0.000 indexing.py:1857(maybe_convert_indices)
        8    0.000    0.000    0.000    0.000 indexing.py:1907(is_list_like_indexer)
        1    0.000    0.000    0.000    0.000 indexing.py:1918(need_slice)
        1    0.000    0.000    0.000    0.000 indexing.py:198(_convert_slice_indexer)
        5    0.000    0.000    0.000    0.000 indexing.py:59(__init__)
        2    0.000    0.000    0.000    0.000 inference.py:35(is_iterator)
       32    0.000    0.000    0.000    0.000 inference.py:53(is_list_like)
       25    0.000    0.000    0.000    0.000 inference.py:66(is_hashable)
        8    0.000    0.000    0.000    0.000 inference.py:98(is_sequence)
        2    0.000    0.000    0.001    0.000 internals.py:1001(take_nd)
       24    0.000    0.000    0.000    0.000 internals.py:111(_consolidate_key)
        4    0.000    0.000    0.000    0.000 internals.py:144(external_values)
       24    0.000    0.000    0.000    0.000 internals.py:148(internal_values)
        4    0.000    0.000    0.000    0.000 internals.py:154(get_values)
        2    0.000    0.000    0.000    0.000 internals.py:175(fill_value)
      207    0.000    0.000    0.000    0.000 internals.py:179(mgr_locs)
       28    0.000    0.000    0.000    0.000 internals.py:1811(__init__)
        2    0.000    0.000    0.000    0.000 internals.py:1819(is_bool)
       49    0.000    0.000    0.001    0.000 internals.py:208(make_block_same_class)
       81    0.000    0.000    0.000    0.000 internals.py:216(mgr_locs)
        2    0.000    0.000    0.000    0.000 internals.py:250(_slice)
       69    0.000    0.000    0.002    0.000 internals.py:2649(make_block)
        2    0.000    0.000    0.000    0.000 internals.py:269(getitem_block)
       20    0.000    0.000    0.003    0.000 internals.py:2745(__init__)
       20    0.000    0.000    0.000    0.000 internals.py:2746(<listcomp>)
       62    0.000    0.000    0.001    0.000 internals.py:2786(shape)
      186    0.000    0.000    0.000    0.000 internals.py:2788(<genexpr>)
       67    0.000    0.000    0.000    0.000 internals.py:2790(ndim)
        6    0.000    0.000    0.000    0.000 internals.py:2794(set_axis)
        2    0.000    0.000    0.000    0.000 internals.py:2829(_is_single_block)
       24    0.001    0.000    0.002    0.000 internals.py:2841(_rebuild_blknos_and_blklocs)
       81    0.000    0.000    0.000    0.000 internals.py:2862(_get_items)
       20    0.000    0.000    0.000    0.000 internals.py:289(shape)
        9    0.000    0.000    0.000    0.000 internals.py:2966(_verify_integrity)
       29    0.000    0.000    0.000    0.000 internals.py:2968(<genexpr>)
      152    0.000    0.000    0.000    0.000 internals.py:297(dtype)
       10    0.000    0.000    0.002    0.000 internals.py:2978(apply)
       58    0.000    0.000    0.000    0.000 internals.py:301(ftype)
       10    0.000    0.000    0.000    0.000 internals.py:3037(<genexpr>)
       41    0.000    0.000    0.000    0.000 internals.py:3249(is_consolidated)
       26    0.000    0.000    0.000    0.000 internals.py:3257(_consolidate_check)
       26    0.000    0.000    0.000    0.000 internals.py:3258(<listcomp>)
       25    0.000    0.000    0.000    0.000 internals.py:326(iget)
        1    0.000    0.000    0.000    0.000 internals.py:3337(get_slice)
        1    0.000    0.000    0.000    0.000 internals.py:3347(<listcomp>)
       10    0.000    0.000    0.003    0.000 internals.py:3364(copy)
       20    0.000    0.000    0.001    0.000 internals.py:3384(<lambda>)
       10    0.000    0.000    0.001    0.000 internals.py:3385(<listcomp>)
       12    0.000    0.000    0.002    0.000 internals.py:3513(consolidate)
       29    0.000    0.000    0.001    0.000 internals.py:3529(_consolidate_inplace)
       25    0.000    0.000    0.002    0.000 internals.py:3536(get)
       25    0.000    0.000    0.002    0.000 internals.py:3565(iget)
        2    0.000    0.000    0.001    0.000 internals.py:3636(set)
        8    0.000    0.000    0.004    0.001 internals.py:3748(insert)
        5    0.000    0.000    0.002    0.000 internals.py:3813(reindex_indexer)
        1    0.000    0.000    0.001    0.001 internals.py:3848(<listcomp>)
        1    0.000    0.000    0.001    0.001 internals.py:3943(take)
       27    0.000    0.000    0.000    0.000 internals.py:4031(__init__)
       92    0.000    0.000    0.000    0.000 internals.py:4077(_block)
       64    0.000    0.000    0.000    0.000 internals.py:4147(dtype)
        4    0.000    0.000    0.000    0.000 internals.py:4171(external_values)
       24    0.000    0.000    0.000    0.000 internals.py:4174(internal_values)
        2    0.000    0.000    0.001    0.000 internals.py:4259(create_block_manager_from_arrays)
        2    0.000    0.000    0.001    0.000 internals.py:4270(form_blocks)
        2    0.000    0.000    0.000    0.000 internals.py:4399(_multi_blockify)
        4    0.000    0.000    0.000    0.000 internals.py:4403(<lambda>)
        2    0.000    0.000    0.000    0.000 internals.py:4431(_stack_arrays)
        4    0.000    0.000    0.000    0.000 internals.py:4434(_asarray_compat)
        2    0.000    0.000    0.000    0.000 internals.py:4440(_shape_compat)
        4    0.000    0.000    0.001    0.000 internals.py:4511(_consolidate)
       24    0.000    0.000    0.000    0.000 internals.py:4517(<lambda>)
        8    0.000    0.000    0.001    0.000 internals.py:4528(_merge_blocks)
        4    0.000    0.000    0.000    0.000 internals.py:4542(<listcomp>)
        4    0.000    0.000    0.000    0.000 internals.py:4543(<listcomp>)
       28    0.000    0.000    0.000    0.000 internals.py:4555(_extend_blocks)
        4    0.000    0.000    0.000    0.000 internals.py:4581(_vstack)
        6    0.000    0.000    0.000    0.000 internals.py:4663(_get_blkno_placements)
        2    0.000    0.000    0.001    0.000 internals.py:4807(concatenate_block_managers)
        2    0.000    0.000    0.000    0.000 internals.py:4820(<listcomp>)
        2    0.000    0.000    0.001    0.000 internals.py:4823(<listcomp>)
        4    0.000    0.000    0.000    0.000 internals.py:4830(get_empty_dtype_and_na)
        4    0.000    0.000    0.001    0.000 internals.py:4910(concatenate_join_units)
        4    0.000    0.000    0.000    0.000 internals.py:4920(<listcomp>)
        2    0.000    0.000    0.000    0.000 internals.py:4935(get_mgr_concatenation_plan)
        6    0.000    0.000    0.000    0.000 internals.py:5014(combine_concat_plans)
        4    0.000    0.000    0.000    0.000 internals.py:5107(__init__)
        4    0.000    0.000    0.000    0.000 internals.py:5119(needs_filling)
        4    0.000    0.000    0.000    0.000 internals.py:5128(dtype)
        4    0.000    0.000    0.000    0.000 internals.py:5141(is_null)
        4    0.000    0.000    0.000    0.000 internals.py:5170(get_reindexed_values)
        8    0.000    0.000    0.001    0.000 internals.py:5227(_fast_count_smallints)
       20    0.000    0.000    0.001    0.000 internals.py:608(copy)
       69    0.001    0.000    0.001    0.000 internals.py:96(__init__)
        2    0.000    0.000    0.002    0.001 merge.py:1396(concat)
        2    0.000    0.000    0.001    0.000 merge.py:1460(__init__)
        2    0.000    0.000    0.000    0.000 merge.py:1487(<listcomp>)
        2    0.000    0.000    0.000    0.000 merge.py:1528(<listcomp>)
        2    0.000    0.000    0.001    0.000 merge.py:1599(get_result)
        2    0.000    0.000    0.000    0.000 merge.py:1658(_get_result_dim)
        2    0.000    0.000    0.000    0.000 merge.py:1664(_get_new_axes)
        2    0.000    0.000    0.000    0.000 merge.py:1688(_get_comb_axis)
        2    0.000    0.000    0.000    0.000 merge.py:1693(<listcomp>)
        2    0.000    0.000    0.000    0.000 merge.py:1700(_get_concat_axis)
        2    0.000    0.000    0.000    0.000 merge.py:1732(<listcomp>)
        2    0.000    0.000    0.000    0.000 merge.py:1748(_maybe_check_integrity)
        2    0.000    0.000    0.000    0.000 merge.py:1756(_concat_indexes)
        7    0.000    0.000    0.000    0.000 missing.py:120(_isnull_ndarraylike)
        7    0.000    0.000    0.001    0.000 missing.py:245(array_equivalent)
       32    0.000    0.000    0.001    0.000 missing.py:27(isnull)
       32    0.000    0.000    0.001    0.000 missing.py:48(_isnull_new)
        8    0.000    0.000    0.000    0.000 missing.py:563(clean_reindex_fill_method)
        2    0.000    0.000    0.000    0.000 missing.py:567(fill_zeros)
        8    0.000    0.000    0.000    0.000 missing.py:65(clean_fill_method)
        1    0.000    0.000    0.000    0.000 nanops.py:152(_get_fill_value)
        1    0.000    0.000    0.000    0.000 nanops.py:175(_get_values)
        2    0.000    0.000    0.000    0.000 nanops.py:229(_na_ok_dtype)
        1    0.000    0.000    0.000    0.000 nanops.py:233(_view_if_needed)
        1    0.000    0.000    0.000    0.000 nanops.py:239(_wrap_results)
        1    0.000    0.000    0.000    0.000 nanops.py:433(reduction)
        1    0.000    0.000    0.000    0.000 nanops.py:643(_maybe_null_out)
        1    0.000    0.000    0.000    0.000 nanops.py:76(f)
        4    0.000    0.000    0.001    0.000 nanops.py:790(unique1d)
       14    0.000    0.000    0.000    0.000 numeric.py:128(inferred_type)
       29    0.000    0.000    0.000    0.000 numeric.py:137(is_all_dates)
       12    0.000    0.000    0.000    0.000 numeric.py:1404(rollaxis)
        5    0.000    0.000    0.000    0.000 numeric.py:2476(array_equal)
       10    0.000    0.000    0.000    0.000 numeric.py:2576(seterr)
       10    0.000    0.000    0.000    0.000 numeric.py:2676(geterr)
       10    0.000    0.000    0.000    0.000 numeric.py:28(__new__)
        5    0.000    0.000    0.000    0.000 numeric.py:2963(__init__)
        5    0.000    0.000    0.000    0.000 numeric.py:2967(__enter__)
        5    0.000    0.000    0.000    0.000 numeric.py:2972(__exit__)
      109    0.000    0.000    0.000    0.000 numeric.py:414(asarray)
       29    0.000    0.000    0.000    0.000 numeric.py:484(asanyarray)
        6    0.000    0.000    0.000    0.000 numeric.py:607(require)
       12    0.000    0.000    0.000    0.000 numeric.py:676(<genexpr>)
        6    0.000    0.000    0.000    0.000 numerictypes.py:1015(<listcomp>)
        6    0.000    0.000    0.000    0.000 numerictypes.py:1016(<listcomp>)
       16    0.000    0.000    0.000    0.000 numerictypes.py:660(issubclass_)
       16    0.000    0.000    0.000    0.000 numerictypes.py:728(issubdtype)
       12    0.000    0.000    0.000    0.000 numerictypes.py:942(_can_coerce_all)
       48    0.000    0.000    0.000    0.000 numerictypes.py:951(<listcomp>)
        6    0.000    0.000    0.000    0.000 numerictypes.py:964(find_common_type)
        2    0.000    0.000    0.000    0.000 ops.py:299(<lambda>)
        2    0.000    0.000    0.000    0.000 ops.py:302(__init__)
        2    0.000    0.000    0.000    0.000 ops.py:312(get_op)
        2    0.000    0.000    0.000    0.000 ops.py:607(_align_method_SERIES)
        2    0.000    0.000    0.000    0.000 ops.py:628(_construct_result)
        2    0.000    0.000    0.000    0.000 ops.py:649(na_op)
        2    0.000    0.000    0.000    0.000 ops.py:673(safe_na_op)
        2    0.000    0.000    0.001    0.000 ops.py:689(wrapper)
       16    0.000    0.000    0.000    0.000 range.py:124(_simple_new)
        8    0.000    0.000    0.000    0.000 range.py:151(_validate_dtype)
        6    0.000    0.000    0.000    0.000 range.py:162(_data)
        4    0.000    0.000    0.000    0.000 range.py:166(_int64index)
        8    0.000    0.000    0.000    0.000 range.py:170(_get_data_as_items)
       22    0.000    0.000    0.000    0.000 range.py:225(dtype)
       12    0.000    0.000    0.000    0.000 range.py:229(is_unique)
       13    0.000    0.000    0.000    0.000 range.py:249(_shallow_copy)
       11    0.000    0.000    0.001    0.000 range.py:286(equals)
       16    0.000    0.000    0.000    0.000 range.py:44(__new__)
      103    0.000    0.000    0.000    0.000 range.py:458(__len__)
       16    0.000    0.000    0.000    0.000 range.py:60(_ensure_int)
       14    0.000    0.000    0.000    0.000 series.py:1090(__iter__)
        4    0.000    0.000    0.001    0.000 series.py:1239(unique)
       27    0.000    0.000    0.001    0.000 series.py:135(__init__)
        1    0.000    0.000    0.000    0.000 series.py:2303(_reduce)
       25    0.000    0.000    0.001    0.000 series.py:252(from_array)
        2    0.000    0.000    0.000    0.000 series.py:263(_constructor)
        6    0.000    0.000    0.000    0.000 series.py:2791(_sanitize_index)
        6    0.000    0.000    0.000    0.000 series.py:2817(_sanitize_array)
        6    0.000    0.000    0.000    0.000 series.py:2834(_try_cast)
       27    0.000    0.000    0.000    0.000 series.py:286(_set_axis)
       27    0.000    0.000    0.000    0.000 series.py:312(_set_subtyp)
       35    0.000    0.000    0.000    0.000 series.py:322(name)
       27    0.000    0.000    0.000    0.000 series.py:326(name)
       64    0.000    0.000    0.000    0.000 series.py:333(dtype)
        4    0.000    0.000    0.000    0.000 series.py:353(values)
       24    0.000    0.000    0.000    0.000 series.py:386(_values)
        4    0.000    0.000    0.000    0.000 shape_base.py:180(vstack)
        4    0.000    0.000    0.000    0.000 shape_base.py:230(<listcomp>)
       16    0.000    0.000    0.000    0.000 shape_base.py:61(atleast_2d)
       12    0.000    0.000    0.000    0.000 validators.py:113(_check_for_invalid_keys)
       12    0.000    0.000    0.000    0.000 validators.py:129(validate_kwargs)
       12    0.000    0.000    0.000    0.000 validators.py:31(_check_for_default_values)
       69    0.000    0.000    0.000    0.000 {built-in method __new__ of type object at 0x1001b7e90}
        5    0.000    0.000    0.000    0.000 {built-in method all}
       19    0.000    0.000    0.000    0.000 {built-in method any}
       64    0.000    0.000    0.000    0.000 {built-in method arange}
        2    0.000    0.000    0.000    0.000 {built-in method array_equivalent_object}
      221    0.000    0.000    0.000    0.000 {built-in method array}
        6    0.000    0.000    0.000    0.000 {built-in method bincount}
       38    0.000    0.000    0.000    0.000 {built-in method callable}
       25    0.000    0.000    0.000    0.000 {built-in method checknull}
       28    0.000    0.000    0.000    0.000 {built-in method concatenate}
       78    0.000    0.000    0.000    0.000 {built-in method empty}
       11    0.000    0.000    0.000    0.000 {built-in method ensure_int64}
        4    0.000    0.000    0.000    0.000 {built-in method ensure_int8}
       13    0.000    0.000    0.000    0.000 {built-in method ensure_object}
       25    0.000    0.000    0.000    0.000 {built-in method ensure_platform_int}
        1    0.000    0.000    0.353    0.353 {built-in method exec}
      409    0.000    0.000    0.000    0.000 {built-in method getattr}
       20    0.000    0.000    0.000    0.000 {built-in method geterrobj}
      702    0.000    0.000    0.001    0.000 {built-in method hasattr}
       79    0.000    0.000    0.000    0.000 {built-in method hash}
        7    0.000    0.000    0.000    0.000 {built-in method id}
     3272    0.001    0.000    0.002    0.000 {built-in method isinstance}
      541    0.000    0.000    0.000    0.000 {built-in method issubclass}
      100    0.000    0.000    0.000    0.000 {built-in method iter}
21196/21041    0.003    0.000    0.003    0.000 {built-in method len}
        8    0.000    0.000    0.000    0.000 {built-in method list_to_object_array}
      107    0.000    0.000    0.000    0.000 {built-in method max}
    20013    0.008    0.000    0.008    0.000 {built-in method min}
        5    0.000    0.000    0.000    0.000 {built-in method putmask}
        4    0.044    0.011    0.113    0.028 {built-in method reduce}
        5    0.000    0.000    0.000    0.000 {built-in method setattr}
       10    0.000    0.000    0.000    0.000 {built-in method seterrobj}
       14    0.005    0.000    0.005    0.000 {built-in method sorted}
        2    0.000    0.000    0.000    0.000 {built-in method sub}
       13    0.000    0.000    0.001    0.000 {built-in method sum}
       12    0.000    0.000    0.000    0.000 {method 'add' of 'pandas.lib.BlockPlacement' objects}
        4    0.000    0.000    0.000    0.000 {method 'add' of 'set' objects}
       11    0.000    0.000    0.000    0.000 {method 'all' of 'numpy.ndarray' objects}
       33    0.000    0.000    0.001    0.000 {method 'any' of 'numpy.ndarray' objects}
      116    0.000    0.000    0.000    0.000 {method 'append' of 'list' objects}
        9    0.000    0.000    0.000    0.000 {method 'argsort' of 'numpy.ndarray' objects}
       12    0.000    0.000    0.000    0.000 {method 'astype' of 'numpy.ndarray' objects}
       12    0.000    0.000    0.000    0.000 {method 'clear' of 'dict' objects}
       16    0.000    0.000    0.000    0.000 {method 'copy' of 'dict' objects}
       31    0.000    0.000    0.000    0.000 {method 'copy' of 'numpy.ndarray' objects}
        4    0.000    0.000    0.000    0.000 {method 'cumsum' of 'numpy.ndarray' objects}
        1    0.000    0.000    0.000    0.000 {method 'disable' of '_lsprof.Profiler' objects}
        2    0.000    0.000    0.000    0.000 {method 'extend' of 'list' objects}
       48    0.000    0.000    0.000    0.000 {method 'fill' of 'numpy.ndarray' objects}
       80    0.000    0.000    0.000    0.000 {method 'get' of 'dict' objects}
        4    0.000    0.000    0.000    0.000 {method 'get_indexer' of 'pandas.index.IndexEngine' objects}
        5    0.001    0.000    0.001    0.000 {method 'get_labels' of 'pandas.hashtable.PyObjectHashTable' objects}
       54    0.000    0.000    0.000    0.000 {method 'get_loc' of 'pandas.index.IndexEngine' objects}
       12    0.000    0.000    0.000    0.000 {method 'item' of 'numpy.ndarray' objects}
       91    0.000    0.000    0.000    0.000 {method 'items' of 'dict' objects}
        4    0.000    0.000    0.000    0.000 {method 'keys' of 'dict' objects}
        5    0.000    0.000    0.000    0.000 {method 'max' of 'numpy.ndarray' objects}
        4    0.000    0.000    0.000    0.000 {method 'min' of 'numpy.ndarray' objects}
        6    0.000    0.000    0.000    0.000 {method 'nonzero' of 'numpy.ndarray' objects}
       14    0.000    0.000    0.000    0.000 {method 'pop' of 'dict' objects}
        2    0.000    0.000    0.000    0.000 {method 'pop' of 'set' objects}
        5    0.000    0.000    0.000    0.000 {method 'put' of 'numpy.ndarray' objects}
       18    0.000    0.000    0.000    0.000 {method 'ravel' of 'numpy.ndarray' objects}
       56    0.001    0.000    0.001    0.000 {method 'reduce' of 'numpy.ufunc' objects}
        2    0.000    0.000    0.000    0.000 {method 'repeat' of 'numpy.ndarray' objects}
        6    0.000    0.000    0.000    0.000 {method 'reshape' of 'numpy.ndarray' objects}
        3    0.000    0.000    0.000    0.000 {method 'search' of '_sre.SRE_Pattern' objects}
        5    0.000    0.000    0.000    0.000 {method 'setdefault' of 'dict' objects}
        1    0.000    0.000    0.000    0.000 {method 'sum' of 'numpy.ndarray' objects}
       15    0.000    0.000    0.000    0.000 {method 'take' of 'numpy.ndarray' objects}
        5    0.000    0.000    0.000    0.000 {method 'to_array' of 'pandas.hashtable.ObjectVector' objects}
       12    0.000    0.000    0.000    0.000 {method 'transpose' of 'numpy.ndarray' objects}
        4    0.001    0.000    0.001    0.000 {method 'unique' of 'pandas.hashtable.PyObjectHashTable' objects}
       32    0.000    0.000    0.000    0.000 {method 'update' of 'dict' objects}
        8    0.001    0.000    0.001    0.000 {method 'update' of 'set' objects}
        6    0.000    0.000    0.000    0.000 {method 'upper' of 'str' objects}
        6    0.000    0.000    0.000    0.000 {method 'values' of 'dict' objects}
      110    0.000    0.000    0.000    0.000 {method 'view' of 'numpy.ndarray' objects}
        5    0.000    0.000    0.000    0.000 {pandas.algos.groupsort_indexer}
        1    0.000    0.000    0.000    0.000 {pandas.algos.take_1d_int64_int64}
        1    0.000    0.000    0.000    0.000 {pandas.algos.take_2d_axis1_int64_int64}
        1    0.000    0.000    0.000    0.000 {pandas.algos.take_2d_axis1_object_object}
        2    0.000    0.000    0.000    0.000 {pandas.lib.clean_index_list}
        1    0.000    0.000    0.000    0.000 {pandas.lib.generate_slices}
        2    0.000    0.000    0.000    0.000 {pandas.lib.get_blkno_indexers}
       32    0.000    0.000    0.000    0.000 {pandas.lib.infer_dtype}
        2    0.000    0.000    0.000    0.000 {pandas.lib.is_bool_array}
        4    0.000    0.000    0.000    0.000 {pandas.lib.is_bool}
        4    0.000    0.000    0.000    0.000 {pandas.lib.is_float}
       37    0.000    0.000    0.000    0.000 {pandas.lib.is_integer}
        6    0.000    0.000    0.000    0.000 {pandas.lib.isnullobj}
       86    0.000    0.000    0.000    0.000 {pandas.lib.isscalar}
        4    0.003    0.001    0.003    0.001 {pandas.lib.maybe_convert_objects}
        2    0.000    0.000    0.000    0.000 {pandas.lib.to_object_array}
       67    0.000    0.000    0.000    0.000 {pandas.lib.values_from_object}


---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-4-c5f0c30c6a74> in <module>()
      1 import cProfile
----> 2 cProfile.run("GenomicIntervals.interval_jaccard(query, annot, samples=1000, chromosome_sizes={'chr1': 4})")

/Users/kasper/anaconda/envs/simons/lib/python3.4/cProfile.py in run(statement, filename, sort)
     14 
     15 def run(statement, filename=None, sort=-1):
---> 16     return _pyprofile._Utils(Profile).run(statement, filename, sort)
     17 
     18 def runctx(statement, globals, locals, filename=None, sort=-1):

/Users/kasper/anaconda/envs/simons/lib/python3.4/profile.py in run(self, statement, filename, sort)
     53         prof = self.profiler()
     54         try:
---> 55             prof.run(statement)
     56         except SystemExit:
     57             pass

/Users/kasper/anaconda/envs/simons/lib/python3.4/cProfile.py in run(self, cmd)
     93         import __main__
     94         dict = __main__.__dict__
---> 95         return self.runctx(cmd, dict, dict)
     96 
     97     def runctx(self, cmd, globals, locals):

/Users/kasper/anaconda/envs/simons/lib/python3.4/cProfile.py in runctx(self, cmd, globals, locals)
     98         self.enable()
     99         try:
--> 100             exec(cmd, globals, locals)
    101         finally:
    102             self.disable()

<string> in <module>()

/Users/kasper/Dropbox/Code/GenomicIntervals/GenomicIntervals.py in interval_jaccard(query, annot, samples, chromosome_sizes, dview)
    279         null_distr = list(dview.map(jaccard_stat_perm, [query] * samples, [annot] * samples))
    280     else:
--> 281         null_distr = list(map(jaccard_stat_perm, [query] * samples, [annot] * samples))
    282 
    283     # get p value

/Users/kasper/Dropbox/Code/GenomicIntervals/GenomicIntervals.py in jaccard_stat(a, b, chromosome_sizes, permute)
    251 
    252         if permute:
--> 253             a = interval_permute(a, chromosome_sizes=chromosome_sizes)
    254 
    255         inter = interval_intersect(a, b)

/Users/kasper/Dropbox/Code/GenomicIntervals/GenomicIntervals.py in interval_permute(df, chromosome_sizes)
    225             for chrom, group in df.groupby('chrom'):
    226 
--> 227                 assert group.end.max() <= chromosome_sizes[chrom]
    228 
    229                 segment_lengths = group.end - group.start

AssertionError: 

In [42]:
#%load_ext rpy2.ipython

In [3]:
# source("http://bioconductor.org/biocLite.R")
# biocLite("IRanges")
# biocLite("GenomicRanges")
# biocLite("rtracklayer")
# biocLite("TxDb.Hsapiens.UCSC.hg19.knownGene")
# biocLite("gplots")
# biocLite("RCurl")
# install.packages('GenometriCorr',repos='http://genometricorr.sourceforge.net/R/',type='source')

In [4]:
#%%R

#library('GenometriCorr')