Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PeakStrainer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
labShevchenko
PeakStrainer
Commits
905df17d
Commit
905df17d
authored
5 years ago
by
mirandaa
Browse files
Options
Downloads
Patches
Plain Diff
feat: check all the files
parent
ae07740c
Branches
miranda
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/reorderScans/reorderScans.py
+10
-22
10 additions, 22 deletions
lib/reorderScans/reorderScans.py
with
10 additions
and
22 deletions
lib/reorderScans/reorderScans.py
+
10
−
22
View file @
905df17d
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment