Closed Kzra closed 3 years ago
If a path is specified it will try to open an existing db file
add this line after the imports
MSParameters.molecular_search.url_database = None
This will start a new db under ./db/molformula.db (it is a relative path, so this will be created related from where you are executing your script). The software automatically generates the molecular formula db based on your parameters.
Please make sure to check your other parameters under MSParameters class
You can see more examples here:
https://github.com/EMSL-Computing/CoreMS/tree/master/examples/scripts
Thank you, that makes sense. I added the line and the code now runs fine.
Running this code in corems 1.18:
from corems.transient.input.brukerSolarix import ReadBrukerSolarix
from corems.molecular_id.search.molecularFormulaSearch import SearchMolecularFormulas
file_path= 'Ezra MS 060532_000005.d srfa iii/'
bruker_reader = ReadBrukerSolarix(file_path)
bruker_transient_obj = bruker_reader.get_transient()
mass_spectrum_obj = bruker_transient_obj.get_mass_spectrum(plot_result=False, auto_process=True)
SearchMolecularFormulas(mass_spectrum_obj, first_hit=True).run_worker_mass_spectrum()
Gives the following error:
I checked the url for the SQL database using
from corems.encapsulation.factory.parameters import MSParameters
MSParameters.molecular_search.url_database
the database is given as
'sqlite:///db/molformula.db'
this looks like a relative path to the db folder of CoreMS. However when I checked the path there is no molformula.db present. Is this a mistake or am I missing a step?