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
Show more breadcrumbs
dnarXiv
Synthesis_Modules
Commits
70acacdc
Commit
70acacdc
authored
2 years ago
by
BOULLE Olivier
Browse files
Options
Downloads
Patches
Plain Diff
refactors, name result file by primers
parent
4ba034e1
Branches
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
eBlock_assembly_simulation.py
+13
-7
13 additions, 7 deletions
eBlock_assembly_simulation.py
with
13 additions
and
7 deletions
eBlock_assembly_simulation.py
+
13
−
7
View file @
70acacdc
...
@@ -68,7 +68,7 @@ def assemble_blocks_simulation(eBlocks_list: list, nbr_mol: int) -> dict:
...
@@ -68,7 +68,7 @@ def assemble_blocks_simulation(eBlocks_list: list, nbr_mol: int) -> dict:
"""
"""
use the statistics of overhangs assemblies to simulation the assembly of blocks
use the statistics of overhangs assemblies to simulation the assembly of blocks
"""
"""
overhang_assembly_stats_dict
=
dfr
.
read_fasta
(
"
file_test_assembly/overhangs_stats.txt
"
)
overhang_assembly_stats_dict
=
dfr
.
read_fasta
(
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
+
"
/overhangs_eBlocks_probas.fasta
"
)
assembly_dict
=
{}
assembly_dict
=
{}
...
@@ -90,8 +90,8 @@ def assemble_blocks_simulation(eBlocks_list: list, nbr_mol: int) -> dict:
...
@@ -90,8 +90,8 @@ def assemble_blocks_simulation(eBlocks_list: list, nbr_mol: int) -> dict:
current_assembly
+=
block
[
overhang_size
:]
# link the block to the current assembly
current_assembly
+=
block
[
overhang_size
:]
# link the block to the current assembly
else
:
else
:
assembly_dict
[
"
molecule_
"
+
str
(
mol_index
)]
=
current_assembly
# the current assembly is not linked to the block, so its is completed
assembly_dict
[
"
molecule_
"
+
str
(
mol_index
)]
=
current_assembly
# the current assembly is not linked to the block, so its is completed
current_assembly
=
block
[
overhang_size
:]
# begin a new assembly starting from this block
mol_index
+=
1
mol_index
+=
1
current_assembly
=
block
[
overhang_size
:]
# begin a new assembly starting from this block
# add the assembly to the dict
# add the assembly to the dict
assembly_dict
[
"
molecule_
"
+
str
(
mol_index
)]
=
current_assembly
assembly_dict
[
"
molecule_
"
+
str
(
mol_index
)]
=
current_assembly
...
@@ -132,7 +132,7 @@ def test_assembly(input_path, output_path: str, nbr_mol: int) -> None:
...
@@ -132,7 +132,7 @@ def test_assembly(input_path, output_path: str, nbr_mol: int) -> None:
def
eBlocks_assembly
(
input_path
:
str
,
output_path
:
str
,
nbr_mol
:
int
)
->
None
:
def
eBlocks_assembly
(
input_path
:
str
,
output_
dir_
path
:
str
,
nbr_mol
:
int
)
->
None
:
"""
"""
simulate an ordered assembly of eBlocks surrounded by the primers
simulate an ordered assembly of eBlocks surrounded by the primers
the resulting molecules are saved to a .fasta file to simulate the storing
the resulting molecules are saved to a .fasta file to simulate the storing
...
@@ -145,16 +145,23 @@ def eBlocks_assembly(input_path: str, output_path: str, nbr_mol: int) -> None:
...
@@ -145,16 +145,23 @@ def eBlocks_assembly(input_path: str, output_path: str, nbr_mol: int) -> None:
exit
(
1
)
exit
(
1
)
blocks_list
=
list
(
eBlocks_dict
.
values
())
blocks_list
=
list
(
eBlocks_dict
.
values
())
# simulate removal of buffers
# simulate removal of buffers
blocks_list
=
remove_buffer
(
blocks_list
)
blocks_list
=
remove_buffer
(
blocks_list
)
# simulate bsaI digestion
# simulate bsaI digestion
blocks_list
=
digest_bsaI
(
blocks_list
)
blocks_list
=
digest_bsaI
(
blocks_list
)
start_primer
=
blocks_list
[
0
][
overhang_size
:
overhang_size
+
primer_size
]
# get the start primer
stop_primer
=
dfr
.
reverse_complement
(
blocks_list
[
-
1
][
-
overhang_size
-
primer_size
:
-
overhang_size
])
# the stop primer
# name of the output file contains the 2 primers because the sequencing file is obtained from these primers
output_file_path
=
os
.
path
.
join
(
output_dir_path
,
start_primer
+
"
_
"
+
stop_primer
+
"
.fasta
"
)
# simulation assembly by overhangs, fatal error if overhangs are not compatibles for successive blocks
# simulation assembly by overhangs, fatal error if overhangs are not compatibles for successive blocks
#assembly_dict = assemble_blocks(blocks_list)
#assembly_dict = assemble_blocks(blocks_list)
assembly_dict
=
assemble_blocks_simulation
(
blocks_list
,
nbr_mol
)
assembly_dict
=
assemble_blocks_simulation
(
blocks_list
,
nbr_mol
)
# save the assemblies into file
# save the assemblies into file
dfr
.
save_dict_to_fasta
(
assembly_dict
,
output_path
)
dfr
.
save_dict_to_fasta
(
assembly_dict
,
output_
file_
path
)
...
@@ -165,8 +172,7 @@ def container_assembly(input_dir_path, output_dir_path, nbr_mol):
...
@@ -165,8 +172,7 @@ def container_assembly(input_dir_path, output_dir_path, nbr_mol):
if
os
.
path
.
isdir
(
file_path
):
if
os
.
path
.
isdir
(
file_path
):
input_file
=
file_path
+
"
/5_blocks_buffer.fasta
"
input_file
=
file_path
+
"
/5_blocks_buffer.fasta
"
output_file
=
os
.
path
.
join
(
output_dir_path
,
filename
+
"
.fasta
"
)
eBlocks_assembly
(
input_file
,
output_dir_path
,
nbr_mol
)
eBlocks_assembly
(
input_file
,
output_file
,
nbr_mol
)
# =================== main =======================#
# =================== main =======================#
...
...
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