From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Data table text I/O package?
Date: Wed, 15 Jun 2005 18:58:48 +0200
Date: 2005-06-15T18:58:36+02:00 [thread overview]
Message-ID: <1of5ssrr48ljh.5n01othh8n1v.dlg@40tude.net> (raw)
In-Reply-To: mailman.43.1118852245.17633.comp.lang.ada@ada-france.org
On Wed, 15 Jun 2005 18:17:06 +0200, Preben Randhol wrote:
> On Wed, Jun 15, 2005 at 05:02:37PM +0200, Jacob Sparre Andersen wrote:
>> Preben Randhol wrote:
>>> Jacob Sparre Andersen <sparre@nbi.dk> wrote on 15/06/2005 (13:38) :
>>
>>> > The important part is to have the checking of the headers and the
>>> > generation of Put_Line and Get_Line procedures automated based on
>>> > a record type (and not too much more). Since I need records (for
>>> > type checking) and not just simple arrays, I can't manage with a
>>> > generic package, but have to put some code generation into the
>>> > system (or can I play some tricks with streams?).
>>>
>>> So the header might be:
>>>
>>> Integer Float Text
>>
>> Not quite. The headers would be field names, not just types. I.e.:
>>
>> Gene ID p-value Expression-level Description Human cromosome
>> GE29031 0.04539 245.45 Cyclin-B1 17
>>
>>> and the data could be:
>>>
>>> 1 0.9 Start point
>>> 2 0.3 Minimum
>>> 3 6.0 End point
>>>
>>> and then you want to check the data and validate that they are of
>>> the correct type as indicated by the header? To generate the header
>>> you want that the package finds out which type a certain data type
>>> is and output this type in the header?
>>
>> Sort of. Except that I would use the names of the fields in the
>> record and not just the types of the fields.
>>
>> One of my problems is that I have different kinds of files (in terms
>> of meaning of the numbers) where the types for all practical purposes
>> are the same.
>
> So you have different files with for example p-value, and in all the
> p-value is a float?
>
> If so, then I would have made a map something like:
>
> Gene => "Text"
> ID => "Float"
> p-value => "My_Float" (In case you have a special type)
> Expression-level => "Text"
> Description => "Text"
> Human cromosome => "Text"
> ...
>
>
> and when you read in the values you can do a
>
> Is_Valid_Type (Column_Type : String; Value : String) return Boolean
> is
> begin
> if Column_Type = "Float" then
> declare
> F : Float := Float'Value (Value);
> begin
> return true;
> exception
> when => others
> return false;
> end;
> elsif Column_Type = "Integer" then
> ...
One could have tagged objects and handles to them. Then the header string
could form a list of handles to the objects. The read loop could then look
like:
loop
Get_Line (Buffer, Length);
declare
Line : constant String := Buffer (Buffer'First, Length);
begin
Pointer := Line'First;
for Field in Handles_List'Range loop
Get (Line, Pointer); -- Skip blanks
Get (Line, Pointer, Ptr (Handles_List (Field)).all); -- Dispatches
end loop;
end;
Get (Line, Pointer); -- Skip blanks
if Pointer <= Line'Last then
-- Unrecognized rest
end if;
end loop;
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2005-06-15 16:58 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-15 9:57 Data table text I/O package? Jacob Sparre Andersen
2005-06-15 11:43 ` Preben Randhol
2005-06-15 13:35 ` Jacob Sparre Andersen
2005-06-15 14:12 ` Preben Randhol
2005-06-15 15:02 ` Jacob Sparre Andersen
2005-06-15 16:17 ` Preben Randhol
2005-06-15 16:58 ` Dmitry A. Kazakov [this message]
2005-06-15 17:30 ` Marius Amado Alves
2005-06-15 18:41 ` Dmitry A. Kazakov
2005-06-15 19:09 ` Marius Amado Alves
2005-06-15 18:58 ` Randy Brukardt
2005-06-16 9:55 ` Jacob Sparre Andersen
2005-06-16 10:53 ` Marius Amado Alves
2005-06-16 12:24 ` Robert A Duff
2005-06-16 14:01 ` Georg Bauhaus
2005-06-16 12:27 ` Dmitry A. Kazakov
2005-06-16 14:46 ` Georg Bauhaus
2005-06-16 14:51 ` Dmitry A. Kazakov
2005-06-20 11:19 ` Georg Bauhaus
2005-06-20 11:39 ` Dmitry A. Kazakov
2005-06-20 18:25 ` Georg Bauhaus
2005-06-20 18:45 ` Preben Randhol
2005-06-20 18:54 ` Dmitry A. Kazakov
2005-06-21 9:24 ` Georg Bauhaus
2005-06-21 9:52 ` Jacob Sparre Andersen
2005-06-21 11:10 ` Georg Bauhaus
2005-06-21 12:35 ` Jacob Sparre Andersen
2005-06-21 10:42 ` Dmitry A. Kazakov
2005-06-21 11:41 ` Georg Bauhaus
2005-06-21 12:44 ` Dmitry A. Kazakov
2005-06-21 21:01 ` Georg Bauhaus
2005-06-22 12:15 ` Dmitry A. Kazakov
2005-06-22 22:24 ` Georg Bauhaus
2005-06-23 9:03 ` Dmitry A. Kazakov
2005-06-23 9:47 ` Georg Bauhaus
2005-06-23 10:34 ` Dmitry A. Kazakov
2005-06-23 11:37 ` Georg Bauhaus
2005-06-23 12:59 ` Dmitry A. Kazakov
2005-06-23 14:16 ` Marc A. Criley
2005-06-25 16:38 ` Simon Wright
2005-06-16 13:26 ` Marius Amado Alves
2005-06-16 18:10 ` Georg Bauhaus
2005-06-30 3:02 ` Randy Brukardt
2005-06-30 18:43 ` Jacob Sparre Andersen
2005-07-01 1:22 ` Randy Brukardt
2005-07-01 3:01 ` Alexander E. Kopilovich
2005-07-01 5:59 ` Jeffrey Carter
2005-07-02 1:54 ` Randy Brukardt
2005-07-02 10:24 ` Dmitry A. Kazakov
2005-07-06 22:04 ` Randy Brukardt
2005-06-30 19:24 ` Björn Persson
2005-07-01 0:54 ` Randy Brukardt
2005-07-01 21:36 ` TSV and CSV Björn Persson
2005-07-01 22:08 ` Martin Dowie
2005-07-02 0:05 ` Georg Bauhaus
2005-07-02 1:10 ` Randy Brukardt
2005-07-02 1:20 ` Ed
2005-07-03 9:08 ` Georg Bauhaus
2005-07-02 0:07 ` Data table text I/O package? Georg Bauhaus
2005-07-02 1:21 ` Randy Brukardt
[not found] ` <20050615141236.GA90053@pvv.org>
2005-06-15 15:40 ` Marius Amado Alves
2005-06-15 19:18 ` Oliver Kellogg
2005-06-17 9:02 ` Jacob Sparre Andersen
[not found] ` <7adf1648bb99ca2bb4055ed8e6e381f4@netcabo.pt>
2005-06-15 15:46 ` Preben Randhol
[not found] ` <20050615154640.GA1921@pvv.org>
2005-06-15 16:14 ` Marius Amado Alves
[not found] ` <f04ccd7efd67fe197cc14cda89340779@netcabo.pt>
2005-06-15 16:20 ` Preben Randhol
2005-06-15 19:30 ` Simon Wright
2005-06-15 22:40 ` Lionel Draghi
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox