/// <summary> /// Compute overlap's hairpin melting temperature. /// </summary> /// <returns>Hairpin melting temperature.</returns> private double GetHairpinTemperature() { double T = 0.0; String upper = this.Sequence.ToString().ToUpper(); Thermodynamics.thal_results results = new Thermodynamics.thal_results(); Thermodynamics.p3_thal_args args = this.Settings.ThalHairpinSettings; Thermodynamics.p3_thal(upper, upper, ref args, ref results); T = results.temp; return T; }
/// <summary> /// Compute overlap's duplex melting temperature. /// </summary> /// <returns>Duplex melting temperature.</returns> public double GetDuplexTemperature(Overlap twin) { double T = 0.0; String upper = this.Sequence.ToString().ToUpper(); String upperTwin = twin.Sequence.ToString().ToUpper(); Thermodynamics.thal_results results = new Thermodynamics.thal_results(); Thermodynamics.p3_thal_args args = this.Settings.ThalSettings; Thermodynamics.p3_thal(upper, upperTwin, ref args, ref results); T = results.temp; return T; }
/// <summary> /// Construct initialization. /// </summary> /// <param name="fragList">Fragment list.</param> /// <param name="maxOverlapLen">Minimum overlap length.</param> private void Init(ObservableCollection<Fragment> fragList, DesignerSettings settings) { this.Overlaps = new List<Overlap>(); this.Settings = settings; Thermodynamics.thal_results results = new Thermodynamics.thal_results(); Thermodynamics.p3_get_thermodynamic_values(Settings.TmThalParamPath, ref results); String message = new String(results.msg); message = message.Trim('\0'); if (!String.IsNullOrEmpty(message)) { throw new TmThalParamException(message); } //forward String seq_5 = ""; String seq_3 = ""; String name = ""; List<MiscFeature> featList = new List<MiscFeature>(); int pairIndex; int len_5; int len_3; for (int i = 0; i < fragList.Count; i++) { name += fragList[i].Name; seq_3 = fragList[i].GetString(); len_5 = Math.Min(settings.MaxLen_5, seq_5.Length); len_3 = Math.Min(settings.MaxLen_3, seq_3.Length); String overhang_5 = seq_5.Substring(seq_5.Length - len_5, len_5); String geneSpecific_3 = seq_3.Substring(0, len_3); String loc = (seq_5.Length + 1).ToString() + ".." + (seq_5.Length + seq_3.Length).ToString(); MiscFeature gene = new MiscFeature(loc); gene.StandardName = fragList[i].Name; featList.Add(gene); seq_5 += seq_3; if (i == 0) { pairIndex = fragList.Count; Overlaps.Add(new Overlap(Designer.VectorLabel + fragList[i].Name + "-fwd", new Sequence(Alphabets.AmbiguousDNA, geneSpecific_3), settings.TmThalSettings, pairIndex)); } else { pairIndex = 2 * fragList.Count - i; Overlaps.Add(new Overlap(fragList[i].Name + "-fwd", new Sequence(Alphabets.AmbiguousDNA, overhang_5), new Sequence(Alphabets.AmbiguousDNA, geneSpecific_3), settings.TmThalSettings, pairIndex)); } } this.Sequence = new Sequence(Alphabets.AmbiguousDNA, seq_5); //meta GenBankMetadata meta = new GenBankMetadata(); meta.Locus = new GenBankLocusInfo(); meta.Locus.MoleculeType = MoleculeType.DNA; meta.Locus.Name = name; meta.Locus.Date = System.DateTime.Now; meta.Locus.SequenceLength = seq_5.Length; meta.Comments.Add("designed with mufasa"); meta.Definition = "synthetic construct"; meta.Features = new SequenceFeatures(); meta.Features.All.AddRange(featList); this.Sequence.Metadata.Add("GenBank", meta); //reverse fragList.Add(new Fragment(fragList[0])); fragList.RemoveAt(0); seq_5 = ""; seq_3 = ""; for (int i = fragList.Count - 1; i >= 0; i--) { seq_5 = fragList[i].GetReverseComplementString(); len_5 = Math.Min(settings.MaxLen_5, seq_3.Length); len_3 = Math.Min(settings.MaxLen_3, seq_5.Length); String overhang_5 = seq_3.Substring(seq_3.Length - len_5, len_5); String geneSpecific_3 = seq_5.Substring(0, len_3); seq_3 += seq_5; if (i == fragList.Count - 1) { pairIndex = 0; Overlaps.Add(new Overlap(Designer.VectorLabel + fragList[i].Name + "-rev", new Sequence(Alphabets.AmbiguousDNA, geneSpecific_3), settings.TmThalSettings, pairIndex)); } else { pairIndex = i + 1; Overlaps.Add(new Overlap(fragList[i].Name + "-rev", new Sequence(Alphabets.AmbiguousDNA, overhang_5), new Sequence(Alphabets.AmbiguousDNA, geneSpecific_3), settings.TmThalSettings, pairIndex)); } } for (int i = 0; i < fragList.Count; i++) { //Duplex melting temperatures Overlaps[i].HeterodimerMeltingTemperature = Overlaps[i].GetDuplexTemperature(Overlaps[Overlaps[i].PairIndex]); } }