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
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

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.
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.
The new PPCart handles the CAP Complete database just fine (~10M compounds).
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,
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
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.
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
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. ;-)
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.
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.
However, according to Samuel, available database(s) he tried did not fulfill his requirements.
The idea is to have an equivalent of a handle of file allowing to restart the file's reading from the current handle.
You'll save time at low indices, but at the high indices, you'll have to read the whole file unfortunately.
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.
Thanks for the tip.
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.