private static BreakEndAdjacency Flip(this BreakEndAdjacency adjacency) { var origin = new BreakPoint(adjacency.Partner.Chromosome, adjacency.Partner.Position, !adjacency.Partner.OnReverseStrand); var partner = new BreakPoint(adjacency.Origin.Chromosome, adjacency.Origin.Position, !adjacency.Origin.OnReverseStrand); return(new BreakEndAdjacency(origin, partner)); }
private static BreakEndAdjacency[] CreateFromDuplication(IChromosomeInterval interval) { // 1 1 . N ]1:10]N var origin = new BreakPoint(interval.Chromosome, interval.End, false); var remote = new BreakPoint(interval.Chromosome, interval.Start - 1, false); var adjacency = new BreakEndAdjacency(origin, remote); return(new[] { adjacency, adjacency.Flip() }); }
private static BreakEndAdjacency[] CreateFromInversion(IChromosomeInterval interval) { // 1 10 . N N]1:20] // 1 11 . N [1:21[N var origin = new BreakPoint(interval.Chromosome, interval.Start - 1, false); var remote = new BreakPoint(interval.Chromosome, interval.End, true); var adjacency = new BreakEndAdjacency(origin, remote); var origin2 = new BreakPoint(interval.Chromosome, interval.End + 1, true); var remote2 = new BreakPoint(interval.Chromosome, interval.Start, false); var adjacency2 = new BreakEndAdjacency(origin2, remote2); return(new[] { adjacency, adjacency2 }); }
internal static void GetGeneFusionsByTranscript(this Dictionary <string, IAnnotatedGeneFusion> transcriptIdToGeneFusions, BreakEndAdjacency adjacency, ITranscript[] originTranscripts, ITranscript[] partnerTranscripts) { var geneFusions = new List <IGeneFusion>(); foreach (var originTranscript in originTranscripts) { geneFusions.Clear(); bool originOnReverseStrand = originTranscript.Gene.OnReverseStrand ^ adjacency.Origin.OnReverseStrand; (int originIndex, ITranscriptRegion originRegion) = MappedPositionUtilities.FindRegion(originTranscript.TranscriptRegions, adjacency.Origin.Position); int?originExon = originRegion.Type == TranscriptRegionType.Exon ? (int?)originRegion.Id : null; int?originIntron = originRegion.Type == TranscriptRegionType.Intron ? (int?)originRegion.Id : null; foreach (var partnerTranscript in partnerTranscripts) { bool partnerOnReverseStrand = partnerTranscript.Gene.OnReverseStrand ^ adjacency.Partner.OnReverseStrand; bool differentStrand = originOnReverseStrand != partnerOnReverseStrand; bool differentTranscriptSource = originTranscript.Source != partnerTranscript.Source; bool sameGeneSymbol = originTranscript.Gene.Symbol == partnerTranscript.Gene.Symbol; bool codingRegionAlreadyOverlaps = originTranscript.Translation.CodingRegion.Overlaps(partnerTranscript.Translation.CodingRegion); if (differentStrand || differentTranscriptSource || sameGeneSymbol || codingRegionAlreadyOverlaps) { continue; } (int partnerIndex, ITranscriptRegion partnerRegion) = MappedPositionUtilities.FindRegion(partnerTranscript.TranscriptRegions, adjacency.Partner.Position); int?partnerExon = partnerRegion.Type == TranscriptRegionType.Exon ? (int?)partnerRegion.Id : null; int?partnerIntron = partnerRegion.Type == TranscriptRegionType.Intron ? (int?)partnerRegion.Id : null; BreakPointTranscript origin = new BreakPointTranscript(originTranscript, adjacency.Origin.Position, originIndex); BreakPointTranscript partner = new BreakPointTranscript(partnerTranscript, adjacency.Partner.Position, partnerIndex); (BreakPointTranscript first, BreakPointTranscript second) = originOnReverseStrand ? (partner, origin) : (origin, partner); string hgvsCoding = GetHgvsCoding(first, second); geneFusions.Add(new GeneFusion(partnerExon, partnerIntron, hgvsCoding)); } if (geneFusions.Count == 0) { continue; } var annotatedGeneFusion = new AnnotatedGeneFusion(originExon, originIntron, geneFusions.ToArray()); transcriptIdToGeneFusions[originTranscript.Id.WithVersion] = annotatedGeneFusion; } }