michaelmarty / UniDec

Universal Deconvolution of Mass and Ion Mobility Spectra
Other
60 stars 18 forks source link

Use command line to process the entire process #97

Open cctsou opened 1 month ago

cctsou commented 1 month ago

Hi,

I am trying to run UniDec with command lines to process hundreds of Thermo raw files. Using the GUI, a Thermo raw file is automatically converted into text file when I open it using GUI. Is is possible to run this file conversion step from command line instead of using the GUI? Here is the output message shown below after opening the raw file from GUI.

Opening:  test.raw
Opening File:  C:\IMS\Test\test.raw
Output Directory: C:\IMS\Test\test_unidecfiles
Launching Thermo Importer. If it fails after this step, try this:
Delete your whole UniDec folder but keep the zip file.
Right click on the zip file and open properties. You should see a box to Unblock it. Check that.
Click ok. Unzip it again. Try it once more.
Reading Thermo Data: C:\IMS\Test\test.raw 
michaelmarty commented 1 month ago

Hi @cctsou! You can definitely do this. Try some code like this:

from unidec.modules.thermo_reader.ThermoImporter import ThermoDataImporter as TI path = "C:\Data\file.raw" ti = TI(path) data = ti.get_data()

There are other ways to do it, but this is probably the easiest. There are lot of import options that you can use too. Let me know what questions you have. Thanks!

michaelmarty commented 3 weeks ago

To get the data written to a text file, you can use numpy.savetxt or other output functions.

There's also a more sophisticated way, where you open up a UniDec engine and open the data there. Take a look here (https://github.com/michaelmarty/UniDec?tab=readme-ov-file#getting-started-with-unidec-in-python) to see an example. I will automatically save the files for you. Thanks, MTM