public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hashCode = 41; if (AnnotationPosition != null) { hashCode = hashCode * 59 + AnnotationPosition.GetHashCode(); } if (AnnotationTail != null) { hashCode = hashCode * 59 + AnnotationTail.GetHashCode(); } if (AnnotationText != null) { hashCode = hashCode * 59 + AnnotationText.GetHashCode(); } if (AxisTitleText != null) { hashCode = hashCode * 59 + AxisTitleText.GetHashCode(); } if (ColorbarPosition != null) { hashCode = hashCode * 59 + ColorbarPosition.GetHashCode(); } if (ColorbarTitleText != null) { hashCode = hashCode * 59 + ColorbarTitleText.GetHashCode(); } if (LegendPosition != null) { hashCode = hashCode * 59 + LegendPosition.GetHashCode(); } if (LegendText != null) { hashCode = hashCode * 59 + LegendText.GetHashCode(); } if (ShapePosition != null) { hashCode = hashCode * 59 + ShapePosition.GetHashCode(); } if (TitleText != null) { hashCode = hashCode * 59 + TitleText.GetHashCode(); } return(hashCode); } }
private static AnnotationPosition FindProperStartPosition(AnnotationPosition genomicPosition, IIntervalForest <IGene> geneIntervalForest, IDictionary <string, IChromosome> refNameToChromosome) { var chromosome = ReferenceNameUtilities.GetChromosome(refNameToChromosome, genomicPosition.Chromosome); int currentPosition = genomicPosition.Position; IGene[] overlappingGenes; while ((overlappingGenes = geneIntervalForest.GetAllOverlappingValues(chromosome.Index, currentPosition, currentPosition)) != null) { if (overlappingGenes.Length > 0) { currentPosition = overlappingGenes.Select(x => x.Start).Min() - 1; } } // Always return the position right before the overlapping genes to KISS return(new AnnotationPosition(genomicPosition.Chromosome, currentPosition < 1 ? 1 : currentPosition)); }
private static AnnotationPosition[] AdjustPartitionGenomicStarts(IReadOnlyList <long> blockBasedOffsets, string vcfUrl, IIntervalForest <IGene> geneIntervalForest, IDictionary <string, IChromosome> refNameToChromosome) { var allAdjustedStarts = new AnnotationPosition[blockBasedOffsets.Count]; for (var index = 0; index < blockBasedOffsets.Count; index++) { long blockBasedOffset = blockBasedOffsets[index]; using (var stream = PersistentStreamUtils.GetReadStream(vcfUrl, blockBasedOffset)) using (var gzipStream = new BlockGZipStream(stream, CompressionMode.Decompress)) { var annotationPosition = GetFirstGenomicPosition(gzipStream, index == 0); allAdjustedStarts[index] = FindProperStartPosition(annotationPosition, geneIntervalForest, refNameToChromosome); } } AnnotationPosition[] adjustedStarts = MergeConsecutiveEqualValues(allAdjustedStarts).ToArray(); return(adjustedStarts); }
PointF getAnnotationTextPos(AnnotationPosition pos, SizeF stringSize) { var ret = new PointF(); if (pos == AnnotationPosition.StartPoint) { var dx = Point1.X - Point0.X; var dy = Point1.Y - Point0.Y; float ox = 0; float oy = 0; if (dx > 0 && dy > 0) { ox -= stringSize.Width; } ret = new PointF(Point0.X + ox, Point0.Y + oy); } else if (pos == AnnotationPosition.EndPoint) { var dx = Point0.X - Point1.X; var dy = Point0.Y - Point1.Y; float ox = 0; float oy = 0; if (dx > 0 && dy > 0) { ox -= stringSize.Width; } ret = new PointF(Point1.X + ox, Point1.Y + oy); } else { // mid point ret.X = (Point0.X + Point1.X) / 2; ret.Y = (Point0.Y + Point1.Y) / 2; } return(ret); }
/// <inheritdoc /> public bool Equals([AllowNull] Edits other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( AnnotationPosition == other.AnnotationPosition || AnnotationPosition != null && AnnotationPosition.Equals(other.AnnotationPosition) ) && ( AnnotationTail == other.AnnotationTail || AnnotationTail != null && AnnotationTail.Equals(other.AnnotationTail) ) && ( AnnotationText == other.AnnotationText || AnnotationText != null && AnnotationText.Equals(other.AnnotationText) ) && ( AxisTitleText == other.AxisTitleText || AxisTitleText != null && AxisTitleText.Equals(other.AxisTitleText) ) && ( ColorbarPosition == other.ColorbarPosition || ColorbarPosition != null && ColorbarPosition.Equals(other.ColorbarPosition) ) && ( ColorbarTitleText == other.ColorbarTitleText || ColorbarTitleText != null && ColorbarTitleText.Equals(other.ColorbarTitleText) ) && ( LegendPosition == other.LegendPosition || LegendPosition != null && LegendPosition.Equals(other.LegendPosition) ) && ( LegendText == other.LegendText || LegendText != null && LegendText.Equals(other.LegendText) ) && ( ShapePosition == other.ShapePosition || ShapePosition != null && ShapePosition.Equals(other.ShapePosition) ) && ( TitleText == other.TitleText || TitleText != null && TitleText.Equals(other.TitleText) )); }
string getAnnotationText(AnnotationPosition pos) { return(_annotationTexts[(int)pos]); }
void setAnnotationText(AnnotationPosition pos, string text) { _annotationTexts[(int)pos] = text; }