/// <summary> /// Compare to another variantEffect /// </summary> /// <param name="variantEffect"></param> /// <returns></returns> public int CompareTo(VariantEffect varEffOther) { // Sort by impact int comp = GetEffectImpact().CompareTo(varEffOther.GetEffectImpact()); if (comp != 0) { return(comp); } // Sort by effect comp = GetEffectType().CompareTo(varEffOther.GetEffectType()); if (comp != 0) { return(comp); } //--- // Transcript based comparisons //--- Transcript trThis = GetTranscript(); Transcript trOther = varEffOther.GetTranscript(); // This transcript data //int tslThis = TranscriptSupportLevel.TSL_NULL_VALUE; //int canonThis = 0; long startThis = 0; long endThis = 0; string idThis = null; string chrThis = null; if (trThis != null) { //tslThis = TranscriptSupportLevel.tsl(trThis.getTranscriptSupportLevel()); //canonThis = trThis.isCanonical() ? 1 : 0; idThis = trThis.ID; chrThis = trThis.ChromosomeID; startThis = trThis.OneBasedStart; endThis = trThis.OneBasedEnd; } // Other transcript data //int tslOther = TranscriptSupportLevel.TSL_NULL_VALUE; //int canonOther = 0; long startOther = 0; long endOther = 0; string idOther = null; string chrOther = null; if (trOther != null) { //tslOther = TranscriptSupportLevel.tsl(trOther.getTranscriptSupportLevel()); //canonOther = trOther.isCanonical() ? 1 : 0; idOther = trOther.ID; chrOther = trOther.ChromosomeID; startOther = trOther.OneBasedStart; endOther = trOther.OneBasedEnd; } // Compare by TSL: Smaller first //comp = tslThis - tslOther; //if (comp != 0) return comp; // Compare by canonical transcript: Larger first //comp = canonOther - canonThis; //if (comp != 0) return comp; // Compare genomic coordinate comp = CompareNull(chrThis, chrOther); if (comp != 0) { return(comp); } comp = startThis.CompareTo(startOther); if (comp != 0) { return(comp); } comp = endThis.CompareTo(endOther); if (comp != 0) { return(comp); } // Compare IDs comp = CompareNull(idThis, idOther); if (comp != 0) { return(comp); } //--- // Marker based comparisons //--- Interval mThis = Marker; Interval mOther = varEffOther.Marker; startThis = 0; endThis = 0; idThis = null; chrThis = null; if (Marker != null) { //idThis = mThis.getId(); chrThis = mThis.ChromosomeID; startThis = mThis.OneBasedStart; endThis = mThis.OneBasedEnd; } startOther = 0; endOther = 0; idOther = null; chrOther = null; if (mOther != null) { //idOther = mOther.getId(); chrOther = mOther.ChromosomeID; startOther = mOther.OneBasedStart; endOther = mOther.OneBasedEnd; } // Compare genomic coordinate comp = CompareNull(chrThis, chrOther); if (comp != 0) { return(comp); } comp = startThis.CompareTo(startOther); if (comp != 0) { return(comp); } comp = endThis.CompareTo(endOther); if (comp != 0) { return(comp); } // Compare IDs comp = CompareNull(idThis, idOther); if (comp != 0) { return(comp); } //--- // Variant based comparison //--- return(Variant.CompareTo(varEffOther.Variant)); }