public bool AsBool() { switch (m_Type) { case VariantType.Null: return(false); case VariantType.Bool: return(m_BoolValue); case VariantType.Int: return(m_IntValue > 0); case VariantType.UInt: return(m_UIntValue > 0); case VariantType.Float: return(m_FloatValue > 0); case VariantType.StringHash: return(!m_StringHashValue.IsEmpty); default: throw new InvalidOperationException("Variant type " + m_Type.ToString() + " not recognized"); } }
public string GetJsonString() { var sb = StringBuilderCache.Acquire(); var jsonObject = new JsonObject(sb); jsonObject.AddStringValue("chromosome", Chromosome.EnsemblName); jsonObject.AddIntValue("begin", Start); jsonObject.AddIntValue("end", End); jsonObject.AddStringValue("variantType", VariantType.ToString()); jsonObject.AddStringValue("id", Id); jsonObject.AddStringValue("clinicalInterpretation", GetClinicalDescription(ClinicalInterpretation)); jsonObject.AddStringValues("phenotypes", Phenotypes); jsonObject.AddStringValues("phenotypeIds", PhenotypeIds); if (ObservedGains > 0) { jsonObject.AddIntValue("observedGains", ObservedGains); } if (ObservedLosses > 0) { jsonObject.AddIntValue("observedLosses", ObservedLosses); } jsonObject.AddBoolValue("validated", Validated); return(StringBuilderCache.GetStringAndRelease(sb)); }
private async Task WriteSupplierFile(Task obj) { Console.WriteLine("Write supplier"); using (var fw = new CsvSupplierOutputWriter(_configuration)) { await fw.WriteAsync(new SupplierNode { Code = _variant.ToString(), Name = _variant.ToString() }).ConfigureAwait(false); } }
public static bool BkDXFSysVar_CheckType(string vstrVarName, VariantType vnumVarType, object vvarArraySize, object vvarValue, ref string rstrErrMsg) { rstrErrMsg = null; if (Information.VarType(RuntimeHelpers.GetObjectValue(vvarValue)) != vnumVarType && vnumVarType != VariantType.Char && vnumVarType != VariantType.Decimal && vnumVarType != VariantType.Short) { hwpDxf_Functions.BkDXF_DebugPrint("1: " + vstrVarName + " " + Conversions.ToString((int)Information.VarType(RuntimeHelpers.GetObjectValue(vvarValue))) + " " + Conversions.ToString((int)vnumVarType)); rstrErrMsg = vstrVarName + "\nUngültiger Variablentyp. Soll: " + vnumVarType.ToString() + ", Ist: " + Information.VarType(RuntimeHelpers.GetObjectValue(vvarValue)); } else if (((Information.VarType(RuntimeHelpers.GetObjectValue(vvarValue)) != VariantType.Char) & (Information.VarType(RuntimeHelpers.GetObjectValue(vvarValue)) != VariantType.String)) && vnumVarType == VariantType.Char) { hwpDxf_Functions.BkDXF_DebugPrint("2: " + vstrVarName + " " + Conversions.ToString((int)Information.VarType(RuntimeHelpers.GetObjectValue(vvarValue))) + " " + Conversions.ToString((int)vnumVarType)); rstrErrMsg = vstrVarName + "\nUngültiger Variablentyp. Soll: " + vnumVarType.ToString() + ", Ist: " + Information.VarType(RuntimeHelpers.GetObjectValue(vvarValue)); } else if (((Information.VarType(RuntimeHelpers.GetObjectValue(vvarValue)) != VariantType.Decimal) & (Information.VarType(RuntimeHelpers.GetObjectValue(vvarValue)) != VariantType.Double)) && vnumVarType == VariantType.Decimal) { hwpDxf_Functions.BkDXF_DebugPrint("3: " + vstrVarName + " " + Conversions.ToString((int)Information.VarType(RuntimeHelpers.GetObjectValue(vvarValue))) + " " + Conversions.ToString((int)vnumVarType)); rstrErrMsg = vstrVarName + "\nUngültiger Variablentyp. Soll: " + vnumVarType.ToString() + ", Ist: " + Information.VarType(RuntimeHelpers.GetObjectValue(vvarValue)); } else if (((Information.VarType(RuntimeHelpers.GetObjectValue(vvarValue)) != VariantType.Short) & (Information.VarType(RuntimeHelpers.GetObjectValue(vvarValue)) != VariantType.Integer)) && vnumVarType == VariantType.Short) { hwpDxf_Functions.BkDXF_DebugPrint("4: " + vstrVarName + " " + Conversions.ToString((int)Information.VarType(RuntimeHelpers.GetObjectValue(vvarValue))) + " " + Conversions.ToString((int)vnumVarType)); rstrErrMsg = vstrVarName + "\nUngültiger Variablentyp. Soll: " + vnumVarType.ToString() + ", Ist: " + Information.VarType(RuntimeHelpers.GetObjectValue(vvarValue)); } else { if ((VariantType.Array & vnumVarType) != VariantType.Array) { return(true); } if (vvarArraySize != null) { if (!Conversions.ToBoolean(Operators.NotObject(Operators.CompareObjectEqual(Information.UBound((Array)vvarValue), Operators.SubtractObject(vvarArraySize, 1), TextCompare: false)))) { return(true); } rstrErrMsg = "Ungültige Arraygröße für Variable."; } } bool BkDXFSysVar_CheckType = default(bool); return(BkDXFSysVar_CheckType); }
public string GetJsonContent() { var sb = new StringBuilder(); var jsonObject = new JsonObject(sb); // data section jsonObject.AddStringValue("chromosome", ReferenceName); jsonObject.AddIntValue("begin", Start); jsonObject.AddIntValue("end", End); jsonObject.AddStringValue("source", Source); jsonObject.AddStringValue("variantType", VariantType.ToString()); foreach (var kvp in PopulationFrequencies) { if (kvp.Value > 0) { jsonObject.AddStringValue(kvp.Key, kvp.Value.ToString("0.#####"), false); } } foreach (var kvp in StringValues) { jsonObject.AddStringValue(kvp.Key, kvp.Value); } foreach (var kvp in IntValues) { jsonObject.AddIntValue(kvp.Key, kvp.Value); } foreach (var kvp in DoubleValues) { if (kvp.Value > 0) { jsonObject.AddStringValue(kvp.Key, kvp.Value.ToString("0.#####"), false); } } foreach (var kvp in BoolValues) { jsonObject.AddBoolValue(kvp, true, true, "true"); } foreach (var kvp in StringLists) { jsonObject.AddStringValues(kvp.Key, kvp.Value); } return(sb.ToString()); }
/// <summary> /// Gets the byte serialization tag for a given type. /// </summary> /// <param name="type">Type to look up.</param> /// <returns>The tag to use for (de)serialization.</returns> public byte GetTag() { MemberInfo enumMember = typeof(Type).GetMember(VariantType.ToString()) .FirstOrDefault(); TagAttribute tag = enumMember.GetCustomAttribute <TagAttribute>(); if (tag == null) { // Shouldn't happen throw new InvalidOperationException(); } return(tag.Value); }
public string GetJsonString() { var sb = StringBuilderCache.Acquire(); var jsonObject = new JsonObject(sb); // data section jsonObject.AddStringValue("chromosome", Chromosome.EnsemblName); jsonObject.AddIntValue("begin", Start); jsonObject.AddIntValue("end", End); jsonObject.AddStringValue("variantType", VariantType.ToString()); foreach (var kvp in PopulationFrequencies) { if (kvp.Value > 0) { jsonObject.AddStringValue(kvp.Key, kvp.Value.ToString("0.#####"), false); } } foreach (var kvp in StringValues) { jsonObject.AddStringValue(kvp.Key, kvp.Value); } foreach (var kvp in IntValues) { jsonObject.AddIntValue(kvp.Key, kvp.Value); } foreach (var kvp in DoubleValues) { if (kvp.Value > 0) { jsonObject.AddStringValue(kvp.Key, kvp.Value.ToString("0.#####"), false); } } foreach (var kvp in BoolValues) { jsonObject.AddBoolValue(kvp, true); } foreach (var kvp in StringLists) { jsonObject.AddStringValues(kvp.Key, kvp.Value.ToArray()); } return(StringBuilderCache.GetStringAndRelease(sb)); }
public string GetJsonString() { var sb = StringBuilderCache.Acquire(); var jsonObject = new JsonObject(sb); jsonObject.AddIntValue("id", CNVId); jsonObject.AddStringValue("variantType", _cnvType.ToString()); if (_copyNumber != -1) { jsonObject.AddIntValue("copyNumber", _copyNumber); } jsonObject.AddStringValues("cancerTypes", GetJsonStrings(_cancerTypes), false); jsonObject.AddStringValues("tissueTypes", GetJsonStrings(_tissueTypes), false); return(sb.ToString()); }
public string GetJsonString() { var sb = StringBuilderCache.Acquire(); var jsonObject = new JsonObject(sb); jsonObject.AddStringValue("chromosome", Chromosome.EnsemblName); jsonObject.AddIntValue("begin", Start); jsonObject.AddIntValue("end", End); jsonObject.AddStringValue("variantType", VariantType.ToString()); jsonObject.AddStringValue("id", Id); jsonObject.AddIntValue("allAn", _allAlleleNumber); jsonObject.AddIntValue("allAc", _allAlleleCount); jsonObject.AddDoubleValue("allAf", _allAlleleFrequency, "0.######"); jsonObject.AddDoubleValue("afrAf", _afrAlleleFrequency, "0.######"); jsonObject.AddDoubleValue("amrAf", _amrAlleleFrequency, "0.######"); jsonObject.AddDoubleValue("eurAf", _eurAlleleFrequency, "0.######"); jsonObject.AddDoubleValue("easAf", _easAlleleFrequency, "0.######"); jsonObject.AddDoubleValue("sasAf", _sasAlleleFrequency, "0.######"); return(StringBuilderCache.GetStringAndRelease(sb)); }
public string GetJsonString() { var sb = StringBuilderCache.Acquire(); var jsonObject = new JsonObject(sb); jsonObject.AddStringValue("chromosome", Chromosome.EnsemblName); jsonObject.AddIntValue("begin", Start); jsonObject.AddIntValue("end", End); jsonObject.AddStringValue("variantType", VariantType.ToString()); jsonObject.AddStringValue("id", Id); jsonObject.AddIntValue("sampleSize", SampleSize); if (ObservedGains != 0) { jsonObject.AddIntValue("observedGains", ObservedGains); } if (ObservedLosses != 0) { jsonObject.AddIntValue("observedLosses", ObservedLosses); } jsonObject.AddDoubleValue("variantFreqAll", VariantFreqAll, "0.#####"); return(StringBuilderCache.GetStringAndRelease(sb)); }