Skip to content

Index with numpy int64 #143

Closed
Closed

Description

@alimanfoo
---------------------------------------------------------------------------
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

Activity

  1. added a commit that references this issue on Apr 26, 2017
  2. added 2 commits that reference this issue on Oct 24, 2017
  3. added a commit that references this issue on Oct 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions