I'm trying to write a program that can analyse Mass Spectrometry .mzml
files for my Chemistry project at university. I'm new to programming. I have some code that allows the user to browse a file, but the code only prints the file path.
import Tkinter
import tkFileDialog
def main():
Tkinter.Tk().withdraw()
in_path = tkFileDialog.askopenfilename(filetypes=[("mzml file","*.mzML")])
print in_path
if __name__ == "__main__":
main()
How would I change it so that the file chosen is imported into the code and is able to be read so that I can take information from it (Mass spectra, chromatograms and the like)?
filepath
is the file-browser file. I want to import the file into something like this using PyOpenMS package:
import pyopenms
from pyopenms import *
import numpy as np
import filepath
filepath.main()
exp = pyopenms.MSExperiment()
pyopenms.MzMLFile().load('**in_path**', exp)
I know that trying to load in_path
is wrong, but I'm not sure what to put!