-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpcr_algorit.py
More file actions
43 lines (37 loc) · 2.03 KB
/
Copy pathpcr_algorit.py
File metadata and controls
43 lines (37 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
'''Design PCR primers with primer3-py'''
import primer3
from Bio import SeqIO
record = SeqIO.read('eln_raton.fasta', 'fasta')
sequence = str(record.seq)
print(f'Template: {record.id}, {len(sequence)}bp')
result = primer3.design_primers(
seq_args={'SEQUENCE_TEMPLATE': sequence, 'SEQUENCE_ID': record.id},
global_args={
'PRIMER_PRODUCT_SIZE_RANGE': [[150, 300]], # Standard PCR range; adjust for qPCR (70-150) or cloning (500+).
'PRIMER_NUM_RETURN': 10,
'PRIMER_OPT_TM': 60.0, # Industry standard optimal Tm per primer3/IDT recommendations.(60)
'PRIMER_MIN_TM': 57.0, # Allows +/-3C from optimal; tighter range improves specificity.(57)
'PRIMER_MAX_TM': 63.0,
'PRIMER_MIN_GC': 45.0, # 40-60% GC ensures balanced primer stability and specificity.
'PRIMER_MAX_GC': 55.0,
}
)
num_returned = result['PRIMER_PAIR_NUM_RETURNED']
print(f'\nFound {num_returned} primer pairs:\n')
for i in range(num_returned):
left_seq = result[f'PRIMER_LEFT_{i}_SEQUENCE']
right_seq = result[f'PRIMER_RIGHT_{i}_SEQUENCE']
left_tm = result[f'PRIMER_LEFT_{i}_TM']
right_tm = result[f'PRIMER_RIGHT_{i}_TM']
left_pos = result[f'PRIMER_LEFT_{i}']
right_pos = result[f'PRIMER_RIGHT_{i}']
product_size = result[f'PRIMER_PAIR_{i}_PRODUCT_SIZE']
penalty = result[f'PRIMER_PAIR_{i}_PENALTY'] #puntuacion de error mas cerca a 0 es mejor
print(f'Pair {i+1} (penalty: {penalty:.2f})')
print(f' Forward: {left_seq}')
print(f' Position: {left_pos[0]}, Length: {left_pos[1]}, Tm: {left_tm:.1f}C')
print(f' Reverse: {right_seq}')
print(f' Position: {right_pos[0]}, Length: {right_pos[1]}, Tm: {right_tm:.1f}C')
print(f' Product size: {product_size}bp\n')# This script designs PCR primers using the primer3 library. It reads a DNA sequence from a FASTA file,
# sets specific parameters for primer design, and outputs the designed primer pairs along with their properties.
######VERIFICAR EL PRIMER BLAST EN NCBI############### SIEMPRE