public void Annotate_Promoter() { var variant = GetVariant(); var regulatoryRegion = GetRegulatoryRegion(); const ConsequenceTag expectedConsequence = ConsequenceTag.regulatory_region_variant; var annotatedRegulatoryRegion = RegulatoryRegionAnnotator.Annotate(variant, regulatoryRegion); var consequences = annotatedRegulatoryRegion.Consequences.ToList(); Assert.NotNull(annotatedRegulatoryRegion); Assert.Single(consequences); Assert.Equal(expectedConsequence, consequences[0]); }
private void AddRegulatoryRegions(IAnnotatedPosition annotatedPosition) { var overlappingRegulatoryRegions = _transcriptCache.GetOverlappingRegulatoryRegions(annotatedPosition.Position); if (overlappingRegulatoryRegions == null) { return; } foreach (var annotatedVariant in annotatedPosition.AnnotatedVariants) { // In case of insertions, the base(s) are assumed to be inserted at the end position // if this is an insertion just before the beginning of the regulatory element, this takes care of it var variant = annotatedVariant.Variant; var variantEnd = variant.End; var variantBegin = variant.Type == VariantType.insertion ? variant.End : variant.Start; // disable regulatory region for SV larger than 50kb if (variantEnd - variantBegin + 1 > MaxSvLengthForRegulatoryRegionAnnotation) { continue; } foreach (var regulatoryRegion in overlappingRegulatoryRegions) { if (!variant.Overlaps(regulatoryRegion)) { continue; } // if the insertion is at the end, its past the feature and therefore not overlapping if (variant.Type == VariantType.insertion && variantEnd == regulatoryRegion.End) { continue; } annotatedVariant.RegulatoryRegions.Add(RegulatoryRegionAnnotator.Annotate(variant, regulatoryRegion)); } } }
private static void AddRegulatoryRegions(IAnnotatedVariant[] annotatedVariants, IIntervalForest <IRegulatoryRegion> regulatoryIntervalForest) { foreach (var annotatedVariant in annotatedVariants) { if (!annotatedVariant.Variant.Behavior.NeedRegulatoryRegions) { continue; } // In case of insertions, the base(s) are assumed to be inserted at the end position // if this is an insertion just before the beginning of the regulatory element, this takes care of it var variant = annotatedVariant.Variant; int variantBegin = variant.Type == VariantType.insertion ? variant.End : variant.Start; if (SkipLargeVariants(variantBegin, variant.End)) { continue; } IRegulatoryRegion[] regulatoryRegions = regulatoryIntervalForest.GetAllOverlappingValues(variant.Chromosome.Index, variantBegin, variant.End); if (regulatoryRegions == null) { continue; } foreach (var regulatoryRegion in regulatoryRegions) { // if the insertion is at the end, its past the feature and therefore not overlapping if (variant.Type == VariantType.insertion && variant.End == regulatoryRegion.End) { continue; } annotatedVariant.RegulatoryRegions.Add(RegulatoryRegionAnnotator.Annotate(variant, regulatoryRegion)); } } }