def ptpx_foot(seq,min_pt,max_pt,min_px,max_px,max_e,direction,pt_min_tm,pt_max_tm, px_min_tm, px_max_tm,pt_foot_conc,px_foot_conc): # to get list of the pt and px foot based on the input sequence, pt,px length limit and gap length limit monovalent_conc=1000 divalent_conc=0 dNTP_conc=0.00008 pt_foot_conc=pt_foot_conc*1000000000 px_foot_conc=px_foot_conc*1000000000 gactc_start=[i - 1 for i in range(len(seq)) if seq.startswith('GACTC', i - 1) or seq.startswith('GAGTC', i - 1)] s=set([]) seq_len=len(seq) for i in range(seq_len): #start for j in range(int(min_pt),int(max_pt)): #pt foot length pt_tm=TmDeltaG.calTm(get_foot(seq,i,i+j,direction), revcomp(get_foot(seq,i,i+j,direction)), monovalent_conc, divalent_conc, pt_foot_conc, dNTP_conc) # mono, div, and dNTP using mM, oligo_conc, oligo_conc nM if pt_tm>pt_min_tm and pt_tm<pt_max_tm: for h in range(0,max_e): #gap for p in range(int(min_px),int(max_px)): #px length px_tm=TmDeltaG.calTm(get_foot(seq,i,i+j,direction), revcomp(get_foot(seq,i,i+j,direction)), monovalent_conc, divalent_conc, px_foot_conc, dNTP_conc) # mono, div, and dNTP using mM, oligo_conc, oligo_conc nM if px_tm>px_min_tm and px_tm<px_max_tm: num=0 #to calculate this range covered how many gactc if gactc_start !=[]: for each_gactc_start in gactc_start: if (i<each_gactc_start) and (i+j+h+p>each_gactc_start): num=num+1; if num==0: # if none of the gactc is covered in this range if i+j+h+p<=seq_len: s.add(str(direction)+'-'+str(i)+'-'+str(i+j)+'-'+str(i+j+h)+'-'+str(i+j+h+p)) else: if i+j+h+p<=seq_len: s.add(str(direction)+'-'+str(i)+'-'+str(i+j)+'-'+str(i+j+h)+'-'+str(i+j+h+p)) return(s)
def bind_hairpin(hairpin_file,extra_base_file,template_file, feet_list, lowest_ptx_long_tm,hair_tar_max): #bind hairpin to pt foot and px foot extra_base={} template={} for record in SeqIO.parse(extra_base_file, "fasta") : extra_base[record.id]=record.seq hairpin={} for record in SeqIO.parse(hairpin_file, "fasta") : hairpin[record.id]=record.seq id2=record.id+'rev' hairpin[id2]=revcomp(str(record.seq)) for record in SeqIO.parse(template_file,"fasta"): template[record.id]=record.seq primer_set_list=[] target_seq='' for e in extra_base.keys(): #PT site extra base for e2 in extra_base.keys(): #PX site extra base for feet in feet_list: if feet.direction=='p': gap=revcomp(configure.input_seq)[feet.end_pos1:feet.start_pos2] target_seq=configure.input_seq[feet.start_pos1:feet.end_pos2] else: gap=configure.input_seq[feet.end_pos1:feet.start_pos2] target_seq=revcomp(configure.input_seq[feet.start_pos1:feet.end_pos2]) if feet.start_pos2+1==feet.end_pos1+1: gap='0' if (whether_match(extra_base[e],extra_base[e2],gap)==0): for h in hairpin.keys(): if check_binds(hairpin[h],target_seq)<hair_tar_max and check_binds(revcomp(str(hairpin[h])),target_seq)<hair_tar_max: #not too much hybrid between hairpin and target pt_long=hairpin[h]+extra_base[e]+feet.get_pt px_long=feet.get_px+extra_base[e]+revcomp(str(hairpin[h])) if TmDeltaG.calTm(pt_long,px_long)<lowest_ptx_long_tm: #ptx_command='melt.pl -n DNA -t 55 -N 1 -M 0 -C 0.000000005 '+pt_in+' '+px_in for t in template.keys(): align_tar_template=alignment.needle(revcomp(template[t]), target_seq) if check_binds(revcomp(t),target) <overhang_tar_max and align_tar_template.find('GAGTC')==-1: feet_long= PTX_long(feet,e,e2,h) primer_set= primer_set(feet, e,h,t) primer_set_list.append(primer_set)
def cal_tm_bond(tri_seq,temp_seq,C_Na,C_Mg,C_Strand): tm1 = TmDeltaG.calTm(tri_seq, temp_seq, C_Na, C_Mg,C_Strand, 0.00008) tm2 = TmDeltaG.calTm(temp_seq, temp_seq, C_Na, C_Mg,C_Strand, 0.00008) bond = str(SecStructures_jf7.SecStructures(SeqRecord(Seq(tri_seq)),SeqRecord(Seq(temp_seq)))).split()[0] r=[tm1,tm2,bond] return r