Skip to content

Commit

Permalink
fix failure to wrap without copying
Browse files Browse the repository at this point in the history
  • Loading branch information
alimanfoo committed Mar 6, 2015
1 parent f9063be commit 8d45774
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions allel/bcolz.py
Original file line number Diff line number Diff line change
Expand Up @@ -1092,7 +1092,7 @@ def count_alleles_subpops(self, subpops, max_allele=None, **kwargs):
else:
acs_ctbl.append(cols)

return AlleleCountsCTable(acs_ctbl)
return AlleleCountsCTable(acs_ctbl, copy=False)

def to_gt(self, phased=False, max_allele=None, **kwargs):
if max_allele is None:
Expand Down Expand Up @@ -1278,7 +1278,7 @@ def count_alleles_subpops(self, subpops, max_allele=None, **kwargs):
acs_ctbl.append(cols)

# wrap for convenience
return AlleleCountsCTable(acs_ctbl)
return AlleleCountsCTable(acs_ctbl, copy=False)


class AlleleCountsCArray(_CArrayWrapper):
Expand Down Expand Up @@ -1784,8 +1784,12 @@ def from_gff3(path, attributes=None, region=None,

class AlleleCountsCTable(_CTableWrapper):

def __init__(self, ctbl):
self.ctbl = ctbl
def __init__(self, data=None, copy=True, index=None, **kwargs):
if copy or not isinstance(data, bcolz.ctable):
ctbl = bcolz.ctable(data, **kwargs)
else:
ctbl = data
object.__setattr__(self, 'ctbl', ctbl)

def __getitem__(self, item):
o = super(AlleleCountsCTable, self).__getitem__(item)
Expand Down

0 comments on commit 8d45774

Please sign in to comment.