|
From: Ernesto <e.p...@un...> - 2010-04-28 19:36:14
|
Thanks a lot,
Ernesto
> This is a common bug: You are storing the iterator rather than what it points to. Try doing
>
> results=[row[:] for row in table.where('(qual > 1) & (qual < 10)')]
> This will copy out all of the columns of the row.
>
> (At least, I believe that's the correct syntax). I'm sure you'll get a correction soone nough.
>
> On Wed, Apr 28, 2010 at 2:22 PM, Ernesto <e.p...@un...> wrote:
> Hi Francesc, thank you for your reply.
> > The first column contains an integer. Now I'd like to sort my table
> > according to numbers of the first column. Is there a way to perform this
> > action?
>
> > Yes. The simplest way is by setting the `sortby` parameter to true in the
> > `Table.copy()` method. This triggers an on-disk sorting operation, so you
> > don't have to be afraid of your available memory. You will need the Pro
> > version for getting this capability.
>
> It means that I can sort a table using the Pro version only. No other solutions are available?
> Working with my simple table I found a strange behaviour that probably is due to my limited experience with pytables.
> The description of the table is:
> /newgroup/table (Table(729036,), shuffle, zlib(1)) 'A table'
> description := {
> "position": Int32Col(shape=(), dflt=0, pos=0),
> "read": StringCol(itemsize=1, shape=(), dflt='', pos=1),
> "qual": Int32Col(shape=(), dflt=0, pos=2),
> "strand": StringCol(itemsize=1, shape=(), dflt='', pos=3)}
> byteorder := 'little'
> chunkshape := (819,)
> Next I iterate over a subset using the command:
> for row in table.where('(qual > 1) & (qual < 10)'):
> print row
> It works correctly and I get expected results.
> Then I use the following command:
> results=[row for row in table.where('(qual > 1) & (qual < 10)')]
> it works but I get a list containing the same value.
> I report the first five rows obtained using both procedures:
> - procedure 1:
> (167809, 'C', 8, '-')
> (167810, 'G', 9, '-')
> (167812, 'C', 5, '-')
> (167823, 'T', 9, '-')
> (1015856, 'G', 5, '-')
> - procedure 2:
> [(1041269, 'G', 39, '-'), (1041269, 'G', 39, '-'), (1041269, 'G', 39, '-'), (1041269, 'G', 39, '-'), (1041269, 'G', 39, '-')]
>
> Where is the error?
>
> Thank a lot,
>
> Ernesto
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Pytables-users mailing list
> Pyt...@li...
> https://lists.sourceforge.net/lists/listinfo/pytables-users
>
>
>
>
> --
> Nicholas Dunn
> (207) 651-9839
|