SD reader

Hello,

I would know if is it possible to read only a part of an SD file.
For instance, I would read the first 100 records, display these record and read the next 100 records and display these following records.

Thanks for your help
Answers 19
HP
HP 2010-04-06
I initially interpreted SamuelG's question as asking for a simple paged compound viewer, such as the out-of-the-box HTML Molecular Table Viewer. What are you looking for that this kind of viewer doesn't provide?

SamuelG's follow-up also implies that he's worried that reading the file will take a long time. I think Pierre's last suggestion is the right way to handle that. The reading step will be fast (for most SD files, anyway) compared to launching a viewer, so you probably won't even notice that you have to wait for the whole set to be read.
SG
SG 2010-04-06
Thank for your interrest Chris.

Indeed, my problem is to read a set of large SD file (500 Mo each file) that cannot be manage in Oracle Database anymore(we have 20 million of structures).
So, I want to find an efficient SD viewer capable of reading large SD file.
We have other solutions but my project manager is aware about pipeline flexibility and want to know if it can be an efficient SD reader.
HP
HP 2010-04-06
Well, that really depends on the SD file size. Asinex for instance, you'd wait roughly 15 seconds, it's not ages, but for a live web applications that's probably too long. Here is a demo protocol caching remaining records, I'm sure we could do something better, the previous idea of dynamic range filtering should be better - no write time waste.
comment imagecomment image
HP
HP 2010-04-06
Samuel, with that file size, don't you think about splitting the file into chunks of 25k structures such as PubChem provides? You could then guess the file to read from a structure index (floor(index/@file_chunk_size)
HP
HP 2010-04-06
Off topic - but i'm curious - why can't Oracle handle 20 Million compounds?

The new PPCart handles the CAP Complete database just fine (~10M compounds).

quote:
Originally posted by SamuelG:
Thank for your interrest Chris.

Indeed, my problem is to read a set of large SD file (500 Mo each file) that cannot be manage in Oracle Database anymore(we have 20 million of structures).
HP
HP 2010-04-06
Hi,

You can read the first N records but can't specify where to start. A workaround would be to read the N first record and then use a range filter from M to N. You can specifiy N and M dynamically using global parameters.

Cheers,
HP
HP 2010-04-06
Hello,

Depending on your specific use case you might also simply read the entire file but follow the reader by a "Group Data by Number" component to create groups of 100 records, which could then get passed to an RTC (run-to-completion) subprotocol for ungrouping, processing and display.

Best wishes,
Lynn Miller
Accelrys Support
SG
SG 2010-04-06
Thanks for your quick reply.

So if I well understood, there is no equivalent for a "cursor on a file" in other languages.

Can I display the N first lines of a file while I continue to fill a data cache?

Then I could use this data cache to display remaining data.
HP
HP 2010-04-06
In principle, yes, but display will have to wait that reading is over. For instance, you may rea your SD, filter first N (range) records to the display, and fail port to a cache or temp file, then read from the cache instead of the SD.
LB
LB 2010-04-07
Hi Pierre-

You might be able to re-create the join functionality by building another cahe with just the compound IDs and their index in the structure cache. Then use the Join from Cache coponent to look up the index, and just read 1 record at that index location from the structure cache.

The idea would be that just a cache of the id and index ight fit in memory, where all the structures won't.

Leo
HP
HP 2010-04-07
Thanks Leo that's a good idea.
We could also keep the index in hash table.

What would be nice is would be to have a cache random access component based on the already existing index file. ;-)
HP
HP 2010-04-07
quote:
Originally posted by Pierre Ducrot (Discngine):
.....
What would be nice is would be to have a cache random access component based on the already existing index file. ;-)


Isn't that called a 'DATABASE' ???
If you are going to use and re-use and re-(ab)use the SDFiles, you are best storing it in a database.

If you don't need chemistry indexing, use Derby or MySQL.
SG
SG 2010-04-07
In fact, Oracle can handle 20 Million chemical structures (using Isis chemical database distribution).

But loading of new structures, queries by users and many others operations take a long time with a such database size.

About 6 million of compounds will be on flat files. It's why we try to find the more efficient SD reader.
HP
HP 2010-04-07
It is indeed, and I'm not going to go any further in this direction, don't worry.
However, according to Samuel, available database(s) he tried did not fulfill his requirements.
SG
SG 2010-04-07
To Pierre: I tried your protocol yesterday. I writed one very close to yours yesterday too, and the problem remains that I can't display the first N coumpounds until the file's reading is over.

The idea is to have an equivalent of a handle of file allowing to restart the file's reading from the current handle.
HP
HP 2010-04-07
Indeed, that's a limitation. Take a look at this one, it still has drawbacks, but would end right after the chunk is read. It corresponds to the idea in my very first post.

You'll save time at low indices, but at the high indices, you'll have to read the whole file unfortunately.
comment imagecomment image
SG
SG 2010-04-07
Hello,

I found a solution. I will load a cache with my SD file and use this cache as local database.

Cache reader allow the indexing of data. So I can read from compound M to compound N.

Thanks to all for your help.
HP
HP 2010-04-07
Brilliant! I'd be curious to know about the size of the cache file.
Thanks for the tip.
HP
HP 2010-04-07
I ran some benchmark.
12.48M compounds - no data - from pubchem stored in 54 min, cache automatically splits into 9 files (976Mo each) plus index 221Mo. Loading procedure required 7 min per file, it doesn't seem to slow down.

Extracting 100 records starting at index
1,000: 1 sec
10,000: 1 sec
100,000: 1 sec
1,000,000: 1 sec
10,000,000: 1 sec

Retrieve a compound is more expensive using join from cache: looking for cid '20' takes 17 sec before this: "No more memory is available: 20971520 objects of size 4 requested". PP tries to read the whole cache in memory.