Skip to content
Snippets Groups Projects
Commit 905df17d authored by mirandaa's avatar mirandaa
Browse files

feat: check all the files

parent ae07740c
Branches miranda
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ import xml.etree.ElementTree as ET ...@@ -9,6 +9,7 @@ import xml.etree.ElementTree as ET
import os import os
import re import re
import copy import copy
import re
def main(folderpath = None): def main(folderpath = None):
app = wx.App(False) app = wx.App(False)
...@@ -16,40 +17,27 @@ def main(folderpath = None): ...@@ -16,40 +17,27 @@ def main(folderpath = None):
frame.Show(True) frame.Show(True)
app.MainLoop() app.MainLoop()
def getScanHeaders(filePath): def getScanHeaders(files):
# TODO:handle different namespaces of mzxml filterlines = []
namespaces = {'xmlns': 'http://sashimi.sourceforge.net/schema_revision/mzXML_3.0'} for f in files:
ET.register_namespace('', 'http://sashimi.sourceforge.net/schema_revision/mzXML_3.0') with open(f,'r') as file:
tree = ET.parse(filePath) matches = re.findall(' filterLine="(.*?)" ', file.read())
filterlines.extend(matches)
scanElems = tree.findall('.//xmlns:scan', namespaces) return list(set(filterlines))
scans = []
for scan in scanElems:
# scanNo = int(scan.attrib['num'])
# scanNo = scan.attrib['num'].zfill(5)
# scan number ges confused with other values so its not good
# maybe add zerowidth space to solve '\u200b'
filterLine = scan.attrib['filterLine']
scans.append(filterLine)
return scans
def getMZXMLFiles(folderPath): def getMZXMLFiles(folderPath):
result = [] result = []
for file in os.listdir(folderPath): for file in os.listdir(folderPath):
if file.lower().endswith(".mzxml"): if file.lower().endswith(".mzxml"):
result.append(os.path.join(folderPath, file)) result.append(os.path.join(folderPath, file))
return result
return result
def getSourceList(folderPath): def getSourceList(folderPath):
sourceList = [] sourceList = []
files = getMZXMLFiles(folderPath) files = getMZXMLFiles(folderPath)
first = files[0] scans = getScanHeaders(files)
scans = getScanHeaders(first)
select = set() select = set()
containsMS = False containsMS = False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment