public static ThermodynamicsResult ComputeThermodynamics(INucleotideSequence seq, ExperimentalConfiguration config) // const { return ThermodynamicsData.ComputeThermodynamics(config, seq.Nucleotides, Strand.IsFivePrimePhosphorylated(seq)?1:0); }
//------------------------------------------------------------------ // INamedSequence public abstract string GetDecoratedName(string coreName, PrettyPrintContext context, INucleotideSequence root, NAMED_SEQUENCE_DECORATOR caller, out NAMED_SEQUENCE_DECORATOR callee);
public void UpdateThermodynamics(ExperimentalConfiguration config, INucleotideSequence sequence) { if (config != this.Configuration || sequence.Nucleotides != this.Nucleotides) { this.Nucleotides = sequence.Nucleotides; this.Configuration = config; this.Thermodynamics = ComputeThermodynamics(sequence, config); } }
//-------------------------------------------------------------------------- // INamedSequence public override string GetDecoratedName(string coreName, PrettyPrintContext ppContext, INucleotideSequence root, NAMED_SEQUENCE_DECORATOR caller, out NAMED_SEQUENCE_DECORATOR callee) { return this.GetDecoratedNameDoubleHelper(coreName, ppContext, root, caller, out callee, "{0}'", NAMED_SEQUENCE_DECORATOR.COMPLEMENT); }
//-------------------------------------------------------------------------- // Construction public ExtractedSequence(DistillationContext context, SymbolTable symtab, INucleotideSequence target, int intFirst, int cnt) : base(context, symtab, target) { this.id = EnumeratedNucleotideSequence.NewId(); // StringExtractor.Confine(0, target.Length, ref intFirst, ref cnt); // note, though: target's length can change this.stringExtractor = new StringExtractor(intFirst, cnt); // this.isOurDecoration = dec => { if (dec.Ich >= this.stringExtractor.IchFirst && dec.Ich < this.stringExtractor.IchMax) return true; if (this.stringExtractor.IchFirst == 0 && dec.Ich < 0) return true; if (this.stringExtractor.IchMax >= this.target.Length && dec.Ich == this.target.Length) return true; return false; }; }
//-------------------------------------------------------------------------- // Construction ComplementedSequence(DistillationContext context, SymbolTable symtab, INucleotideSequence target) : base(context, symtab, target) { }
public static INucleotideSequence Create(DistillationContext context, SymbolTable symtab, INucleotideSequence target) { return new ComplementedSequence(context, symtab, target); }
public static INucleotideSequence Create(IReverseSequenceIdContainer idmgr, DistillationContext context, SymbolTable symtab, INucleotideSequence target) { return new ReversedSequence(idmgr, context, symtab, target); }
//-------------------------------------------------------------------------- // INamedSequence public override string GetDecoratedName(string coreName, PrettyPrintContext context, INucleotideSequence root, NAMED_SEQUENCE_DECORATOR caller, out NAMED_SEQUENCE_DECORATOR callee) { return this.GetDecoratedNameDoubleHelper(coreName, context, root, caller, out callee, "reversed({0})", NAMED_SEQUENCE_DECORATOR.REVERSE); }
//-------------------------------------------------------------------------- // Construction ReversedSequence(IReverseSequenceIdContainer idmgr, DistillationContext context, SymbolTable symtab, INucleotideSequence target) : base(context, symtab, target) { this.id = idmgr.IdForReversedTarget(target.Id); }
protected string GetDecoratedNameDoubleHelper(string coreName, PrettyPrintContext context, INucleotideSequence root, NAMED_SEQUENCE_DECORATOR caller, out NAMED_SEQUENCE_DECORATOR callee, string format, NAMED_SEQUENCE_DECORATOR usFlavor ) // Shared code for reversing and complementing { callee = usFlavor; // if (this == root) return context.FormatDisplayName(coreName, this.Id); // if (this.target is INamedSequence) { INamedSequence decorator = this.target as INamedSequence; NAMED_SEQUENCE_DECORATOR decoratorFlavor; if (caller == usFlavor) { // us and caller are of same flavor: just forward on to the target so that the two cancel return decorator.GetDecoratedName(coreName, context, root, NAMED_SEQUENCE_DECORATOR.NONE, out decoratorFlavor); } else { // get from target string his = (this.target as INamedSequence).GetDecoratedName(coreName, context, root, usFlavor, out decoratorFlavor); // if (decoratorFlavor==usFlavor) return his; else return string.Format(format, his); } } return string.Format(format, context.FormatDisplayName(coreName, this.Id)); }
//-------------------------------------------------------------------------- // INamedSequence public override string GetDecoratedName(string coreName, PrettyPrintContext context, INucleotideSequence root, NAMED_SEQUENCE_DECORATOR caller, out NAMED_SEQUENCE_DECORATOR callee) // Default implementation that just stops at us if we're the root and forwards on to target if not { callee = NAMED_SEQUENCE_DECORATOR.NONE; // if (this == root) return context.FormatDisplayName(coreName, this.Id); // if (this.target is INamedSequence) { INamedSequence decorator = this.target as INamedSequence; NAMED_SEQUENCE_DECORATOR decoratorFlavor; return decorator.GetDecoratedName(coreName, context, root, NAMED_SEQUENCE_DECORATOR.NONE, out decoratorFlavor); } // return context.FormatDisplayName(coreName, this.Id); }
//-------------------------------------------------------------------------- // Construction public ComputedSequence(DistillationContext context, SymbolTable symtab, INucleotideSequence target) : base(context, symtab) { this.target = target; }
//-------------------------------------------------------------------------- // INamedSequence public override string GetDecoratedName(string coreName, PrettyPrintContext context, INucleotideSequence root, NAMED_SEQUENCE_DECORATOR caller, out NAMED_SEQUENCE_DECORATOR callee) { callee = NAMED_SEQUENCE_DECORATOR.NONE; return context.FormatDisplayName(coreName, this.Id); }