|
From: Ernesto <e.p...@un...> - 2010-04-28 18:36:35
|
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
|