public ClinGenItem(string id, IChromosome chromosome, int start, int end, VariantType variantType, int observedGains, int observedLosses, ClinicalInterpretation clinicalInterpretation, bool validated, HashSet <string> phenotypes = null, HashSet <string> phenotypeIds = null) { Id = id; Chromosome = chromosome; Start = start; End = end; VariantType = variantType; ClinicalInterpretation = clinicalInterpretation; _phenotypes = phenotypes ?? new HashSet <string>(); _phenotypeIds = phenotypeIds ?? new HashSet <string>(); ObservedGains = observedGains; ObservedLosses = observedLosses; Validated = validated; }
public override int GetHashCode() { unchecked { var hashCode = Id?.GetHashCode() ?? 0; hashCode = (hashCode * 397) ^ (Chromosome?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ Start.GetHashCode(); hashCode = (hashCode * 397) ^ End.GetHashCode(); hashCode = (hashCode * 397) ^ VariantType.GetHashCode(); hashCode = (hashCode * 397) ^ Validated.GetHashCode(); hashCode = (hashCode * 397) ^ ObservedGains.GetHashCode(); hashCode = (hashCode * 397) ^ ClinicalInterpretation.GetHashCode(); hashCode = (hashCode * 397) ^ ObservedLosses.GetHashCode(); return(hashCode); } }
private static string GetClinicalDescription(ClinicalInterpretation clinicalInterpretation) { switch (clinicalInterpretation) { case ClinicalInterpretation.uncertain_significance: return("uncertain significance"); case ClinicalInterpretation.likely_benign: return("likely benign"); case ClinicalInterpretation.likely_pathogenic: return("likely pathogenic"); default: return(clinicalInterpretation.ToString()); } }
private static string GetClinicalDescription(ClinicalInterpretation clinicalInterpretation) { // ReSharper disable once SwitchStatementMissingSomeCases switch (clinicalInterpretation) { case ClinicalInterpretation.uncertain_significance: return("uncertain significance"); case ClinicalInterpretation.likely_benign: return("likely benign"); case ClinicalInterpretation.likely_pathogenic: return("likely pathogenic"); case ClinicalInterpretation.unknown: return(null); default: return(clinicalInterpretation.ToString()); } }
public void MergeItem(ClinGenItem other) { //sanity check if (!Id.Equals(other.Id) || !Chromosome.Equals(other.Chromosome) || Start != other.Start || End != other.End) { throw new Exception($"different region with same parent ID {Id}\n"); } //check if the validate status and clinical interpretation are consistent if (Validated || other.Validated) { Validated = true; } if (!ClinicalInterpretation.Equals(other.ClinicalInterpretation)) { if (ClinicalInterpretation < other.ClinicalInterpretation) { ClinicalInterpretation = other.ClinicalInterpretation; } } if (other.VariantType == VariantType.copy_number_gain) { ObservedGains++; } else if (other.VariantType == VariantType.copy_number_loss) { ObservedLosses++; } foreach (var phenotype in other.Phenotypes) { _phenotypes.Add(phenotype); } foreach (var phenotypeId in other.PhenotypeIds) { _phenotypeIds.Add(phenotypeId); } }
private static void ParseInfor(string tagFiled, string infoField, out string id, out VariantType variantType, out int observedGains, out int observedLosses, out ClinicalInterpretation clinicalInterpretation, out bool validated, out HashSet <string> phenotypes, out HashSet <string> phenotypeIds) { id = null; variantType = VariantType.unknown; observedGains = 0; observedLosses = 0; clinicalInterpretation = ClinicalInterpretation.unknown; validated = false; phenotypes = new HashSet <string>(); phenotypeIds = new HashSet <string>(); var tags = tagFiled.Split(','); var info = infoField.Split(','); if (tags.Length != info.Length) { throw new Exception("Unequal length of attrTags and attrVals\n"); } var len = tags.Length; for (var i = 0; i < len; i++) { switch (tags[i]) { case IdTag: id = info[i]; break; case ClinicalInterpretationTag: clinicalInterpretation = ParseClinicalInterpretation(info[i]); break; case ValidatedTag: validated = info[i].Equals("Pass"); break; case VariantTypeTag: variantType = GetVariantType(info[i]); break; case PhenotypeTag: phenotypes = GetPhenotypes(info[i]); break; case PhenotypeIdTag: phenotypeIds = GetPhenotypeIds(info[i]); break; } } if (variantType == VariantType.copy_number_gain) { observedGains++; } if (variantType == VariantType.copy_number_loss) { observedLosses++; } }