Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
abundanceparser
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
vish_joachimiak_lab
abundanceparser
Commits
a93c4ac8
Commit
a93c4ac8
authored
5 years ago
by
Vishruth Mullapudi
Committed by
Vishruth Mullapudi
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
cleaned up localization with list comprehension
parent
faba3df5
1 merge request
!1
Fix unlocalized peptide mods not adding
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
main.py
+5
-9
5 additions, 9 deletions
main.py
with
5 additions
and
9 deletions
main.py
+
5
−
9
View file @
a93c4ac8
...
...
@@ -26,7 +26,7 @@ def main():
localization_col_titles
:
Dict
[
str
,
str
]
=
dict
()
# Dict containing {fileID: column title}
localized_data
:
List
[
FileTuple
]
=
[]
use_mod_in_master_prot
=
False
# debug
#
use_mod_in_master_prot = False # debug
for
ftuple
in
data
:
if
use_mod_in_master_prot
:
file_headers_tuple
:
Tuple
[
FileTuple
,
Dict
[
str
,
str
]]
=
parsemasterlocalizations
(
ftuple
)
...
...
@@ -96,10 +96,8 @@ def parsemasterlocalizations(ftuple: FileTuple) -> Tuple[FileTuple, Dict[str, st
# force everything into string so we can make sure its not empty ("nan")
if
not
str
(
mod_string
)
==
"
nan
"
:
matches
=
re
.
finditer
(
regex
,
mod_string
)
matched_strs
=
[]
for
match_obj
in
matches
:
matched_strs
.
extend
(
match_obj
.
groups
())
localizations
.
append
(
matched_strs
)
localizations
.
append
([
int
(
mod_localization
)
for
match_obj
in
matches
for
mod_localization
in
match_obj
.
groups
()
if
mod_localization
is
not
''
])
else
:
localizations
.
append
([])
...
...
@@ -128,10 +126,8 @@ def parseprotlocalizations(ftuple: FileTuple, protein_seqrecords: list) -> Tuple
mod_string
=
row
.
modifications
if
not
str
(
mod_string
)
==
"
nan
"
:
matches
=
re
.
finditer
(
regex
,
mod_string
)
matched_strs
=
[]
for
match_obj
in
matches
:
matched_strs
.
extend
([
int
(
x
)
+
frag_index_in_prot
for
x
in
match_obj
.
groups
()
if
x
is
not
''
])
prot_localizations
.
append
(
matched_strs
)
prot_localizations
.
append
([
int
(
mod_localization
)
+
frag_index_in_prot
for
match_obj
in
matches
for
mod_localization
in
match_obj
.
groups
()
if
mod_localization
is
not
''
])
else
:
prot_localizations
.
append
([])
else
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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