Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Synthesis_Modules
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
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
Admin message
GitLab upgrade completed. Current version is 17.11.3.
Show more breadcrumbs
dnarXiv
Synthesis_Modules
Commits
c8f78cfc
Commit
c8f78cfc
authored
1 year ago
by
BOULLE Olivier
Browse files
Options
Downloads
Patches
Plain Diff
more comments
parent
520f1b35
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
primers_generation.py
+15
-9
15 additions, 9 deletions
primers_generation.py
with
15 additions
and
9 deletions
primers_generation.py
+
15
−
9
View file @
c8f78cfc
...
@@ -74,29 +74,34 @@ def select_primers(primers_list: list, number_assembly: int) -> list:
...
@@ -74,29 +74,34 @@ def select_primers(primers_list: list, number_assembly: int) -> list:
primers needs to not hybridize with each other
primers needs to not hybridize with each other
"""
"""
selected_primers_list
=
[]
selected_primers_list
=
[]
def
test_hybridation
(
primer
:
str
,
selected_primers_list
:
list
,
max_hybridisation_value
=
4
)
->
bool
:
def
test_hybridation
(
primer
:
str
,
selected_primers_list
:
list
,
max_hybridisation_value
=
4
)
->
bool
:
"""
"""
test the hybridisation of the primer with a list of other primers
test the hybridisation of the primer with a list of other primers
"""
"""
primer_rc
=
dfr
.
reverse_complement
(
primer
)
primer_rc
=
dfr
.
reverse_complement
(
primer
)
# get the reverse complement of the primer
for
selected_primer
in
selected_primers_list
:
for
selected_primer
in
selected_primers_list
:
for
i
in
range
(
len
(
primer
)
-
max_hybridisation_value
):
for
i
in
range
(
len
(
primer
)
-
max_hybridisation_value
):
# test if any part of the primer is contained in another primer from the list (= hybridisation)
if
primer
[
i
:
i
+
max_hybridisation_value
+
1
]
in
selected_primer
:
if
primer
[
i
:
i
+
max_hybridisation_value
+
1
]
in
selected_primer
:
return
False
return
False
# test also for the reverse complement
if
primer_rc
[
i
:
i
+
max_hybridisation_value
+
1
]
in
selected_primer
:
if
primer_rc
[
i
:
i
+
max_hybridisation_value
+
1
]
in
selected_primer
:
return
False
return
False
# return true if no hybridisation at all
return
True
return
True
def
compare_GC
(
primer_A
:
str
,
primer_B
:
str
)
->
bool
:
def
compare_GC
(
primer_A
:
str
,
primer_B
:
str
)
->
bool
:
"""
"""
primers have a special temperature in PCR depending on %GC, a couple (start;stop) needs to have a close tmp, so the same %GC is better
primers have a special temperature in PCR depending on %GC, a couple (start;stop) needs to have a close tmp, so the same %GC is better
return true if the %GC is the same for the 2 primers
"""
"""
start_GC
=
(
primer_A
.
count
(
"
C
"
)
+
primer_A
.
count
(
"
G
"
))
/
(
primer_A
.
count
(
"
A
"
)
+
primer_A
.
count
(
"
T
"
))
start_GC
=
(
primer_A
.
count
(
"
C
"
)
+
primer_A
.
count
(
"
G
"
))
/
(
primer_A
.
count
(
"
A
"
)
+
primer_A
.
count
(
"
T
"
))
# get the %GC of the first primer
stop_GC
=
(
primer_B
.
count
(
"
C
"
)
+
primer_B
.
count
(
"
G
"
))
/
(
primer_B
.
count
(
"
A
"
)
+
primer_B
.
count
(
"
T
"
))
stop_GC
=
(
primer_B
.
count
(
"
C
"
)
+
primer_B
.
count
(
"
G
"
))
/
(
primer_B
.
count
(
"
A
"
)
+
primer_B
.
count
(
"
T
"
))
# get the %GC of the second primer
return
start_GC
==
stop_GC
return
start_GC
==
stop_GC
...
@@ -110,19 +115,20 @@ def select_primers(primers_list: list, number_assembly: int) -> list:
...
@@ -110,19 +115,20 @@ def select_primers(primers_list: list, number_assembly: int) -> list:
# the primer must not hybridise with any previous selected primers
# the primer must not hybridise with any previous selected primers
if
test_hybridation
(
potential_stop_primer
,
selected_primers_list
,
4
):
if
test_hybridation
(
potential_stop_primer
,
selected_primers_list
,
4
):
selected_primers_list
+=
[
potential_start_primer
,
potential_stop_primer
]
# add the couple
selected_primers_list
+=
[
potential_start_primer
,
potential_stop_primer
]
# add the couple
to the list
print
(
str
(
len
(
selected_primers_list
)
//
2
)
+
"
/
"
+
str
(
number_assembly
))
print
(
str
(
len
(
selected_primers_list
)
//
2
)
+
"
/
"
+
str
(
number_assembly
))
# all required primers have been selected
#
if
all required primers have been selected
if
len
(
selected_primers_list
)
==
number_assembly
*
2
:
if
len
(
selected_primers_list
)
==
number_assembly
*
2
:
#print(selected_primers_list)
#print(selected_primers_list)
return
selected_primers_list
return
selected_primers_list
# end the script with the result
# the corresponding stop primer has been found
break
# return to start primers search
break
# return to start primers search
# not enough couple of primers found
# not enough couple of primers found
print
(
"
error in fragment design : not enough correct primers couple found, found
"
,
str
(
len
(
selected_primers_list
)),
"
but wanted
"
,
str
(
number_assembly
*
2
))
print
(
"
error in fragment design : not enough correct primers couple found, found
"
,
str
(
len
(
selected_primers_list
)),
"
but wanted
"
,
str
(
number_assembly
*
2
))
print
(
"
can be solved by using a longer random sequence in primers_generation
"
)
print
(
"
can be solved by using a longer random sequence in primers_generation
to have a longer primer list
"
)
return
selected_primers_list
return
selected_primers_list
...
...
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