Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
python_one_week_4_biologists_solutions
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
hub-courses
python_one_week_4_biologists_solutions
Commits
a5c2a361
Verified
Commit
a5c2a361
authored
6 years ago
by
Bertrand NÉRON
Browse files
Options
Downloads
Patches
Plain Diff
add2nd implementation for one_enz_all_binding_sites
parent
779fff97
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/_static/code/restriction.py
+22
-0
22 additions, 0 deletions
source/_static/code/restriction.py
with
22 additions
and
0 deletions
source/_static/code/restriction.py
+
22
−
0
View file @
a5c2a361
...
...
@@ -30,6 +30,28 @@ def one_enz_all_binding_sites(dna, enzyme):
return
positions
def
one_enz_all_binding_sites2
(
dna
,
enzyme
):
"""
:param dna: the dna sequence to search enzyme binding sites
:type dna: str
:param enzyme: the enzyme to looking for
:type enzyme: a namedtuple RestrictEnzyme
:return: all positions of enzyme binding sites in dna
:rtype: list of int
"""
positions
=
[]
pos
=
dna
.
find
(
enzyme
.
sequence
)
while
pos
!=
-
1
:
if
positions
:
positions
.
append
(
pos
)
else
:
positions
=
pos
+
positions
[
-
1
]
new_seq
=
dna
[
pos
+
1
:]
pos
=
new_seq
.
find
(
enzyme
.
sequence
)
pos
=
pos
return
positions
def
binding_sites
(
dna
,
enzymes
):
"""
return all positions of all enzymes binding sites present in dna
...
...
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