annotate design_primers.py @ 6:f201e8c6e004 draft default tip

Uploaded
author ben-warren
date Mon, 07 Jul 2014 19:28:17 -0400
parents b321e0517be3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
1
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
2 #!/usr/bin/env python
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
3 ##design primers to features in multiple sequences, with option to predict melting
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
4 #usage: design_HRM_primers.py [-h] -i IN_FILE -g GFF_FILE -T TARGET_FILE [-u]
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
5 # [-n MAX_PRIMERS] [-p PROD_MIN_SIZE]
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
6 # [-P PROD_MAX_SIZE] [-l OPT_PRIMER_LENGTH]
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
7 # [-m MAX_TM_DIFF] [-t OPTIMUM_TM]
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
8 # [-G OPT_GC_PERCENT] [-x MAXPOLYX] [-c GC_CLAMP]
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
9
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
10 #Copyright 2013 John McCallum & Susan Thomson
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
11 #New Zealand Institute for Plant and Food Research
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
12 #This program is free software: you can redistribute it and/or modify
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
13 # it under the terms of the GNU General Public License as published by
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
14 # the Free Software Foundation, either version 3 of the License, or
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
15 # (at your option) any later version.
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
16 #
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
17 # This program is distributed in the hope that it will be useful,
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
20 # GNU General Public License for more details.
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
21 #
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
22 # You should have received a copy of the GNU General Public License
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
23 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
24
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
25 import os
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
26 import StringIO
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
27 import re
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
28 import copy
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
29 import sys
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
30 from BCBio import GFF
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
31 from BCBio.GFF import GFFExaminer
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
32 from Bio import SeqIO
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
33 import run_p3 as P3
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
34 #import umelt_service as umelts
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
35 import argparse
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
36
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
37 ##Primer3 defaults or additional options defined as dictionary
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
38 def_dict={
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
39 'PRIMER_MIN_SIZE':'18',
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
40 'PRIMER_MAX_SIZE':'25',
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
41 'PRIMER_MAX_NS_ACCEPTED':'1'}
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
42
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
43 #parse arguments
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
44 parser = argparse.ArgumentParser(description='Primer set design and melt prediction parameters')
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
45 parser.add_argument('-i', type=argparse.FileType('r'), help="input sequence file, required", dest='in_file', required=True)
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
46 parser.add_argument('-g', type=argparse.FileType('r'), help="input gff file with SNP and indels, required", dest='gff_file', required=True)
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
47 parser.add_argument('-T', type=argparse.FileType('r'), help="input target SNP file, required", dest='target_file', required=True)
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
48 parser.add_argument('-u',help="do uMelt prediction, optional", dest='run_uMelt',action='store_true', default=False )
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
49 parser.add_argument('-n', type=int, help="maximum number of primer pairs to return, default=5", dest='max_primers', default=5) ## PRIMER_NUM_RETURN
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
50 parser.add_argument('-p', type=int, help="minimum product size", dest='prod_min_size', default=100) ## PRIMER_PRODUCT_SIZE_RANGE min
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
51 parser.add_argument('-P', type=int, help="maximum product size", dest='prod_max_size', default=300) ## PRIMER_PRODUCT_SIZE_RANGE max
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
52 parser.add_argument('-l', type=int, help="optimum primer length", dest='opt_primer_length', default=20) ## PRIMER_OPT_SIZE
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
53 parser.add_argument('-m', type=int, help="maximum tm difference between primers", dest='max_tm_diff', default=1) ## PRIMER_PAIR_MAX_DIFF_TM
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
54 parser.add_argument('-t', type=int, help="optimum Tm for primers, recommend range 59 to 61", dest='optimum_tm', default=59) ## PRIMER_OPT_TM
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
55 parser.add_argument('-G', type=int, help="optimum GC percentage of primers", dest='opt_GC_percent', default=50) ## PRIMER_OPT_GC_PERCENT
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
56 parser.add_argument('-x', type=int, help="maximum polyx, recommend less than 4", dest='maxpolyx', default=3) ## PRIMER_MAX_POLY_X
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
57 parser.add_argument('-c', type=int, help="number of C/Gs at end, recommend 2", dest='gc_clamp', default=1) ## PRIMER_GC_CLAMP
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
58
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
59 parser.add_argument('-e', type=int, help="maximum allowable 3'-anchored complementarity", dest='maxselfend', default=3) ## PRIMER_MAX_SELF_END
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
60 parser.add_argument('-a', type=int, help="maximum complementarity between left and right or self", dest='maxselfany', default=8) ## PRIMER_MAX_SELF_ANY
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
61 parser.add_argument('-maxgc', type=float, help="Maximum allowable percentage of Gs and Cs in any primer.", dest='maxgc', default=80.0) ## PRIMER_MAX_GC
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
62 parser.add_argument('-mingc', type=float, help="Minimum allowable percentage of Gs and Cs in any primer.", dest='mingc', default=20.0) ## PRIMER_MIN_GC
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
63
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
64
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
65 parser.add_argument('-d', type=str, help="variant indentifier delimiter, used to separate sequence ID from rest ", dest='target_delim', default=':')
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
66 try:
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
67 my_args = parser.parse_args()
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
68 except SystemExit:
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
69 print("\nOops, an argument is missing/invalid, exiting...\n")
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
70 sys.exit(0)
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
71
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
72 ##update from args. NEEDS TO BE FINISHED
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
73 productsizerange = str(my_args.prod_min_size) + "-" + str(my_args.prod_max_size)
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
74 def_dict['PRIMER_PRODUCT_SIZE_RANGE']=productsizerange
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
75 def_dict['PRIMER_NUM_RETURN']=str(my_args.max_primers +1)
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
76 def_dict['PRIMER_OPT_SIZE']=str(my_args.opt_primer_length)
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
77 def_dict['PRIMER_PAIR_MAX_DIFF_TM']=str(my_args.max_tm_diff)
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
78 def_dict['PRIMER_OPT_TM']=str(my_args.optimum_tm)
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
79 def_dict['PRIMER_OPT_GC_PERCENT']=str(my_args.opt_GC_percent)
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
80 def_dict['PRIMER_MAX_POLY_X']=str(my_args.maxpolyx)
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
81 def_dict['PRIMER_GC_CLAMP']=str(my_args.gc_clamp)
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
82
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
83 def_dict['PRIMER_MAX_SELF_END']=str(my_args.maxselfend)
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
84 def_dict['PRIMER_MAX_SELF_ANY']=str(my_args.maxselfany)
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
85 def_dict['PRIMER_MAX_GC']=str(my_args.maxgc)
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
86 def_dict['PRIMER_MIN_GC']=str(my_args.mingc)
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
87
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
88
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
89
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
90 ##conditional import of umelt
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
91 if my_args.run_uMelt:
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
92 import umelt_service as umelts
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
93
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
94 #open input files
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
95
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
96 targets=my_args.target_file.readlines()
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
97 my_args.target_file.close()
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
98 ##and create a hit list of sequences from this
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
99 target_seq_id_list = [re.split(my_args.target_delim,X)[0] for X in targets] ## target_delimiter defaults to ':' e.g. ABC:SNP:SAMTOOL:1234
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
100
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
101 ##print header
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
102 print "SNP_Target_ID", "Position","Ref_base","Variant_base" ,"Amplicon_bp","PRIMER_LEFT_SEQUENCE",'PRIMER_RIGHT_SEQUENCE', "ref_melt_Tm","var_melt_Tm","Tm_difference"
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
103 ##create iterator returning sequence records
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
104 for myrec in SeqIO.parse(my_args.in_file, "fasta"):
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
105 #check if this sequence is included in the target list
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
106 if myrec.id in target_seq_id_list:
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
107 ##create sequence dictionary so we can add in gff annotations
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
108 seq_dict = {myrec.id : myrec}
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
109 ##just limit to gff annotations for this sequence
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
110 limit_info = dict(gff_id = [ myrec.id ])
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
111 ##rewind gff filehandle
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
112 my_args.gff_file.seek(0)
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
113 ##read annotations into sequence dictionary for this sequence record only
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
114 annotations = [r for r in GFF.parse(my_args.gff_file, base_dict=seq_dict,limit_info=limit_info)]
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
115 ##if there are any annotations, then proceed.
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
116 if annotations:
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
117 rec=annotations[0]
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
118 ##iterate over list of target IDs
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
119 for t in targets:
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
120 target_ID = t.strip('\n')
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
121 target_annotations = [f for f in rec.features if f.id == target_ID ]
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
122 if target_annotations:
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
123 mytarget = target_annotations[0]
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
124 #just consider slice of sequence in a window of +/- prod_max_size bp
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
125 ##from feature UNLESS feature is close to end
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
126 ##Note that slice is zero-based
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
127 featLocation = mytarget.location.start.position
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
128 if featLocation > my_args.prod_max_size:
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
129 slice_start = featLocation - my_args.prod_max_size
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
130 featPosition = my_args.prod_max_size
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
131 else:
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
132 slice_start = 0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
133 featPosition = featLocation
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
134 if (len(rec) - featLocation) < my_args.prod_max_size:
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
135 slice_end = len(rec)
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
136 else:
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
137 slice_end = featLocation + my_args.prod_max_size
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
138 ###grab slice of sequence fom this window.
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
139 targetRec = rec[slice_start:slice_end]
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
140 matching_feature = [f for f in targetRec.features if f.id == mytarget.id]
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
141 if matching_feature:
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
142 target_feat = matching_feature[0]
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
143 my_target_dict={} # re-initialize target dictionary
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
144 if target_feat.location.start.position == 0:
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
145 target_feat.location.start.position = 1
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
146 #get the mask features by removing target...all features are masked as just using snp and indels, a smarter filter could be added
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
147 exclude_feat = list(targetRec.features) ##list copy to avoid possible side-effects
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
148 exclude_feat.remove(target_feat)
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
149 excludes_str=' '.join([str(x.location.start.position)+','+str(x.location.end.position -x.location.start.position) for x in exclude_feat])
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
150 my_target_dict={'SEQUENCE_ID' : rec.name, 'SEQUENCE_TEMPLATE': targetRec.seq.tostring(),'SEQUENCE_TARGET': str(target_feat.location.start.position) + ',1','SEQUENCE_INTERNAL_EXCLUDED_REGION': excludes_str}
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
151 my_target_dict.update(def_dict) ##add in defaults
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
152 result=P3.run_P3(target_dict=my_target_dict)
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
153 if my_args.run_uMelt:
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
154 amp_seq=targetRec.seq ##need to make this conditional on getting a result >0 and melt=True
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
155 mutamp_seq=targetRec.seq.tomutable()
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
156 mutamp_seq[target_feat.location.start:target_feat.location.end]=target_feat.qualifiers['Variant_seq'][0] #mutate to variant
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
157 for primerset in result:
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
158 amp_start=int(primerset['PRIMER_LEFT'].split(',')[0])
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
159 amp_end=int(primerset['PRIMER_RIGHT'].split(',')[0])
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
160 ref_melt_Tm=0
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
161 var_melt_Tm=0
6
f201e8c6e004 Uploaded
ben-warren
parents: 5
diff changeset
162 diff_melt=0
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
163 if my_args.run_uMelt:
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
164 try:
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
165 ref_melt_Tm=umelts.getTm(umelts.getmelt(amp_seq.tostring()[amp_start:amp_end+1]))
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
166 var_melt_Tm=umelts.getTm(umelts.getmelt(mutamp_seq.tostring()[amp_start:amp_end+1]))
6
f201e8c6e004 Uploaded
ben-warren
parents: 5
diff changeset
167 diff_melt=abs(ref_melt_Tm - var_melt_Tm)
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
168 except:
6
f201e8c6e004 Uploaded
ben-warren
parents: 5
diff changeset
169 ref_melt_Tm="NA" ##preferably something more informative?
f201e8c6e004 Uploaded
ben-warren
parents: 5
diff changeset
170 var_melt_Tm="NA" ##exception handling to be added
f201e8c6e004 Uploaded
ben-warren
parents: 5
diff changeset
171 diff_melt="NA"
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
172 reference_seq=target_feat.qualifiers['Reference_seq'][0]
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
173 if target_feat.qualifiers.has_key('Variant_seq'):
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
174 variant_seq=target_feat.qualifiers['Variant_seq'][0]
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
175 else:
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
176 variant_seq="NA"
6
f201e8c6e004 Uploaded
ben-warren
parents: 5
diff changeset
177 print mytarget.id, featLocation + 1 ,reference_seq, variant_seq,amp_end-amp_start,primerset['PRIMER_LEFT_SEQUENCE'],primerset['PRIMER_RIGHT_SEQUENCE'], ref_melt_Tm,var_melt_Tm,diff_melt#, amp_seq.tostring()[amp_start:amp_end+1], mutamp_seq.tostring()[amp_start:amp_end+1]
0
21053f7f9ed1 First upload of PCR Marker tools
john-mccallum
parents:
diff changeset
178
5
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
179 my_args.gff_file.close()
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
180 my_args.in_file.close()
b321e0517be3 Uploaded
ben-warren
parents: 0
diff changeset
181