Skip to content

Commit

Permalink
Feature/acadia fixes 163 (#572)
Browse files Browse the repository at this point in the history
* removing rna edits and updating hgvs del and delins

* adding isRegionStart and updating unit tests

* adding cdnaSequence

* uupdating coding nomenclature and coding sequence tests

* update coding sequence class

Co-authored-by: Michael Stromberg <[email protected]>
  • Loading branch information
2 people authored and GitHub Enterprise committed Nov 20, 2020
1 parent 2bb5928 commit a57e78a
Show file tree
Hide file tree
Showing 15 changed files with 831 additions and 447 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ public sealed class HgvsCodingNomenclatureTests
{
private readonly ITranscript _forwardTranscript;
private readonly ITranscript _reverseTranscript;
private readonly ITranscript _gapTranscript;

public HgvsCodingNomenclatureTests()
{
_forwardTranscript = GetForwardTranscript();
_reverseTranscript = GetReverseTranscript();
_gapTranscript = GetGapTranscript();
}

internal static ITranscript GetForwardTranscript()
Expand Down Expand Up @@ -91,11 +93,81 @@ internal static ITranscript GetReverseTranscript()
return transcript.Object;
}

private static ITranscript GetGapTranscript()
{
//NM_000314.4
var regions = new ITranscriptRegion[]
{
new TranscriptRegion(TranscriptRegionType.Exon, 1, 89623195, 89623860, 1, 666),
new TranscriptRegion(TranscriptRegionType.Gap, 1, 89623861, 89623861, 666, 667),
new TranscriptRegion(TranscriptRegionType.Exon, 1, 89623862, 89624305, 667, 1110),
new TranscriptRegion(TranscriptRegionType.Intron, 1, 89624306, 89653781, 1110, 1111),
new TranscriptRegion(TranscriptRegionType.Exon, 2, 89653782, 89653866, 1111, 1195),
new TranscriptRegion(TranscriptRegionType.Intron, 2, 89653867, 89685269, 1195, 1196),
new TranscriptRegion(TranscriptRegionType.Exon, 3, 89685270, 89685314, 1196, 1240),
new TranscriptRegion(TranscriptRegionType.Intron, 3, 89685315, 89690802, 1240, 1241),
new TranscriptRegion(TranscriptRegionType.Exon, 4, 89690803, 89690846, 1241, 1284),
new TranscriptRegion(TranscriptRegionType.Intron, 4, 89690847, 89692769, 1284, 1285),
new TranscriptRegion(TranscriptRegionType.Exon, 5, 89692770, 89693008, 1285, 1523),
new TranscriptRegion(TranscriptRegionType.Intron, 5, 89693009, 89711874, 1523, 1524),
new TranscriptRegion(TranscriptRegionType.Exon, 6, 89711875, 89712016, 1524, 1665),
new TranscriptRegion(TranscriptRegionType.Intron, 6, 89712017, 89717609, 1665, 1666),
new TranscriptRegion(TranscriptRegionType.Exon, 7, 89717610, 89717776, 1666, 1832),
new TranscriptRegion(TranscriptRegionType.Intron, 7, 89717777, 89720650, 1832, 1833),
new TranscriptRegion(TranscriptRegionType.Exon, 8, 89720651, 89720875, 1833, 2057),
new TranscriptRegion(TranscriptRegionType.Intron, 8, 89720876, 89725043, 2057, 2058),
new TranscriptRegion(TranscriptRegionType.Exon, 9, 89725044, 89728532, 2058, 5546)
};

var translation = new Mock<ITranslation>();
translation.SetupGet(x => x.CodingRegion).Returns(new CodingRegion(89624227, 89725229, 1032, 2243, 1212));

var rnaEdits = new IRnaEdit[3];
rnaEdits[0] = new RnaEdit(667, 667, null);
rnaEdits[1] = new RnaEdit(707, 707, "C");
rnaEdits[2] = new RnaEdit(5548, 5547, "AAAAAAAAAAAAAAAAAAAAAAAAAA");

var transcript = new Mock<ITranscript>();
transcript.SetupGet(x => x.Id).Returns(CompactId.Convert("NM_000314", 4));
transcript.SetupGet(x => x.Chromosome).Returns(ChromosomeUtilities.Chr10);
transcript.SetupGet(x => x.Start).Returns(89623195);
transcript.SetupGet(x => x.End).Returns(89728532);
transcript.SetupGet(x => x.Gene.OnReverseStrand).Returns(false);
transcript.SetupGet(x => x.TranscriptRegions).Returns(regions);
transcript.SetupGet(x => x.Translation).Returns(translation.Object);
transcript.SetupGet(x => x.TotalExonLength).Returns(5546);
transcript.SetupGet(x => x.RnaEdits).Returns(rnaEdits);
return transcript.Object;
}

[Theory]
[InlineData(89623861, 89623861, "T", "", "T", VariantType.deletion, null)]
[InlineData(89623861, 89623861, "T", "G", "T", VariantType.SNV, null)]
[InlineData(89623901, 89623901, "G", "C", "C", VariantType.SNV, "NM_000314.4:c.-326=")]
[InlineData(89623901, 89623901, "G", "T", "C", VariantType.SNV, "NM_000314.4:c.-326C>T")]
[InlineData(89623861, 89623863, "TGG", "", "GG", VariantType.deletion, "NM_000314.4:c.-365_-364del")]
[InlineData(89623859, 89623861, "GCT", "", "GC", VariantType.deletion, "NM_000314.4:c.-367_-366del")]
[InlineData(89623860, 89623862, "CTG", "", "CG", VariantType.deletion, "NM_000314.4:c.-366_-365del")]
[InlineData(89624304, 89624308, "CTGTA", "", "CT", VariantType.deletion, "NM_000314.4:c.78_79+3del")]
[InlineData(89624308, 89624310, "ATC", "", "ATC", VariantType.deletion, "NM_000314.4:c.79+3_79+5del")]
public void GetHgvscAnnotation_in_intron_gap_substitution(int variantStart, int variantEnd, string reference, string alt,
string transcriptRef, VariantType variantType, string expectedHgvsc)
{
var (startIndex, _) =
MappedPositionUtilities.FindRegion(_gapTranscript.TranscriptRegions, variantStart);
var (endIndex, _) =
MappedPositionUtilities.FindRegion(_gapTranscript.TranscriptRegions, variantEnd);
var variant = new SimpleVariant(ChromosomeUtilities.Chr10, variantStart, variantEnd, reference, alt, variantType);
var observedHgvsc =
HgvsCodingNomenclature.GetHgvscAnnotation(_gapTranscript, variant, null, startIndex, endIndex, transcriptRef, null);

Assert.Equal(expectedHgvsc, observedHgvsc);
}
[Fact]
public void GetHgvscAnnotation_substitution_in_3UTR()
{
var variant = new SimpleVariant(ChromosomeUtilities.Chr1, 1260247, 1260247, "A", "G", VariantType.SNV);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, null, 0, 0);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, null, 0, 0, null, null);

Assert.Equal("ENST00000343938.4:c.-311A>G", observedHgvsc);
}
Expand All @@ -104,7 +176,7 @@ public void GetHgvscAnnotation_substitution_in_3UTR()
public void GetHgvscAnnotation_substitution_in_intron_before_TSS()
{
var variant = new SimpleVariant(ChromosomeUtilities.Chr1, 1262210, 1262210, "C", "G", VariantType.SNV);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, null, 1, 1);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, null, 1, 1, null, null);

Assert.Equal("ENST00000343938.4:c.-75-6C>G", observedHgvsc);
}
Expand All @@ -116,7 +188,7 @@ public void GetHgvscAnnotation_insertion_in_coding_region()
sequence.Setup(x => x.Substring(1262627, 1)).Returns("A");

var variant = new SimpleVariant(ChromosomeUtilities.Chr1, 1262629, 1262628, "", "G", VariantType.insertion);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, sequence.Object, 4, 4);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, sequence.Object, 4, 4, null, null);

Assert.Equal("ENST00000343938.4:c.130_131insG", observedHgvsc);
}
Expand All @@ -128,7 +200,7 @@ public void GetHgvscAnnotation_insertion_after_coding_region()
sequence.Setup(x => x.Substring(1262627, 1)).Returns("A");

var variant = new SimpleVariant(ChromosomeUtilities.Chr1, 1263159, 1263158, "", "G", VariantType.insertion);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, sequence.Object, 4, 4);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, sequence.Object, 4, 4, null, null);

Assert.Equal("ENST00000343938.4:c.*15_*16insG", observedHgvsc);
}
Expand All @@ -140,7 +212,7 @@ public void GetHgvscAnnotation_duplication_in_coding_region()
sequence.Setup(x => x.Substring(1262626, 2)).Returns("TA");

var variant = new SimpleVariant(ChromosomeUtilities.Chr1, 1262629, 1262628, "", "TA", VariantType.insertion);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, sequence.Object, 4, 4);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, sequence.Object, 4, 4, null, null);

Assert.Equal("ENST00000343938.4:c.129_130dupTA", observedHgvsc);
}
Expand Down Expand Up @@ -180,7 +252,7 @@ public void ApplyDuplicationAdjustments_Coding_Forward()
public void GetHgvscAnnotation_Deletion_start_before_transcript()
{
var variant = new SimpleVariant(ChromosomeUtilities.Chr1, 1260144, 1260148, "ATGTC", "", VariantType.deletion);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, null, -1, 0);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, null, -1, 0, null, null);

Assert.Null(observedHgvsc);
}
Expand All @@ -189,16 +261,16 @@ public void GetHgvscAnnotation_Deletion_start_before_transcript()
public void GetHgvscAnnotation_Delin_start_from_Exon_end_in_intron()
{
var variant = new SimpleVariant(ChromosomeUtilities.Chr1, 1262410, 1262414, "ATGTC", "TG", VariantType.indel);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, null, 2, 3);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, null, 2, 3, null, null);

Assert.Equal("ENST00000343938.4:c.120_122+2delATGTCinsTG", observedHgvsc);
Assert.Equal("ENST00000343938.4:c.120_122+2delinsTG", observedHgvsc);
}

[Fact]
public void GetHgvscAnnotation_inversion_start_from_Exon_end_in_intron()
{
var variant = new SimpleVariant(ChromosomeUtilities.Chr1, 1262410, 1262414, "ATGTC", "GACAT", VariantType.MNV);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, null, 2, 3);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, null, 2, 3, null, null);

Assert.Equal("ENST00000343938.4:c.120_122+2invATGTC", observedHgvsc);
}
Expand All @@ -207,7 +279,7 @@ public void GetHgvscAnnotation_inversion_start_from_Exon_end_in_intron()
public void GetHgvscAnnotation_Deletion_end_after_transcript()
{
var variant = new SimpleVariant(ChromosomeUtilities.Chr1, 1260143, 1260148, "ATGTC", "", VariantType.deletion);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, null, -1, 0);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, null, -1, 0, null, null);

Assert.Null(observedHgvsc);
}
Expand All @@ -216,7 +288,7 @@ public void GetHgvscAnnotation_Deletion_end_after_transcript()
public void GetHgvscAnnotation_Reference_no_hgvsc()
{
var variant = new SimpleVariant(ChromosomeUtilities.Chr1, 1260138, 1260138, "A", "A", VariantType.reference);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, null, -1, -1);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_forwardTranscript, variant, null, -1, -1, null, null);

Assert.Null(observedHgvsc);
}
Expand All @@ -225,7 +297,7 @@ public void GetHgvscAnnotation_Reference_no_hgvsc()
public void GetHgvscAnnotation_substitution_in_intron_of_reverse_gene()
{
var variant = new SimpleVariant(ChromosomeUtilities.Chr1, 136000, 136000, "A", "G", VariantType.SNV);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_reverseTranscript, variant, null, 1, 1);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_reverseTranscript, variant, null, 1, 1, null, null);

Assert.Equal("ENST00000423372.3:c.*910-198T>C", observedHgvsc);
}
Expand All @@ -234,7 +306,7 @@ public void GetHgvscAnnotation_substitution_in_intron_of_reverse_gene()
public void GetHgvscAnnotation_substitution_after_stopCodon_of_reverse_gene()
{
var variant = new SimpleVariant(ChromosomeUtilities.Chr1, 138529, 138529, "A", "G", VariantType.SNV);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_reverseTranscript, variant, null, 2, -1);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_reverseTranscript, variant, null, 2, -1, null, null);

Assert.Equal("ENST00000423372.3:c.*1T>C", observedHgvsc);
}
Expand All @@ -243,9 +315,9 @@ public void GetHgvscAnnotation_substitution_after_stopCodon_of_reverse_gene()
public void GetHgvscAnnotation_deletion_of_reverse_gene()
{
var variant = new SimpleVariant(ChromosomeUtilities.Chr1, 135802, 137619, "ATCGTGGGTTGT", "", VariantType.deletion);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_reverseTranscript, variant, null, 0, 1);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(_reverseTranscript, variant, null, 0, 1, null, null);

Assert.Equal("ENST00000423372.3:c.*909+2_*910delACAACCCACGAT", observedHgvsc);
Assert.Equal("ENST00000423372.3:c.*909+2_*910del", observedHgvsc);
}

[Fact]
Expand All @@ -255,7 +327,7 @@ public void GetHgvscAnnotation_insertion_at_last_position()
sequence.Setup(x => x.Substring(70361157-12, 12)).Returns("TATATATATATA");

var variant = new SimpleVariant(ChromosomeUtilities.ChrX, 70361157, 70361156, "", "ACACCAGCAGCA", VariantType.insertion);//right shifted variant
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(GetForwardTranscriptWithoutUtr(), variant, sequence.Object, 0, 0);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(GetForwardTranscriptWithoutUtr(), variant, sequence.Object, 0, 0, null, null);

Assert.Equal("ENST00000579622.1:n.122_123insACACCAGCAGCA", observedHgvsc);
}
Expand All @@ -267,7 +339,7 @@ public void GetHgvscAnnotation_duplication_at_last_position()
sequence.Setup(x => x.Substring(70361156 - 4, 4)).Returns("ACAC");

var variant = new SimpleVariant(ChromosomeUtilities.ChrX, 70361157, 70361156, "", "ACAC", VariantType.insertion);//right shifted variant
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(GetForwardTranscriptWithoutUtr(), variant, sequence.Object, 0, 0);
var observedHgvsc = HgvsCodingNomenclature.GetHgvscAnnotation(GetForwardTranscriptWithoutUtr(), variant, sequence.Object, 0, 0, null, null);

Assert.Equal("ENST00000579622.1:n.119_122dupACAC", observedHgvsc);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void GetHgvsProteinAnnotation_no_change()

var hgvspNotation = annotatedTranscript.HgvsProtein;

Assert.Equal("ENST00000343938.4:c.10_12delTCGinsAGT(p.(Ser4=))", hgvspNotation);
Assert.Equal("ENST00000343938.4:c.10_12delinsAGT(p.(Ser4=))", hgvspNotation);
}

[Fact]
Expand Down
Loading

0 comments on commit a57e78a

Please sign in to comment.