bridgedb / create-bridgedb-metabolites

Create BridgeDb identity mapping files from HMDB, ChEBI, and Wikidata
Other
4 stars 4 forks source link

Update createDerby.groovy for BioDataSources #14

Open DeniseSl22 opened 5 years ago

DeniseSl22 commented 5 years ago

See line https://github.com/bridgedb/create-bridgedb-hmdb/blob/master/createDerby.groovy#L46 for example..... I'm not sure why the datasource has to be created; If I look in https://github.com/bridgedb/BridgeDb/blob/929de3bbd428c4f45b8c442d2d83d37649b3ad96/org.bridgedb.bio/src/org/bridgedb/bio/BioDataSource.java#L73, Chemspider is already present. Then why do we have to invoke the datasource again?

egonw commented 5 years ago

Not all data sources have a field, like in this code: casDS = BioDataSource.CAS. These fields are basically predefined instances of the class DataSource. If there is no such field, then it needs to be creates on the fly. That explain line 46.

I think CHEMSPIDER did not exist in that class as field when I wrote one of the earlier versions of the createDerby.groovy script and I did not want to wait for the next BridgeDb release?

BTW, the "again" in the last sentence is not really again... it actually creates a new object instance of that class, but it will be considered the same because the name and the syscode are the same.

DeniseSl22 commented 5 years ago

Okay that clears that up.... so, when you make a new bridgedb release, I can update the createDerby code as well? Then all the newly added databases should exist as predefined instances right?