Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MIT_MAHE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
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
2022 Competition
Software Tools
MIT_MAHE
Commits
c8e2d069
Commit
c8e2d069
authored
2 years ago
by
Ashrith Sagar Yedlapalli
Browse files
Options
Downloads
Patches
Plain Diff
c0.15.23
parent
2b605d34
No related branches found
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
pep_mod.py
+18
-18
18 additions, 18 deletions
pep_mod.py
with
18 additions
and
18 deletions
pep_mod.py
+
18
−
18
View file @
c8e2d069
...
...
@@ -38,7 +38,7 @@ class BAlaS:
df_ddg
=
pandas
.
read_csv
(
replot_csv_file
)
df_ddg
=
df_ddg
[[
'
ResNumber
'
,
'
ResName
'
,
'
ddGs
'
]]
# print("DDG values:\n", df_ddg)
self
.
df_ddg
=
df_ddg
return
df_ddg
...
...
@@ -139,7 +139,7 @@ class mutater:
"""
groups
=
self
.
AA_GROUPS
print
(
"
G| Original sequence:
"
,
self
.
sequence
)
sequential_mutations
=
list
(
self
.
sequence
)
for
mutation
in
self
.
mutations
:
print
(
"
G| Mutation:
"
,
mutation
.
to_str
())
...
...
@@ -194,6 +194,17 @@ class mutater:
print
(
"
S| Saved sequences to
"
,
file
)
def
remove_dipeptides
(
self
):
"""
Remove dipeptides from self.sequences
"""
check_dipeptide
=
lambda
seq
:
re
.
search
(
r
"
(.)\1
"
,
str
(
seq
))
get_all_dipeptides
=
lambda
seq
:
re
.
finditer
(
r
"
(.)\1
"
,
seq
)
for
sequence
in
map
(
""
.
join
,
self
.
sequences
):
for
match
in
map
(
check_dipeptide
,
[
sequence
]):
if
not
match
:
print
(
sequence
)
def
by_intein_sequences
(
self
):
"""
[SKIPPED]
"""
...
...
@@ -343,7 +354,7 @@ def to_mut_obj(sequence, given_mutations):
def
format_input
(
contents
):
remove_new_line
=
lambda
s
:
str
(
s
).
replace
(
'
\n
'
,
''
)
sequence
=
remove_new_line
(
contents
[
0
])
given_mutations
=
contents
[
1
:]
...
...
@@ -357,7 +368,7 @@ def main():
parser
=
argparse
.
ArgumentParser
(
prog
=
'
pep_mod
'
,
description
=
'
Peptide modifications generator
'
)
parser
.
add_argument
(
'
input_file
'
,
type
=
str
,
help
=
'
Input file [.txt]
'
)
parser
.
add_argument
(
'
-o
'
,
'
--output
'
,
dest
=
'
output_file
'
,
type
=
str
,
help
=
'
Output filename
'
)
parser
.
add_argument
(
'
-d
'
,
'
--dipeptide
'
,
action
=
'
store
'
,
help
=
'
Dipeptides match
'
)
parser
.
add_argument
(
'
-d
'
,
'
--dipeptide
'
,
action
=
'
store
_true
'
,
help
=
'
Dipeptides match
'
)
parser
.
add_argument
(
'
-g
'
,
'
--groups
'
,
action
=
'
store_true
'
,
help
=
'
Groups filter
'
)
parser
.
add_argument
(
'
-a
'
,
'
--alaninescan
'
,
help
=
'
Alanine scan DDG results from BUDE Alanine scan
'
)
parser
.
add_argument
(
'
-l
'
,
'
--lock
'
,
type
=
str
,
dest
=
'
mutation_lock
'
,
help
=
'
Mutation lock positions
'
)
...
...
@@ -395,27 +406,16 @@ def main():
df_ddg
=
bude
.
replot_read
(
args
.
alaninescan
)
ddg_preferences
=
bude
.
replot_filter
(
1
)
# Threshold in kCal/mol
positions
=
bude
.
replot_get_positions
(
args
.
mutation_count
)
muts
=
to_mut_obj
(
sequence
,
positions
)
mutations_obj
=
mutater
(
sequence
=
sequence
,
mutations
=
muts
,
mutation_lock
=
[])
muts
=
mutations_obj
.
by_groups
()
seqs
=
mutations_obj
.
to_sequences
()
mutations_obj
.
save_sequences
(
output_file
.
replace
(
"
.txt
"
,
"
_BAlsAllSeqs.txt
"
))
if
args
.
dipeptide
:
for
seq
in
sequences
:
contents
=
[
seq
]
ddg_array
=
ddg_replot_read
(
args
.
dipeptide
)
matches
=
re
.
finditer
(
r
"
(.)\1
"
,
str
(
seq
))
# Find all dipeptides.
for
match
in
matches
:
print
(
match
)
mutations
=
dipeptide_mutater
(
seq
,
match
,
ddg_array
)
contents
.
extend
(
mutations
)
print
(
contents
)
seq
,
all_mutations
=
format_input
(
contents
)
seqs
=
groups_mutations
(
seq
,
all_mutations
)
sequences
.
extend
(
seqs
)
mutations_obj
.
remove_dipeptides
()
get_unique
=
lambda
seqs
:
list
(
dict
.
fromkeys
(
seqs
))
sequences
=
get_unique
(
sequences
)
...
...
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