foldcomp icon indicating copy to clipboard operation
foldcomp copied to clipboard

`foldcomp.open` - return empty structure string if structure is not found in database

Open valentynbez opened this issue 3 months ago • 0 comments

https://github.com/steineggerlab/foldcomp/blob/b97c193e3029d861b6ca6b7c2970b562b779a4de/foldcomp/foldcomp.cxx#L333-L434

Current behaviour

Currently, there is no way to programmatically capture missing ids via Python interface. The missing ids are printed into non-capturable stderr .This would be a useful feature, as it will allow to troubleshoot problems. As error might indeed not be the best solution, I think it will be great if missing id's were still returned, but with an empty structure string.

ids = ["valid", "invalid"]
with foldcomp.open(database_path, ids=ids) as db:
    print("Here!") 
    for idx, pdb in db:
        print(idx, pdb)
Skipping entry invalid which is not in the database.
Here! 
valid {pdb_string}

Proposed behaviour

ids = ["invalid"]
with foldcomp.open(database_path, ids=ids) as db:
    print("Here!")
    for idx, pdb in db:
        print(idx, pdb)
Here!
valid {pdb_string}
invalid 

valentynbez avatar Apr 01 '24 12:04 valentynbez