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
5182562f
Commit
5182562f
authored
1 month ago
by
Bertrand NÉRON
Browse files
Options
Downloads
Patches
Plain Diff
fix the second implenetation of get_all_binding_sites
parent
dd840dd8
No related branches found
No related tags found
No related merge requests found
Pipeline
#157915
passed
1 month ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
source/_static/code/restriction.py
+23
-5
23 additions, 5 deletions
source/_static/code/restriction.py
with
23 additions
and
5 deletions
source/_static/code/restriction.py
+
23
−
5
View file @
5182562f
...
@@ -46,12 +46,15 @@ def one_enz_all_binding_sites2(dna, enzyme):
...
@@ -46,12 +46,15 @@ def one_enz_all_binding_sites2(dna, enzyme):
pos
=
dna
.
find
(
enzyme
[
2
])
pos
=
dna
.
find
(
enzyme
[
2
])
while
pos
!=
-
1
:
while
pos
!=
-
1
:
if
positions
:
if
positions
:
positions
.
append
(
pos
)
# I have to compute the reeal position
else
:
# I add the actual position + the previous one + 1 because the new sequence start a 0
positions
=
pos
+
positions
[
-
1
]
pos
=
pos
+
positions
[
-
1
]
+
1
new_seq
=
dna
[
pos
+
1
:]
positions
.
append
(
pos
)
# I start to search from the actual position to the end
# i'm searching from the next base
pos
=
pos
+
1
new_seq
=
dna
[
pos
:]
pos
=
new_seq
.
find
(
enzyme
[
2
])
pos
=
new_seq
.
find
(
enzyme
[
2
])
pos
=
pos
return
positions
return
positions
...
@@ -75,3 +78,18 @@ def binding_sites(dna, enzymes):
...
@@ -75,3 +78,18 @@ def binding_sites(dna, enzymes):
positions
.
sort
(
key
=
itemgetter
(
1
))
positions
.
sort
(
key
=
itemgetter
(
1
))
return
positions
return
positions
dna_1
=
"""
tcgcgcaacgtcgcctacatctcaagattcagcgccgagatccccgggggtt
gagcgatccccgtcagttggcgtgaattcagcagcagcgcaccccgggcgtagaattccagtt
gcagataatagctgatttagttaacttggatcacagaagcttccagaccaccgtatggatccc
aacgcactgttacggatccaattcgtacgtttggggtgatttgattcccgctgcctgccagg
"""
.
replace
(
'
\n
'
,
''
)
ecor1
=
(
"
EcoRI
"
,
"
Ecoli restriction enzime I
"
,
"
gaattc
"
,
1
,
"
sticky
"
)
ecor5
=
(
"
EcoRV
"
,
"
Ecoli restriction enzime V
"
,
"
gatatc
"
,
3
,
"
blunt
"
)
bamh1
=
(
"
BamHI
"
,
"
type II restriction endonuclease from Bacillus amyloliquefaciens
"
,
"
ggatcc
"
,
1
,
"
sticky
"
)
hind3
=
(
"
HindIII
"
,
"
type II site-specific nuclease from Haemophilus influenzae
"
,
"
aagctt
"
,
1
,
"
sticky
"
)
taq1
=
(
"
TaqI
"
,
"
Thermus aquaticus
"
,
"
tcga
"
,
1
,
"
sticky
"
)
not1
=
(
"
NotI
"
,
"
Nocardia otitidis
"
,
"
gcggccgc
"
,
2
,
"
sticky
"
)
sau3a1
=
(
"
Sau3aI
"
,
"
Staphylococcus aureus
"
,
"
gatc
"
,
0
,
"
sticky
"
)
hae3
=
(
"
HaeIII
"
,
"
Haemophilus aegyptius
"
,
"
ggcc
"
,
2
,
"
blunt
"
)
sma1
=
(
"
SmaI
"
,
"
Serratia marcescens
"
,
"
cccggg
"
,
3
,
"
blunt
"
)
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