Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 6809dd18 authored by BOULLE Olivier's avatar BOULLE Olivier
Browse files

added prints

parent 979b6eae
Branches
No related tags found
No related merge requests found
......@@ -20,8 +20,8 @@ use the dna_storage_primer_tools script from
"""
#TODO
param_file_name = "param_dnarxiv_bigBlocks"
#param_file_name = "param_dnarxiv_V2"
#param_file_name = "param_dnarxiv_bigBlocks"
param_file_name = "param_dnarxiv_V2"
def generate_compatible_primers(primer_number: int, output_primers_path=None):
......@@ -88,7 +88,7 @@ def filter_primers_with_oligos(oligo_path, input_primers_path=None, output_filte
checked_primers_dict = dict((name, primer) for name, primer in primers_dict.items() if sequence_control.sequence_check(primer)) # check for potential constraints in primers
#random.shuffle(checked_primers_list)
print(str(len(checked_primers_dict))+" primers remaining")
# save the non hybrided primers
dfr.save_dict_to_fasta(checked_primers_dict, output_filtered_primers_path)
......@@ -154,6 +154,9 @@ def get_pair_with_lowest_temp_diff(compatible_primers_list):
best_primer_couple = primer_a, primer_b
lowest_temp_diff = pair_temp_diff
if best_primer_couple == ("", ""):
print("get_pair_with_lowest_temp_diff: no compatible primer couple found")
return best_primer_couple
......@@ -186,14 +189,20 @@ def get_pair_with_closest_temp(compatible_primers_list, other_primers_dict):
best_primer_couple = primer_a, primer_b
lowest_temp_diff = pair_temp_diff
if best_primer_couple == ("", ""):
print("get_pair_with_closest_temp: no compatible primer couple found")
print(compatible_primers_list)
return best_primer_couple
def get_best_compatible_pair(source_primers_dict = None, other_primers_dict = None) -> list:
def get_best_compatible_pair(source_primers_dict = None, other_primers_dict = None, only_compatible_temp = False) -> list:
"""
select a list of primers (2 primers for each assembly)
output primers needs to not hybridize with each other
can add a dict of other primers that the result has to be compatible with
param:only_compatible_temp if you don't need to check hybridation & GC with the others primers
"""
primer_generator_dir = currentdir+"/dna-storage-primer-tools"
......@@ -205,11 +214,17 @@ def get_best_compatible_pair(source_primers_dict = None, other_primers_dict = No
compatible_primers_list = [] # list of intercompatible primers groups found
primers_keys = [] # list of primers names that do not hybridize with any of the other primers
primers_keys = [] # list of primers names that do not hybridize with any of the other previous primers
# primers_keys = [primer_name for primer_name in source_primers_dict.keys if primer_name not in other_primers_dict.keys()]
for primer_name, primer_seq in source_primers_dict.items():
if test_hybridation_and_GC(primer_seq, list(other_primers_dict.values()), 4):
if test_hybridation_and_GC(primer_seq, list(other_primers_dict.values()), 5) or only_compatible_temp:
primers_keys.append(primer_name)
if not primers_keys:
print("no compatible primer couple without hybridation found")
# get all group of primers with no inter hybridization
for index_primer, primer_name in enumerate(primers_keys):
primer_sequence = source_primers_dict[primer_name]
......@@ -226,6 +241,8 @@ def get_best_compatible_pair(source_primers_dict = None, other_primers_dict = No
if len(compatible_primers_dict) >= 2: # keep groups of at least 2 primers
compatible_primers_list.append(compatible_primers_dict)
print("compatibles lists lengths : ")
print([len(k.keys()) for k in compatible_primers_list])
if other_primers_dict == {}:
# get the pair with the closest temperature
best_primer_couple = get_pair_with_lowest_temp_diff(compatible_primers_list)
......@@ -234,6 +251,7 @@ def get_best_compatible_pair(source_primers_dict = None, other_primers_dict = No
# get the pair with the closest temperature to the other selected primers
best_primer_couple = get_pair_with_closest_temp(compatible_primers_list, other_primers_dict)
print(best_primer_couple)
selected_primers_dict = {best_primer_couple[0]:source_primers_dict[best_primer_couple[0]], best_primer_couple[1]:source_primers_dict[best_primer_couple[1]]}
return selected_primers_dict
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment