/// <summary> /// Pre-optimized Construct constructor. /// </summary> /// <param name="fragList">Fragment list.</param> public Construct(List<Overlap> overlaps, ISequence sequence, DesignerSettings settings) : base() { this.Overlaps = overlaps; this.Sequence = sequence; this.Settings = settings; }
/// <summary> /// Overlap optimizer constructor. /// </summary> /// <param name="construct">A construct to assemble.</param> public OverlapOptimizer(Construct construct, DesignerSettings settings) { this.Construct = construct; this.Templates = new List<Overlap>(); foreach (Overlap o in this.Construct.Overlaps) { this.Templates.Add(new Overlap(o)); } this.Settings = settings; this.leaBestAcrossGenerations = new List<double>(); this.IgnorePreoptimizationExceptions = true; }
/// <summary> /// Construct constructor. /// </summary> /// <param name="fragDict">Fragment Dictionary.</param> /// <param name="constructionList">Fragment names. Dictionary keys.</param> public Construct(ObservableCollection<String> constructionList, Dictionary<String, Fragment> fragDict, DesignerSettings settings) : base() { ObservableCollection<String> nameList = new ObservableCollection<String>(constructionList); for (int i = 0; i < nameList.Count; i++) { nameList[i] = nameList[i].Replace(Designer.VectorLabel, ""); } ObservableCollection<Fragment> fragList = new ObservableCollection<Fragment>(); for (int i = 0; i < nameList.Count; i++) { Fragment f = fragDict[nameList[i]]; if (i == 0) { f.IsVector = true; } fragList.Add(f); } Init(fragList, settings); }
/// <summary> /// Evaluate the chromosome. /// </summary> /// <param name="templates">List of overlap templates.</param> /// <param name="settings">Designer settings.</param> /// <returns>Total score of the chromosome.</returns> public ScoreTotal Evaluate(List<Overlap> templates, DesignerSettings settings, bool ignoreHeterodimers) { this.ToOverlaps(templates); bool accept = true; foreach (Overlap o in this.Overlaps) { if (!o.IsAcceptable(settings.MaxTh, settings.MaxTd, ignoreHeterodimers)) { accept = false; break; } } if (accept) this.Score.Rescore(Overlaps); else this.Score = ScoreTotal.Inacceptable; return this.Score; }
/// <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; //forward String seq5 = ""; String seq3 = ""; String name = ""; List <MiscFeature> featList = new List <MiscFeature>(); for (int i = 0; i < fragList.Count; i++) { name += fragList[i].Name; seq3 = fragList[i].GetString(); int len5 = Math.Min(settings.MaxOverlapLen, seq5.Length); int len3 = Math.Min(settings.MaxGeneSpecificLen, seq3.Length); String overlapping = seq5.Substring(seq5.Length - len5, len5); String geneSpecific = seq3.Substring(0, len3); String loc = (seq5.Length + 1).ToString() + ".." + (seq5.Length + seq3.Length).ToString(); MiscFeature gene = new MiscFeature(loc); gene.StandardName = fragList[i].Name; featList.Add(gene); seq5 += seq3; if (i == 0) { Overlaps.Add(new Overlap(fragList[i].Name + "_fwd", new Sequence(Alphabets.DNA, geneSpecific))); } else { Overlaps.Add(new Overlap(fragList[i].Name + "_fwd", new Sequence(Alphabets.DNA, overlapping), new Sequence(Alphabets.DNA, geneSpecific))); } } this.Sequence = new Sequence(Alphabets.DNA, seq5); //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 = seq5.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); seq5 = ""; seq3 = ""; for (int i = fragList.Count - 1; i >= 0; i--) { seq5 = fragList[i].GetReverseComplementString(); int len3 = Math.Min(settings.MaxOverlapLen, seq3.Length); int len5 = Math.Min(settings.MaxGeneSpecificLen, seq5.Length); String overlapping = seq3.Substring(seq3.Length - len3, len3); String geneSpecific = seq5.Substring(0, len5); seq3 += seq5; if (i == fragList.Count - 1) { Overlaps.Add(new Overlap(fragList[i].Name + "_rev", new Sequence(Alphabets.DNA, geneSpecific))); } else { Overlaps.Add(new Overlap(fragList[i].Name + "_rev", new Sequence(Alphabets.DNA, overlapping), new Sequence(Alphabets.DNA, geneSpecific))); } } TermoOptimizeOverlaps(); }
/// <summary> /// Construct constructor. /// </summary> /// <param name="fragDict">Fragment Dictionary.</param> /// <param name="nameList">Fragment names. Dictionary keys.</param> public Construct(ObservableCollection <String> nameList, Dictionary <String, Fragment> fragDict, DesignerSettings settings) : base() { ObservableCollection <Fragment> fragList = new ObservableCollection <Fragment>(); for (int i = 0; i < nameList.Count; i++) { Fragment f = fragDict[nameList[i]]; if (i == 0) { f.IsVector = true; } fragList.Add(f); } Init(fragList, settings); }
/// <summary> /// Construct constructor. /// </summary> /// <param name="fragList">Fragment list.</param> public Construct(ObservableCollection <Fragment> fragList, DesignerSettings settings) : base() { Init(fragList, settings); }
/// <summary> /// Construct constructor. /// </summary> /// <param name="fragList">Fragment list.</param> public Construct(ObservableCollection<Fragment> fragList, DesignerSettings settings) : base() { Init(fragList, settings); }
/// <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]); } }