Skip to content

Index with numpy int64 #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alimanfoo opened this issue Mar 18, 2017 · 0 comments
Closed

Index with numpy int64 #143

alimanfoo opened this issue Mar 18, 2017 · 0 comments

Comments

@alimanfoo
Copy link
Member

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-30-bec833fbac57> in <module>()
      2 sample_indices = tuple(sorted(df_samples[df_samples.population == pop].index.values))
      3 for chrom in chromosomes:
----> 4     results_by_pop[pop][chrom] = targets_accumulating_variation(chrom, sample_indices)

<ipython-input-15-8f3c421e63a5> in targets_accumulating_variation(chrom, sample_indices)
     11     sample_indices = random.sample(sample_indices, len(sample_indices))
     12     for i, sidx in enumerate(sample_indices):
---> 13         is_variant |= get_is_variant(chrom, sidx)
     14         loc = base_loc & get_target_is_conserved(is_variant)
     15         n_targets = np.count_nonzero(loc)

<ipython-input-13-dd88d658f1a4> in get_is_variant(chrom, sample_idx)
      4     out = np.zeros_like(seq, dtype=bool)
      5     pos = callset_pass[chrom]['variants/POS'][:]
----> 6     g = callset_pass[chrom]['calldata/genotype'][:, sample_idx]
      7     loc = np.any(g > 0, axis=1)
      8     idx = pos[loc] - 1

/home/aliman/miniconda3/envs/biipy_20170126_py35/lib/python3.5/site-packages/zarr/core.py in __getitem__(self, item)
    446 
    447         # normalize selection
--> 448         selection = normalize_array_selection(item, self._shape)
    449 
    450         # determine output array shape

/home/aliman/miniconda3/envs/biipy_20170126_py35/lib/python3.5/site-packages/zarr/util.py in normalize_array_selection(item, shape)
    184         # determine start and stop indices for all axes
    185         selection = tuple(normalize_axis_selection(i, l)
--> 186                           for i, l in zip(item, shape))
    187 
    188         # fill out selection if not completely specified

/home/aliman/miniconda3/envs/biipy_20170126_py35/lib/python3.5/site-packages/zarr/util.py in <genexpr>(.0)
    184         # determine start and stop indices for all axes
    185         selection = tuple(normalize_axis_selection(i, l)
--> 186                           for i, l in zip(item, shape))
    187 
    188         # fill out selection if not completely specified

/home/aliman/miniconda3/envs/biipy_20170126_py35/lib/python3.5/site-packages/zarr/util.py in normalize_axis_selection(item, l)
    163 
    164     else:
--> 165         raise TypeError('expected integer or slice, found: %r' % item)
    166 
    167 

TypeError: expected integer or slice, found: 736
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant