public FCriteria(FBlackboard blackboard, FStringId key, EValueComparer comparer, IVariant expectedValue) { this._key = key; this._comparer = comparer; this._blackboard = blackboard; this._expectedValue = expectedValue; }
public void ArrayOneDimensionByteStringVariantTest() { byte[] _testArray = new byte[] { 143, 2, 0, 0, 0, 5, 0, 0, 0, 0, 1, 2, 3, 4, 5, 0, 0, 0, 5, 6, 7, 8, 9 }; IVariant _EncodedArray = null; using (MemoryStream _stream = new MemoryStream(_testArray)) using (TestBinaryReader _buffer = new TestBinaryReader(_stream)) { Assert.IsNotNull(_buffer); _EncodedArray = _buffer.ReadVariant(_buffer); _buffer.Close(); } Assert.IsNotNull(_EncodedArray); Assert.AreEqual <BuiltInType>(BuiltInType.ByteString, _EncodedArray.UATypeInfo.BuiltInType); Assert.AreEqual <int>(1, _EncodedArray.UATypeInfo.ValueRank); Assert.IsInstanceOfType(_EncodedArray.Value, typeof(Array)); Array _value = _EncodedArray.Value as Array; Assert.IsNotNull(_value); Assert.AreEqual <int>(1, _value.Rank); Assert.AreEqual <int>(2, _value.GetLength(0)); byte[][] _recovered = (byte[][])_value; byte[][] _expected = new byte[][] { new byte[] { 0, 1, 2, 3, 4 }, new byte[] { 5, 6, 7, 8, 9 } }; for (int i = 0; i < _value.Rank; i++) { CollectionAssert.AreEqual(_expected[i], _recovered[i]); } }
private void ReadValueVariant(IConsumerBinding consumerBinding) { IVariant _ret = m_UADecoder.ReadVariant(this); AssertTypeMach(_ret.UATypeInfo, consumerBinding.Encoding); consumerBinding.Assign2Repository(_ret.Value); }
public static void GetAnnotatedTranscripts(IVariant variant, ITranscript[] transcriptCandidates, ISequence compressedSequence, IList <IAnnotatedTranscript> annotatedTranscripts, ISet <string> overlappingGenes, IList <IOverlappingTranscript> overlappingTranscripts, IPredictionCache siftCache, IPredictionCache polyphenCache, ITranscript[] geneFusionCandidates = null) { foreach (var transcript in transcriptCandidates) { var annotationStatus = DecideAnnotationStatus(variant, transcript, variant.Behavior, transcript.Gene); if (annotationStatus != Status.NoAnnotation && variant.Behavior.ReportOverlappingGenes) { overlappingGenes.Add(transcript.Gene.Symbol); } if (variant.Behavior.NeedVerboseTranscripts) { AddOverlappingTranscript(annotationStatus, transcript, variant, overlappingTranscripts); } var annotatedTranscript = GetAnnotatedTranscript(variant, compressedSequence, transcript, annotationStatus, siftCache, polyphenCache, geneFusionCandidates); if (annotatedTranscript != null) { annotatedTranscripts.Add(annotatedTranscript); } } }
private static IAnnotatedTranscript GetAnnotatedTranscript(IVariant variant, ISequence compressedSequence, ITranscript transcript, Status annotationStatus, IPredictionCache siftCache, IPredictionCache polyphenCache) { IAnnotatedTranscript annotatedTranscript = null; // ReSharper disable once SwitchStatementMissingSomeCases switch (annotationStatus) { case Status.FlankingAnnotation: annotatedTranscript = FlankingTranscriptAnnotator.GetAnnotatedTranscript(variant.End, transcript); break; case Status.ReducedAnnotation: annotatedTranscript = ReducedTranscriptAnnotator.GetAnnotatedTranscript(transcript, variant); break; case Status.RohAnnotation: annotatedTranscript = RohTranscriptAnnotator.GetAnnotatedTranscript(transcript); break; case Status.FullAnnotation: var acidsProvider = variant.Chromosome.UcscName == "chrM" ? MitoAminoAcidsProvider : AminoAcidsProvider; annotatedTranscript = FullTranscriptAnnotator.GetAnnotatedTranscript(transcript, variant, compressedSequence, siftCache, polyphenCache, acidsProvider); break; } return(annotatedTranscript); }
private static uint ParseProperty(XPathNavigator nav, Node node, out IVariant variant) { string name; var id = GetIdOrName(nav, out name); var type = nav.GetAttribute("type", ""); variant = VariantFactory.GetVariant(type); variant.Parse(nav.Value); if (node.Properties.ContainsKey(id) == true) { var lineInfo = (IXmlLineInfo)nav; if (string.IsNullOrEmpty(name) == true) { throw new FormatException(string.Format( "duplicate property id 0x{0:X8} at line {1} position {2}", id, lineInfo.LineNumber, lineInfo.LinePosition)); } throw new FormatException( string.Format("duplicate property id 0x{0:X8} ('{1}') at line {2} position {3}", id, name, lineInfo.LineNumber, lineInfo.LinePosition)); } return(id); }
internal VariantImmutableMetaObject(Expression parameter, IVariant variant) : base(parameter, variant, out var valueExpression) { VariantValue = variant.Value is null ? new DynamicMetaObject(valueExpression, Restrictions, null) : new DynamicMetaObject(Expression.Convert(valueExpression, variant.Value.GetType()), Restrictions, variant.Value); }
public static IList <IAnnotatedTranscript> GetAnnotatedTranscripts(IVariant variant, ITranscript[] transcriptCandidates, ISequence compressedSequence, IPredictionCache siftCache, IPredictionCache polyphenCache, ITranscript[] geneFusionCandidates = null) { var annotatedTranscripts = new List <IAnnotatedTranscript>(); foreach (var transcript in transcriptCandidates) { if (transcript.Id.IsPredictedTranscript()) { continue; } var annotationStatus = DecideAnnotationStatus(variant, transcript, variant.Behavior); var annotatedTranscript = GetAnnotatedTranscript(variant, compressedSequence, transcript, annotationStatus, siftCache, polyphenCache, geneFusionCandidates); if (annotatedTranscript != null) { annotatedTranscripts.Add(annotatedTranscript); } } return(annotatedTranscripts); }
private void comboBoxVariant_SelectedIndexChanged(object sender, EventArgs e) { try { ResetVariants(); int index = comboBoxVariant.SelectedIndex; currentVariant = variants[index]; numUD_m.Value = Convert.ToDecimal(currentVariant.m); numUD_a.Value = Convert.ToDecimal(currentVariant.a); numUD_c.Value = Convert.ToDecimal(currentVariant.c); numUD_alfa.Value = Convert.ToDecimal(currentVariant.alpha); numUD_R.Value = Convert.ToDecimal(currentVariant.R); numUD_betta.Value = Convert.ToDecimal(currentVariant.betta); numUD_vA.Value = Convert.ToDecimal(currentVariant.vA); numUD_f.Value = Convert.ToDecimal(currentVariant.f); numUD_Delta0.Value = Convert.ToDecimal(currentVariant.delta0); numUD_tau.Value = Convert.ToDecimal(currentVariant.tau); textBox_output.Text = currentVariant.Calculate(); pictureBox1.Image = new Bitmap(string.Format($"{Path.GetFullPath(Path.Combine(RunningPath, @"..\..\"))}Resources\\{currentVariant.path}")); pictureBox2.Image = new Bitmap(string.Format($"{Path.GetFullPath(Path.Combine(RunningPath, @"..\..\"))}Resources\\{currentVariant.path2}")); } catch (Exception ex) { textBox_output.Text = ex.Message; } }
AnnotateTranscript(ITranscript transcript, IVariant variant, ITranscript[] geneFusionCandidates) { var position = GetMappedPosition(transcript.TranscriptRegions, variant); var geneFusionAnnotation = GeneFusionUtilities.GetGeneFusionAnnotation(variant.BreakEnds, transcript, geneFusionCandidates); return(position, geneFusionAnnotation); }
public void VerifySingleFieldFieldsWithSingleOption(ElementTypeIdentifierPath messageType, string fieldName , OptionIdentifierPath optionName) { const LabelKind label = LabelKind.Required; IVariant fieldType = Variant.Create(ProtoType.Double); IVariant optionConst = Constant.Create(true); IEnumerable <FieldOption> GetFieldOptions() => GetRange( new FieldOption { Name = optionName, Value = optionConst } ); IEnumerable <NormalFieldStatement> GetNormalFields() { var fieldNumber = FieldNumber; yield return(new NormalFieldStatement { Name = fieldName, Label = label, FieldType = fieldType, Number = fieldNumber, Options = GetFieldOptions().ToList() }); } ExpectedTopLevel = new ExtendStatement { MessageType = messageType, Items = GetNormalFields().ToList <IExtendBodyItem>() }; }
public IEnumerable <string> GetAnnotation(IVariant variant) { if (!_intervalArrays.ContainsKey(variant.Chromosome.Index)) { return(null); } var overlappingSvs = _intervalArrays[variant.Chromosome.Index] .GetAllOverlappingIntervals(variant.Start, variant.End); if (overlappingSvs == null) { return(null); } var jsonStrings = new List <string>(); foreach (var interval in overlappingSvs) { var(reciprocalOverlap, annotationOverlap) = SuppIntervalUtilities.GetOverlapFractions( new ChromosomeInterval(variant.Chromosome, interval.Begin, interval.End), variant); jsonStrings.Add(AddOverlapToAnnotation(interval.Value, reciprocalOverlap, annotationOverlap)); } return(jsonStrings); }
public void IdentifierPathConstantSupportedWithWhiteSpace(OptionIdentifierPath optionName , IVariant constant, WhiteSpaceAndCommentOption whiteSpaceOption) { RenderingOptions = new StringRenderingOptions { WhiteSpaceAndCommentRendering = whiteSpaceOption }; IdentifierPathConstantSupported(optionName, constant); }
private static List <ConsequenceTag> GetConsequences(IInterval transcript, IVariant variant) { var featureEffect = new FeatureVariantEffects(transcript, variant.Type, variant, true); var consequence = new Consequences(null, featureEffect); consequence.DetermineStructuralVariantEffect(variant); return(consequence.GetConsequences()); }
public static Option <T> Merge <T>(IVariant <uint> variant) { Func <Type, Type> optionFunctor = (Type type) => typeof(Option <>).MakeGenericType(type); var merged = MergeRefl <T>(optionFunctor, new OptionMonad(), variant); return(merged.Cast <Option <T> >()); }
protected override bool Equals(IVariant other) { FInt castedOther = other as FInt; FAssert.IsNotNull(castedOther, $"Other is not type of {nameof(FInt)}"); return(this._value == castedOther._value); }
protected override int CompareTo(IVariant other) { FInt castedOther = other as FInt; FAssert.IsNotNull(castedOther, $"Other is not type of {nameof(FInt)}"); return(_value.CompareTo(castedOther._value)); }
/// <summary> /// Renders the <paramref name="value"/> as a <see cref="string"/> given the /// <paramref name="options"/>. /// </summary> /// <param name="value"></param> /// <param name="options"></param> /// <returns></returns> public static string ToDescriptorString(this IVariant value, IStringRenderingOptions options) { // We want first, best possible pairing given the Variant Value. var pair = RenderingCallbacks.FirstOrDefault(x => x.Item1 == value.VariantType || x.Item1.IsAssignableFrom(value.VariantType)); var renderingCallback = pair == null ? (x, o) => $"{x}" : pair.Item2; // TODO: TBD: potential Nullness going on here? return(renderingCallback.Invoke(value?.Value, options)); }
/// <summary> /// Initializes a new instance of the <see cref="variant"/> class. /// </summary> /// <param name="variable">The variable.</param> /// <exception cref="WrongCodeTypeException">std::variant</exception> public variant(Variable variable) : base(variable) { instance = typeSelector.SelectType(variable); if (instance == null) { throw new WrongCodeTypeException(variable, nameof(variable), "std::variant"); } }
public static IAnnotatedRegulatoryRegion Annotate(IVariant variant, IRegulatoryRegion regulatoryRegion) { var featureEffect = new FeatureVariantEffects(regulatoryRegion, variant.Type, variant, variant.IsStructuralVariant); var consequence = new Consequences(null, featureEffect); consequence.DetermineRegulatoryVariantEffects(); return(new AnnotatedRegulatoryRegion(regulatoryRegion, consequence.GetConsequences())); }
public void VerifyMessageBodyWithMapFieldWithWhiteSpace(KeyType keyType, IVariant valueType , string mapName, long fieldNumber, OptionIdentifierPath[] optionNames, IVariant[] optionValues , WhiteSpaceAndCommentOption whiteSpaceOption) { RenderingOptions = new StringRenderingOptions { WhiteSpaceAndCommentRendering = whiteSpaceOption }; VerifyMessageBodyWithMapField(keyType, valueType, mapName, fieldNumber, optionNames, optionValues); }
private static List <ConsequenceTag> GetConsequences(ITranscript transcript, IVariant variant, VariantEffect variantEffect) { var featureEffect = new FeatureVariantEffects(transcript, variant.Type, variant.Start, variant.End, variant.Behavior.StructuralVariantConsequence); var consequence = new Consequences(variantEffect, featureEffect); consequence.DetermineSmallVariantEffects(); return(consequence.GetConsequences()); }
public void IdentifierPathConstantSupported(OptionIdentifierPath optionName, IVariant constant) { GetRange <object>(optionName, constant).AllNotNull(); ExpectedProto.Items.Add( new OptionStatement { Name = optionName, Value = Assert.IsAssignableFrom <IVariant <IdentifierPath> >(constant) } ); }
private static IAnnotatedTranscript GetAnnotatedTranscript(IVariant variant, ISequence compressedSequence, ITranscript transcript) { var acidsProvider = variant.Chromosome.UcscName == "chrM" ? MitoAminoAcidsProvider : AminoAcidsProvider; var annotatedTranscript = PianoTranscriptAnnotator.GetAnnotatedTranscript(transcript, variant, compressedSequence, acidsProvider); return(annotatedTranscript); }
private bool CheckEquality(IVariant currentValue) { FAssert.AreEqual(_expectedValue.GetType(), currentValue.GetType(), $"Expected value is {_expectedValue.GetType().Name} but current value is {currentValue.GetType()}"); if (currentValue == _expectedValue) { return(true); } return(currentValue.Equals(_expectedValue)); }
public virtual void VerifyMessageBodyWithNormalField(LabelKind label, IVariant fieldType, string fieldName , long fieldNumber) { ExpectedBody.Add(new NormalFieldStatement { Label = label, FieldType = fieldType, Name = fieldName, Number = fieldNumber }); }
public int CompareTo(IVariant other) { if (ID == null || Info == null || Filter == null || RefBase == null || AltBase == null) { return(-1); } if (other == null || other.ID == null || other.Info == null || other.Filter == null || other.RefBase == null || other.AltBase == null) { return(1); } int compareResult = base.CompareTo(other); if (compareResult != 0) { return(compareResult); } compareResult = ID.CompareTo(other.ID); if (compareResult != 0) { return(compareResult); } compareResult = Quality.CompareTo(other.Quality); if (compareResult != 0) { return(compareResult); } compareResult = Filter.CompareTo(other.Filter); if (compareResult != 0) { return(compareResult); } compareResult = Info.CompareTo(other.Info); if (compareResult != 0) { return(compareResult); } compareResult = (string.Join("", RefBase)).CompareTo(string.Join("", other.RefBase)); if (compareResult != 0) { return(compareResult); } return((string.Join("", AltBase)).CompareTo(string.Join("", other.AltBase))); }
public static void test() { // Das Interface ist Variant. IVariant <Derived, Base> variant = new Variant <Derived, Base>(); IVariant <Base, Derived> co_contra_variant = variant; // Klassenvariablen sind Invariant Variant <Derived, Base> invariant = new Variant <Derived, Base>(); // Klassen sind invariant: // Variant<Base, Derived> invariant2 = invariant }
public void VerifyMessageBodyWithMapField(KeyType keyType, IVariant valueType, string mapName, long fieldNumber , OptionIdentifierPath[] optionNames, IVariant[] optionValues) { ExpectedBody.Add(new MapFieldStatement { KeyType = keyType, ValueType = valueType, Name = mapName, Number = fieldNumber, Options = ElaborateOptions <FieldOption>(optionNames, optionValues).ToList() }); }
private static IAnnotatedPosition GetAnnotatedPosition(IVariant variant) { IVariant[] variants = { variant }; var position = new Position(ChromosomeUtilities.Chr3, Start, End, null, null, null, null, variants, null, null, null, null, false); var annotatedVariant = new AnnotatedVariant(variant); IAnnotatedVariant[] annotatedVariants = { annotatedVariant }; return(new AnnotatedPosition(position, annotatedVariants)); }
public override void Write(IBinaryEncoder encoder, IVariant value) { base.Write(encoder, value); }