public void EvsOutputTest() { var sa = new SupplementaryAnnotationPosition(115256529); var dbSnp = new DbSnpAnnotation { DbSnp = new List <long> { 121913237 } }; var evs = new EvsAnnotation { EvsAll = "0.0001", EvsCoverage = "102", NumEvsSamples = "3456" }; var saCreator = new SupplementaryPositionCreator(sa); saCreator.AddExternalDataToAsa(DataSourceCommon.DataSource.Evs, "C", evs); saCreator.AddExternalDataToAsa(DataSourceCommon.DataSource.DbSnp, "C", dbSnp); var saReader = new MockSupplementaryAnnotationReader(sa); VcfUtilities.FieldContains(saReader, "chr1\t115256529\t.\tT\tC\t1000\tPASS\t.\tGT\t0/1", "EVS=0.0001|102|3456", VcfCommon.InfoIndex); }
public void AlleleFrequency1KgOutputTest() { var sa = new SupplementaryAnnotationPosition(115256529); var oneKg = new OneKGenAnnotation { OneKgAllAn = 5008, OneKgAllAc = 2130, OneKgAmrAn = 694, OneKgAmrAc = 250 }; var dbSnp = new DbSnpAnnotation { DbSnp = new List <long> { 11554290 } }; var saCreator = new SupplementaryPositionCreator(sa); saCreator.AddExternalDataToAsa(DataSourceCommon.DataSource.OneKg, "C", oneKg); saCreator.AddExternalDataToAsa(DataSourceCommon.DataSource.DbSnp, "C", dbSnp); var saReader = new MockSupplementaryAnnotationReader(sa); VcfUtilities.FieldContains(saReader, "chr1\t115256529\t.\tT\tC\t1000\tPASS\t.\tGT\t0/1", "AF1000G=0.425319", VcfCommon.InfoIndex); }
public void OneAlleleFreqMissing() { var sa = new SupplementaryAnnotationPosition(825069); var saCreator = new SupplementaryPositionCreator(sa); var dbSnp = new DbSnpAnnotation { DbSnp = new List <long> { 4475692 } }; var oneKg = new OneKGenAnnotation { OneKgAllAn = 5008, OneKgAllAc = 3392 }; saCreator.AddExternalDataToAsa(DataSourceCommon.DataSource.DbSnp, "C", dbSnp); saCreator.AddExternalDataToAsa(DataSourceCommon.DataSource.OneKg, "C", oneKg); var saReader = new MockSupplementaryAnnotationReader(sa); VcfUtilities.FieldContains(saReader, "chr1 825069 rs4475692 G A,C 362.00 LowGQX;HighDPFRatio SNVSB=-36.9;SNVHPOL=3 GT:GQ:GQX:DP:DPF:AD 1/2:4:0:52:38:8,11,33", "AF1000G=.,0.677316", VcfCommon.InfoIndex); }
public void CosmicOutputTest() { var sa = new SupplementaryAnnotationPosition(115256529); var saCreator = new SupplementaryPositionCreator(sa); var altAllele = "C"; var cosmicItem1 = new CosmicItem("chr1", 115256529, "COSM1000", "T", altAllele, "TP53", new HashSet <CosmicItem.CosmicStudy> { new CosmicItem.CosmicStudy("", "carcinoma", "oesophagus") }, 1, altAllele); var cosmicItem2 = new CosmicItem("chr1", 115256529, "COSM1001", "T", altAllele, "TP53", new HashSet <CosmicItem.CosmicStudy> { new CosmicItem.CosmicStudy("01", "carcinoma", "large_intestine") }, 1, altAllele); cosmicItem1.AddCosmicToSa(saCreator); cosmicItem2.AddCosmicToSa(saCreator); var saReader = new MockSupplementaryAnnotationReader(sa); VcfUtilities.FieldContains(saReader, "chr1\t115256529\t.\tT\tC\t1000\tPASS\t.\tGT\t0/1", "cosmic=1|COSM1000", VcfCommon.InfoIndex); }
public void MergeSnvAndDeletion() { // NIR-906 const string vcfLine1 = "1 862389 rs6693546 A G . . RS=6693546;RSPOS=862389;dbSNPBuildID=116;SSR=0;SAO=0;VP=0x05010008000515013e000100;WGT=1;VC=SNV;SLO;INT;ASP;VLD;G5;GNO;KGPhase1;KGPhase3;CAF=0.3171,0.6829;COMMON=1"; const string vcfLine2 = "1 862388 rs534606253 GA G . . RS=534606253;RSPOS=862389;dbSNPBuildID=142;SSR=0;SAO=0;VP=0x050000080005040024000200;WGT=1;VC=DIV;INT;ASP;VLD;KGPhase3;CAF=0.996,0.003994;COMMON=1"; var dbsnpReader = new DbSnpReader(_renamer); var dbSnpEntry1 = dbsnpReader.ExtractItem(vcfLine1)[0]; var dbSnpEntry2 = dbsnpReader.ExtractItem(vcfLine2)[0]; var sa = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(862389)); dbSnpEntry1.SetSupplementaryAnnotations(sa); var sa2 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(862389)); var additionalEntry = dbSnpEntry2.SetSupplementaryAnnotations(sa2); additionalEntry.SetSupplementaryAnnotations(sa2); sa.MergeSaCreator(sa2); sa.FinalizePositionalAnnotations(); Assert.Equal("G", sa.SaPosition.GlobalMajorAllele); Assert.Equal("0.6829", sa.SaPosition.GlobalMajorAlleleFrequency); Assert.Equal("A", sa.SaPosition.GlobalMinorAllele); Assert.Equal("0.3171", sa.SaPosition.GlobalMinorAlleleFrequency); }
public void NumEvsSamplesTest() { const string vcfLine = "1 1564952 rs112177324 TG TGG,T . PASS BSNP=dbSNP_132;EA_AC=2,3039,4701;AA_AC=44,279,3231;TAC=46,3318,7932;MAF=39.2793,9.0884,29.7805;GTS=A1A1,A1A2,A1R,A2A2,A2R,RR;EA_GTC=0,1,1,707,1624,1538;AA_GTC=4,4,32,41,193,1503;GTC=4,5,33,748,1817,3041;DP=10;GL=MIB2;CP=0.8;CG=-0.0;AA=.;CA=.;EXOME_CHIP=no;GWAS_PUBMED=.;FG=NM_080875.2:intron,NM_080875.2:intron,NM_001170689.1:intron,NM_001170689.1:intron,NM_001170688.1:intron,NM_001170688.1:intron,NM_001170687.1:intron,NM_001170687.1:intron,NM_001170686.1:intron,NM_001170686.1:intron;HGVS_CDNA_VAR=NM_080875.2:c.2908+7del1,NM_080875.2:c.2908+6_2908+7insG,NM_001170689.1:c.2187-66del1,NM_001170689.1:c.2187-67_2187-66insG,NM_001170688.1:c.2713+7del1,NM_001170688.1:c.2713+6_2713+7insG,NM_001170687.1:c.2866+7del1,NM_001170687.1:c.2866+6_2866+7insG,NM_001170686.1:c.2896+7del1,NM_001170686.1:c.2896+6_28967insG;HGVS_PROTEIN_VAR=.,.,.,.,.,.,.,.,.,.;CDS_SIZES=NM_080875.2:3213,NM_080875.2:3213,NM_001170689.1:2262,NM_001170689.1:2262,NM_001170688.1:3018,NM_001170688.1:3018,NM_001170687.1:3171,NM_001170687.1:3171,NM_001170686.1:3201,NM_001170686.1:3201;GS=.,.,.,.,.,.,.,.,.,.;PH=.,.,.,.,.,.,.,.,.,.;EA_AGE=.;AA_AGE=."; var evsReader = new EvsReader(_renamer); var evsItemsList = evsReader.ExtractItems(vcfLine); var sa = new SupplementaryAnnotationPosition(1564953); var saCreator = new SupplementaryPositionCreator(sa); var additionalItems = new List <SupplementaryDataItem>(); foreach (var evsItem in evsItemsList) { additionalItems.Add(evsItem.SetSupplementaryAnnotations(saCreator)); } foreach (var item in additionalItems) { item.SetSupplementaryAnnotations(saCreator); } var evs = sa.AlleleSpecificAnnotations["iG"].Annotations[DataSourceCommon.GetIndex(DataSourceCommon.DataSource.Evs)] as EvsAnnotation; Assert.NotNull(evs); Assert.Equal("5648", evs.NumEvsSamples);//GTC=4,5,33,748,1817,3041; }
public void MergeConflictingEvsItems() { const string vcfLine1 = "1 1564952 rs112177324 T G,A . PASS BSNP=dbSNP_132;EA_AC=2,3039,4701;AA_AC=44,279,3231;TAC=46,3318,7932;MAF=39.2793,9.0884,29.7805;GTS=A1A1,A1A2,A1R,A2A2,A2R,RR;EA_GTC=0,1,1,707,1624,1538;AA_GTC=4,4,32,41,193,1503;GTC=4,5,33,748,1817,3041;DP=10;GL=MIB2;CP=0.8;CG=-0.0;AA=.;CA=.;EXOME_CHIP=no;GWAS_PUBMED=.;FG=NM_080875.2:intron,NM_080875.2:intron,NM_001170689.1:intron,NM_001170689.1:intron,NM_001170688.1:intron,NM_001170688.1:intron,NM_001170687.1:intron,NM_001170687.1:intron,NM_001170686.1:intron,NM_001170686.1:intron;HGVS_CDNA_VAR=NM_080875.2:c.2908+7del1,NM_080875.2:c.2908+6_2908+7insG,NM_001170689.1:c.2187-66del1,NM_001170689.1:c.2187-67_2187-66insG,NM_001170688.1:c.2713+7del1,NM_001170688.1:c.2713+6_2713+7insG,NM_001170687.1:c.2866+7del1,NM_001170687.1:c.2866+6_2866+7insG,NM_001170686.1:c.2896+7del1,NM_001170686.1:c.2896+6_28967insG;HGVS_PROTEIN_VAR=.,.,.,.,.,.,.,.,.,.;CDS_SIZES=NM_080875.2:3213,NM_080875.2:3213,NM_001170689.1:2262,NM_001170689.1:2262,NM_001170688.1:3018,NM_001170688.1:3018,NM_001170687.1:3171,NM_001170687.1:3171,NM_001170686.1:3201,NM_001170686.1:3201;GS=.,.,.,.,.,.,.,.,.,.;PH=.,.,.,.,.,.,.,.,.,.;EA_AGE=.;AA_AGE=."; const string vcfLine2 = "1 1564952 rs140739101 T A . PASS BSNP=dbSNP_134;EA_AC=313,6535;AA_AC=14,3808;TAC=327,10343;MAF=4.5707,0.3663,3.0647;GTS=GG,GT,TT;EA_GTC=92,129,3203;AA_GTC=1,12,1898;GTC=93,141,5101;DP=110;GL=OR4F5;CP=1.0;CG=0.9;AA=T;CA=.;EXOME_CHIP=no;GWAS_PUBMED=.;FG=NM_001005484.1:missense;HGVS_CDNA_VAR=NM_001005484.1:c.338T>G;HGVS_PROTEIN_VAR=NM_001005484.1:p.(F113C);CDS_SIZES=NM_001005484.1:918;GS=205;PH=probably-damaging:0.999;EA_AGE=.;AA_AGE=."; var sa1 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(1564952)); var sa2 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(1564952)); var evsReader = new EvsReader(_renamer); var evsItems = evsReader.ExtractItems(vcfLine1); foreach (var item in evsItems) { item.SetSupplementaryAnnotations(sa1); } evsItems.Clear(); evsItems.AddRange(evsReader.ExtractItems(vcfLine2)); foreach (var item in evsItems) { item?.SetSupplementaryAnnotations(sa2); } sa1.MergeSaCreator(sa2); var evs = sa1.SaPosition.AlleleSpecificAnnotations["A"].Annotations[DataSourceCommon.GetIndex(DataSourceCommon.DataSource.Evs)] as EvsAnnotation; Assert.NotNull(evs); Assert.True(evs.HasConflicts); }
public void MergeConflictingOneKitemsSnv() { const string vcfLine1 = "X 129354240 rs1160681 C A 100 PASS AC=1996;AF=0.528742;AN=3775;NS=2504;DP=10421;AMR_AF=0.353;AFR_AF=0.5953;EUR_AF=0.3052;SAS_AF=0.3896;EAS_AF=0.2738;AA=C|||;VT=SNP"; const string vcfLine2 = "X 129354240 . C A,G 100 PASS AC=1981,15;AF=0.524768,0.00397351;AN=3775;NS=2504;DP=10421;AMR_AF=0.353,0;AFR_AF=0.584,0.0113;EUR_AF=0.3052,0;SAS_AF=0.3896,0;EAS_AF=0.2738,0;AA=C|||;VT=SNP;MULTI_ALLELIC"; var sa1 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(129354240)); var sa2 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(129354240)); var oneKitem1 = _oneKGenReader.ExtractItems(vcfLine1)[0]; oneKitem1.SetSupplementaryAnnotations(sa1); foreach (var oneKitem in _oneKGenReader.ExtractItems(vcfLine2)) { oneKitem.SetSupplementaryAnnotations(sa2); } sa1.MergeSaCreator(sa2); var oneKg = sa1.SaPosition.AlleleSpecificAnnotations["A"].Annotations[DataSourceCommon.GetIndex(DataSourceCommon.DataSource.OneKg)] as OneKGenAnnotation; Assert.NotNull(oneKg); Assert.True(oneKg.HasConflicts); }
public void MergeConflictingExacItems() { const string vcfLine1 = "1 13528 . C G,T 1771.54 VQSRTrancheSNP99.60to99.80 AC=21,11;AC_AFR=12,0;AC_AMR=1,0;AC_Adj=13,9;AC_EAS=0,0;AC_FIN=0,0;AC_Het=13,9,0;AC_Hom=0,0;AC_NFE=0,2;AC_OTH=0,0;AC_SAS=0,7;AF=6.036e-04,3.162e-04;AN=34792;AN_AFR=390;AN_AMR=116;AN_Adj=10426;AN_EAS=150;AN_FIN=8;AN_NFE=2614;AN_OTH=116;AN_SAS=7032;BaseQRankSum=1.23;ClippingRankSum=0.056;DP=144988;FS=0.000;GQ_MEAN=14.54;GQ_STDDEV=16.53;Het_AFR=12,0,0;Het_AMR=1,0,0;Het_EAS=0,0,0;Het_FIN=0,0,0;Het_NFE=0,2,0;Het_OTH=0,0,0;Het_SAS=0,7,0;Hom_AFR=0,0;Hom_AMR=0,0;Hom_EAS=0,0;Hom_FIN=0,0;Hom_NFE=0,0;Hom_OTH=0,0;Hom_SAS=0,0;InbreedingCoeff=0.0557;MQ=31.08;MQ0=0;MQRankSum=-5.410e-01;NCC=67387;QD=1.91;ReadPosRankSum=0.206;VQSLOD=-2.705e+00;culprit=MQ;DP_HIST=10573|1503|705|1265|2477|613|167|52|18|11|8|3|0|0|1|0|0|0|0|0,2|6|2|1|4|0|3|1|0|0|2|0|0|0|0|0|0|0|0|0,1|0|0|0|1|1|3|0|1|1|1|0|0|0|1|0|0|0|0|0;GQ_HIST=342|11195|83|56|3154|517|367|60|12|4|5|7|1373|180|15|16|1|0|1|8,0|0|1|0|1|0|3|1|0|1|2|0|1|2|0|1|1|0|1|6,0|1|0|0|1|1|0|0|1|0|0|1|1|1|1|0|0|0|0|2"; const string vcfLine2 = "1 13528 . C T 334.33 VQSRTrancheSNP99.60to99.80 AC=2;AC_AFR=0;AC_AMR=0;AC_Adj=2;AC_EAS=0;AC_FIN=0;AC_Het=2;AC_Hom=0;AC_NFE=0;AC_OTH=0;AC_SAS=2;AF=5.957e-05;AN=33576;AN_AFR=392;AN_AMR=114;AN_Adj=10200;AN_EAS=146;AN_FIN=6;AN_NFE=2556;AN_OTH=110;AN_SAS=6876;BaseQRankSum=-1.988e+00;ClippingRankSum=0.525;DP=142450;FS=2.634;GQ_MEAN=14.30;GQ_STDDEV=15.90;Het_AFR=0;Het_AMR=0;Het_EAS=0;Het_FIN=0;Het_NFE=0;Het_OTH=0;Het_SAS=2;Hom_AFR=0;Hom_AMR=0;Hom_EAS=0;Hom_FIN=0;Hom_NFE=0;Hom_OTH=0;Hom_SAS=0;InbreedingCoeff=-0.0753;MQ=31.78;MQ0=0;MQRankSum=0.578;NCC=68350;QD=5.31;ReadPosRankSum=-5.730e-01;VQSLOD=-3.582e+00;culprit=MQ;DP_HIST=10108|1417|742|1238|2324|682|184|56|20|11|4|2|0|0|0|0|0|0|0|0,0|0|0|1|0|0|0|0|0|1|0|0|0|0|0|0|0|0|0|0;GQ_HIST=335|10726|91|50|3215|542|410|67|10|3|1|6|1138|163|14|15|0|0|0|2,0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|2;DOUBLETON_DIST=0.028857408061;AC_MALE=1;AC_FEMALE=1;AN_MALE=7294;AN_FEMALE=2906;AC_CONSANGUINEOUS=0;AN_CONSANGUINEOUS=1360;Hom_CONSANGUINEOUS=0;"; var sa1 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(13528)); var sa2 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(13528)); var exacReader = new ExacReader(_renamer); var exacItems = exacReader.ExtractItems(vcfLine1); foreach (var item in exacItems) { item.SetSupplementaryAnnotations(sa1); } exacItems.Clear(); exacItems.AddRange(exacReader.ExtractItems(vcfLine2)); foreach (var item in exacItems) { item?.SetSupplementaryAnnotations(sa2); } sa1.MergeSaCreator(sa2); var exac = sa1.SaPosition.AlleleSpecificAnnotations["T"].Annotations[DataSourceCommon.GetIndex(DataSourceCommon.DataSource.Exac)] as ExacAnnotation; Assert.NotNull(exac); Assert.True(exac.HasConflicts); }
public void MergeDbSnp1Kg() { //NIR-1262 const string vcfLine = "1 825069 rs4475692 G A,C . . RS=4475692;RSPOS=825069;dbSNPBuildID=111;SSR=0;SAO=0;VP=0x050100000005170126000100;WGT=1;VC=SNV;SLO;ASP;VLD;G5A;G5;GNO;KGPhase3;CAF=0.3227,.,0.6773;COMMON=1"; const string vcfLine1Kg = "1 825069 rs4475692 G C 100 PASS AC=3392;AF=0.677316;AN=5008;NS=2504;DP=22495;EAS_AF=0.754;AMR_AF=0.5692;AFR_AF=0.6127;EUR_AF=0.7286;SAS_AF=0.7096;AA=g|||;VT=SNP;EAS_AN=1008;EAS_AC=760;EUR_AN=1006;EUR_AC=733;AFR_AN=1322;AFR_AC=810;AMR_AN=694;AMR_AC=395;SAS_AN=978;SAS_AC=694\tGT"; var dbsnpReader = new DbSnpReader(_renamer); var sa = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(825069)); foreach (var dbSnpEntry in dbsnpReader.ExtractItem(vcfLine)) { dbSnpEntry.SetSupplementaryAnnotations(sa); } var sa1 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(825069)); var onekgReader = new OneKGenReader(_renamer); foreach (var onekgItem in onekgReader.ExtractItems(vcfLine1Kg)) { onekgItem.SetSupplementaryAnnotations(sa1); } sa.MergeSaCreator(sa1); sa.FinalizePositionalAnnotations(); Assert.Equal("C", sa.SaPosition.GlobalMajorAllele); Assert.Equal("G", sa.SaPosition.GlobalMinorAllele); }
public void AlleleFrequencyArbitration() { const string vcfLine1 = "4 170887158 rs34734657 GCAAAA G 100 PASS AC=2222;AF=0.44369;AN=5008;NS=2504;DP=30687;EAS_AF=0.0675;AMR_AF=0.5447;AFR_AF=0.6377;EUR_AF=0.5547;SAS_AF=0.3834;VT=INDEL"; const string vcfLine2 = "4 170887158 rs556076439;rs34734657 GCAAAA GCAAAACAAAA,G 100 PASS AC=69,650;AF=0.013778,0.129792;AN=5008;NS=2504;DP=30687;EAS_AF=0.0109,0.2331;AMR_AF=0.0331,0.0303;AFR_AF=0.0045,0.1165;EUR_AF=0.0209,0.0099;SAS_AF=0.0082,0.2352;VT=INDEL;MULTI_ALLELIC"; const string vcfLine3 = "4 170887158 rs536596553 GCAAAACAAAACAAAA G 100 PASS AC=32;AF=0.00638978;AN=5008;NS=2504;DP=30687;EAS_AF=0;AMR_AF=0.0029;AFR_AF=0.0023;EUR_AF=0.0268;SAS_AF=0;VT=INDEL"; var sa1 = new SupplementaryPositionCreator(); var additionalItems = _oneKGenReader.ExtractItems(vcfLine1).Select(oneKitem => oneKitem.SetSupplementaryAnnotations(sa1)).ToList(); additionalItems.AddRange(_oneKGenReader.ExtractItems(vcfLine2).Select(oneKitem => oneKitem.SetSupplementaryAnnotations(sa1))); additionalItems.AddRange(_oneKGenReader.ExtractItems(vcfLine3).Select(oneKitem => oneKitem.SetSupplementaryAnnotations(sa1))); foreach (var item in additionalItems) { item.SetSupplementaryAnnotations(sa1); } var oneKg = sa1.SaPosition.AlleleSpecificAnnotations["5"].Annotations[DataSourceCommon.GetIndex(DataSourceCommon.DataSource.OneKg) ] as OneKGenAnnotation; Assert.NotNull(oneKg); Assert.True(oneKg.HasConflicts); Assert.Null(oneKg.OneKgAllAc); }
private void CloseCurrentSaWriter() { if (_currentRefName == null) { return; } //write last SA item if (!_prevSaCreator.IsEmpty()) { _saWriter.Write(_prevSaCreator, _prevSaCreator.ReferencePosition); _numSaWritten++; } // reset _prevSa _prevSaCreator = null; // write the intervals _saWriter.SetIntervalList(_supplementaryIntervalList); Console.WriteLine("No of intervals: {0}", _supplementaryIntervalList.Count); _saWriter.Dispose(); double lookupsPerSecond; Console.WriteLine("No of annotations : {0}", _numSaWritten); Console.WriteLine("{0} supplementary annotations written - {1}", _numSaWritten, _creationBench.GetElapsedIterationTime(_numSaWritten, "variants", out lookupsPerSecond)); Console.WriteLine("No of ref minor positions: {0}", _saWriter.RefMinorCount); }
public void DeletionAndSnvMerge() { // NIR-906 const string vcfLine1 = "2 193187631 rs774176075 TGTTG T . . RS=774176075;RSPOS=193187632;dbSNPBuildID=144;SSR=0;SAO=0;VP=0x050000000005000002000200;WGT=1;VC=DIV;ASP"; const string vcfLine2 = "2 193187632 rs2592266 G T . . RS=2592266;RSPOS=193187632;dbSNPBuildID=100;SSR=0;SAO=0;VP=0x050000000005150026000100;WGT=1;VC=SNV;ASP;VLD;G5;KGPhase3;CAF=0.01937,0.9806;COMMON=1"; var dbsnpReader = new DbSnpReader(_renamer); var dbSnpEntry1 = dbsnpReader.ExtractItem(vcfLine1)[0]; var dbSnpEntry2 = dbsnpReader.ExtractItem(vcfLine2)[0]; var sa = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(193187632)); var additionalEntry = dbSnpEntry1.SetSupplementaryAnnotations(sa); additionalEntry.SetSupplementaryAnnotations(sa); var sa2 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(193187632)); dbSnpEntry2.SetSupplementaryAnnotations(sa2); sa.MergeSaCreator(sa2); sa.FinalizePositionalAnnotations(); Assert.Equal("T", sa.SaPosition.GlobalMajorAllele); Assert.Equal("0.9806", sa.SaPosition.GlobalMajorAlleleFrequency); Assert.Equal("G", sa.SaPosition.GlobalMinorAllele); Assert.Equal("0.01937", sa.SaPosition.GlobalMinorAlleleFrequency); }
public void MergeDbSnp1KpEvsRefMinor() { const string vcfLine1 = "1 69428 rs140739101 T G . . RS=140739101;RSPOS=69428;dbSNPBuildID=134;SSR=0;SAO=0;VP=0x050200000a05140026000100;WGT=1;VC=SNV;S3D;NSM;REF;ASP;VLD;KGPhase3;CAF=0.981,0.01897;COMMON=1"; //vcf line is modified const string vcfLine2 = "1 69428 rs140739101 T G 100 PASS AC=4956;AF=0.989617;AN=5008;NS=2504;DP=17611;EAS_AF=0.003;AMR_AF=0.036;AFR_AF=0.0015;EUR_AF=0.0497;SAS_AF=0.0153;AA=.|||;VT=SNP;EX_TARGET;EAS_AN=1008;EAS_AC=3;EUR_AN=1006;EUR_AC=50;AFR_AN=1322;AFR_AC=2;AMR_AN=694;AMR_AC=25;SAS_AN=978;SAS_AC=15"; const string vcfLine3 = "1 69428 rs140739101 T G . PASS BSNP=dbSNP_134;EA_AC=313,6535;AA_AC=14,3808;TAC=327,10343;MAF=4.5707,0.3663,3.0647;GTS=GG,GT,TT;EA_GTC=92,129,3203;AA_GTC=1,12,1898;GTC=93,141,5101;DP=110;GL=OR4F5;CP=1.0;CG=0.9;AA=T;CA=.;EXOME_CHIP=no;GWAS_PUBMED=.;FG=NM_001005484.1:missense;HGVS_CDNA_VAR=NM_001005484.1:c.338T>G;HGVS_PROTEIN_VAR=NM_001005484.1:p.(F113C);CDS_SIZES=NM_001005484.1:918;GS=205;PH=probably-damaging:0.999;EA_AGE=.;AA_AGE=."; var sa = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(69428)); var dbsnpReader = new DbSnpReader(_renamer); var dbSnpItem = dbsnpReader.ExtractItem(vcfLine1)[0]; dbSnpItem.SetSupplementaryAnnotations(sa); var oneKGenItem = _oneKGenReader.ExtractItems(vcfLine2)[0]; oneKGenItem.SetSupplementaryAnnotations(sa); var evsReader = new EvsReader(_renamer); var evsItem = evsReader.ExtractItems(vcfLine3)[0]; evsItem.SetSupplementaryAnnotations(sa); sa.FinalizePositionalAnnotations(); var dbSnp = sa.SaPosition.AlleleSpecificAnnotations["G"].Annotations[DataSourceCommon.GetIndex(DataSourceCommon.DataSource.DbSnp)] as DbSnpAnnotation; Assert.NotNull(dbSnp); Assert.Equal(new List <long> { 140739101 }, dbSnp.DbSnp); Assert.Equal(true, sa.SaPosition.IsRefMinorAllele); }
public void MultipleDbsnpMerge() { // NIR-778, 805. The second dbSNP id is missing from the SA database. const string vcfLine1 = "17 3616153 rs34081014 C G . . RS=34081014;RSPOS=3616153;dbSNPBuildID=126;SSR=0;SAO=0;VP=0x050000000005140136000100;WGT=1;VC=SNV;ASP;VLD;GNO;KGPhase1;KGPhase3;CAF=0.9297,0.07029;COMMON=1"; const string vcfLine2 = "17 3616152 rs71362546 GCTG GCTT,GGTG . . RS=71362546;RSPOS=3616153;dbSNPBuildID=130;SSR=0;SAO=0;VP=0x050100000005000102000810;WGT=1;VC=MNV;SLO;ASP;GNO;NOC"; var sa1 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(3616153)); var sa2 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(3616153)); var dbsnpReader = new DbSnpReader(_renamer); var dbSnpItem1 = dbsnpReader.ExtractItem(vcfLine1)[0]; var dbSnpItems = dbsnpReader.ExtractItem(vcfLine2); dbSnpItem1.SetSupplementaryAnnotations(sa1); var additionalItems = dbSnpItems.Select(dbSnpItem => dbSnpItem.SetSupplementaryAnnotations(sa1)).ToList(); foreach (var item in additionalItems) { item.SetSupplementaryAnnotations(sa2); } sa1.MergeSaCreator(sa2); var dbSnp = sa1.SaPosition.AlleleSpecificAnnotations["G"].Annotations[DataSourceCommon.GetIndex(DataSourceCommon.DataSource.DbSnp)] as DbSnpAnnotation; Assert.NotNull(dbSnp); Assert.Equal(dbSnp.DbSnp, new List <long> { 34081014, 71362546 }); }
public void BadRefMinor2() { // NIR-1368 const string vcfLine1 = "X 1389061 . A C 100 PASS AC=3235;AF=0.645966;AN=5008;NS=2504;DP=13425;AMR_AF=0.7262;AFR_AF=0.2504;EUR_AF=0.8827;SAS_AF=0.7955;EAS_AF=0.7282;AA=a|||;VT=SNP"; const string vcfLine2 = "X 1389061 . A C,T 100 PASS AC=2120,1771;AF=0.423323,0.353634;AN=5008;NS=2504;DP=13425;AMR_AF=0.4625,0.2997;AFR_AF=0.087,0.5998;EUR_AF=0.6551,0.2306;SAS_AF=0.5859,0.2157;EAS_AF=0.4484,0.3244;AA=a|||;VT=SNP;MULTI_ALLELIC"; var sa1 = new SupplementaryPositionCreator(); var sa2 = new SupplementaryPositionCreator(); foreach (var oneKitem in _oneKGenReader.ExtractItems(vcfLine1)) { oneKitem.SetSupplementaryAnnotations(sa1); } foreach (var oneKitem in _oneKGenReader.ExtractItems(vcfLine2)) { oneKitem.SetSupplementaryAnnotations(sa2); } sa1.MergeSaCreator(sa2); Assert.False(sa1.IsRefMinor()); }
public void PrioretizingSymbolicAllele4Svs() { const string vcfLine = "X 101155257 rs373174489 GTGCAAAAGCTCTTTAGTTTAATTAGGTCTCAGCTATTTATCTTTGTTCTTAT G 100 PASS AN=3775;AC=1723;AF=0.456424;AA=;EAS_AN=764;EAS_AC=90;EAS_AF=0.1178;EUR_AN=766;EUR_AC=439;EUR_AF=0.5731;AFR_AN=1003;AFR_AC=839;AFR_AF=0.8365;AMR_AN=524;AMR_AC=180;AMR_AF=0.3435;SAS_AN=718;SAS_AC=175;SAS_AF=0.2437"; var oneKItems = _oneKGenReader.ExtractItems(vcfLine); Assert.False(oneKItems[0].IsInterval); var sa = new SupplementaryPositionCreator(); var additionalItems = new List <SupplementaryDataItem> { oneKItems[0].SetSupplementaryAnnotations(sa) }; foreach (var oneKitem in additionalItems) { oneKitem.SetSupplementaryAnnotations(sa); } var oneKg = sa.SaPosition.AlleleSpecificAnnotations["52"].Annotations[DataSourceCommon.GetIndex(DataSourceCommon.DataSource.OneKg)] as OneKGenAnnotation; Assert.Equal("0.456424", GetAlleleFrequency(oneKg?.OneKgAllAn, oneKg?.OneKgAllAc)); Assert.Equal("0.836491", GetAlleleFrequency(oneKg?.OneKgAfrAn, oneKg?.OneKgAfrAc)); Assert.Equal("0.343511", GetAlleleFrequency(oneKg?.OneKgAmrAn, oneKg?.OneKgAmrAc)); Assert.Equal("0.117801", GetAlleleFrequency(oneKg?.OneKgEasAn, oneKg?.OneKgEasAc)); Assert.Equal("0.573107", GetAlleleFrequency(oneKg?.OneKgEurAn, oneKg?.OneKgEurAc)); Assert.Equal("0.243733", GetAlleleFrequency(oneKg?.OneKgSasAn, oneKg?.OneKgSasAc)); }
public void MergeDbSnpClinVar() { const string vcfLine = "1 225592188 rs387906416 TAGAAGA CTTCTAG . . RS=387906416;RSPOS=225592188;RV;dbSNPBuildID=137;SSR=0;SAO=1;VP=0x050060000605000002110800;GENEINFO=LBR:3930;WGT=1;VC=MNV;PM;NSN;REF;ASP;LSD;OM"; var dbsnpReader = new DbSnpReader(_renamer); var dbSnpItems = dbsnpReader.ExtractItem(vcfLine); var sa = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(225592188)); foreach (var dbSnpItem in dbSnpItems) { dbSnpItem.SetSupplementaryAnnotations(sa); } var xmlReader = new ClinVarXmlReader(new FileInfo(Resources.TopPath("RCV000087262.xml")), _reader, _sequence); foreach (var clinVarItem in xmlReader) { var sa1 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(225592188)); clinVarItem.SetSupplementaryAnnotations(sa1); sa.MergeSaCreator(sa1); } Assert.Equal(1, sa.SaPosition.ClinVarItems.Count); foreach (var clinVarEntry in sa.SaPosition.ClinVarItems) { Assert.Equal(clinVarEntry.ID, "RCV000087262.3"); Assert.Equal(clinVarEntry.MedGenIDs.First(), "C0030779"); Assert.Equal(clinVarEntry.Phenotypes.First(), "Pelger-Huët anomaly"); } }
public void MultiVariantEntry() { var reader = new ClinVarXmlReader(new FileInfo(Resources.TopPath("RCV000007484.xml")), _reader, _sequence); foreach (var clinVarItem in reader) { switch (clinVarItem.Start) { case 8045031: Assert.Equal("G", clinVarItem.ReferenceAllele); Assert.Equal("A", clinVarItem.AltAllele); break; case 8021911: Assert.Equal("GTGCTGGACGGTGTCCCT", clinVarItem.AltAllele); var sa = new SupplementaryAnnotationPosition(clinVarItem.Start); var saCreator = new SupplementaryPositionCreator(sa); clinVarItem.SetSupplementaryAnnotations(saCreator); Assert.Equal("iGTGCTGGACGGTGTCCCT", clinVarItem.SaAltAllele); break; default: throw new InvalidDataException($"Unexpected clinvar item start point : {clinVarItem.Start}"); } } }
public void MultiAltAlleleTest() { var sa = new SupplementaryPositionCreator(); foreach (var oneKitem in _oneKGenReader.ExtractItems(VcfLine2)) { oneKitem.SetSupplementaryAnnotations(sa); } var oneKgG = sa.SaPosition.AlleleSpecificAnnotations["G"].Annotations[DataSourceCommon.GetIndex(DataSourceCommon.DataSource.OneKg)] as OneKGenAnnotation; var oneKgT = sa.SaPosition.AlleleSpecificAnnotations["T"].Annotations[DataSourceCommon.GetIndex(DataSourceCommon.DataSource.OneKg)] as OneKGenAnnotation; Assert.NotNull(oneKgG); Assert.NotNull(oneKgT); Assert.Equal("0.347244", GetAlleleFrequency(oneKgG.OneKgAllAn, oneKgG.OneKgAllAc)); Assert.Equal("0.322995", GetAlleleFrequency(oneKgG.OneKgAfrAn, oneKgG.OneKgAfrAc)); Assert.Equal("0.275216", GetAlleleFrequency(oneKgG.OneKgAmrAn, oneKgG.OneKgAmrAc)); Assert.Equal("0.481151", GetAlleleFrequency(oneKgG.OneKgEasAn, oneKgG.OneKgEasAc)); Assert.Equal("0.292247", GetAlleleFrequency(oneKgG.OneKgEurAn, oneKgG.OneKgEurAc)); Assert.Equal("0.349693", GetAlleleFrequency(oneKgG.OneKgSasAn, oneKgG.OneKgSasAc)); Assert.Equal("0.640974", GetAlleleFrequency(oneKgT.OneKgAllAn, oneKgT.OneKgAllAc)); Assert.Equal("0.636914", GetAlleleFrequency(oneKgT.OneKgAfrAn, oneKgT.OneKgAfrAc)); Assert.Equal("0.720461", GetAlleleFrequency(oneKgT.OneKgAmrAn, oneKgT.OneKgAmrAc)); Assert.Equal("0.518849", GetAlleleFrequency(oneKgT.OneKgEasAn, oneKgT.OneKgEasAc)); Assert.Equal("0.707753", GetAlleleFrequency(oneKgT.OneKgEurAn, oneKgT.OneKgEurAc)); //double check this one: 0.7077535 Assert.Equal("0.647239", GetAlleleFrequency(oneKgT.OneKgSasAn, oneKgT.OneKgSasAc)); }
public void MergeConflictingOneKitems1() { const string vcfLine1 = "1 20505705 rs35377696 C CTCTG,CTG,CTGTG 100 PASS AC=46,1513,152;AF=0.0091853,0.302117,0.0303514;AN=5008;NS=2504;DP=23578;EAS_AF=0,0.2718,0.0268;AMR_AF=0.0086,0.2939,0.0072;AFR_AF=0.0303,0.2693,0.0756;EUR_AF=0,0.3032,0.001;SAS_AF=0,0.3824,0.0194"; const string vcfLine2 = "1 20505705 . C CTG 100 PASS AC=4;AF=0.000798722;AN=5008;NS=2504;DP=23578;EAS_AF=0.002;AMR_AF=0;AFR_AF=0.0008;EUR_AF=0.001;SAS_AF=0"; //var sa1 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(20505706); //var sa2 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(20505706); var sa1 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(20505706)); var sa2 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(20505706)); var additionalItems = _oneKGenReader.ExtractItems(vcfLine1).Select(oneKitem => oneKitem.SetSupplementaryAnnotations(sa1)).ToList(); foreach (var item in additionalItems) { item.SetSupplementaryAnnotations(sa1); } additionalItems.Clear(); additionalItems.AddRange(_oneKGenReader.ExtractItems(vcfLine2).Select(oneKitem => oneKitem.SetSupplementaryAnnotations(sa2))); foreach (var item in additionalItems) { item?.SetSupplementaryAnnotations(sa2); } sa1.MergeSaCreator(sa2); Assert.True(sa1.SaPosition.AlleleSpecificAnnotations["iTG"].Annotations[DataSourceCommon.GetIndex(DataSourceCommon.DataSource.OneKg)].HasConflicts); // Assert.Null(sa1.AlleleSpecificAnnotations["iTG"].OneKgAll); }
public void DuplicateDbsnp() { // NIR-853: can't reproduce the problem at dbSnp parsing and merging. const string vcfLine1 = "1 8121167 rs34500567 C CAAT,CAATAATAAAATAATAATAATAAT,CAATAAT,CAAT . . RS=34500567;RSPOS=8121167;dbSNPBuildID=126;SSR=0;SAO=0;VP=0x050000000005000002000200;WGT=1;VC=DIV;ASP;CAF=0.9726,.,.,.,.,0.9726;COMMON=1"; const string vcfLine2 = "1 8121167 rs566669620 C CAATAATAAAAT . . RS=566669620;RSPOS=8121175;dbSNPBuildID=142;SSR=0;SAO=0;VP=0x050000000005040024000200;WGT=1;VC=DIV;ASP;VLD;KGPhase3;CAF=0.9726,0.0007987;COMMON=1"; const string vcfLine3 = "1 8121167 rs59792241 C CAAT,CAATAATAAAATAATAATAATAAT,CAATAAT,CAAT . . RS=59792241;RSPOS=8121205;dbSNPBuildID=137;SSR=0;SAO=0;VP=0x050000000005000002000200;WGT=1;VC=DIV;ASP;CAF=0.9726,.,.,.,.,0.9726;COMMON=1"; var dbsnpReader = new DbSnpReader(_renamer); var dbSnpItems1 = dbsnpReader.ExtractItem(vcfLine1); var dbSnpItems2 = dbsnpReader.ExtractItem(vcfLine2); var dbSnpItems3 = dbsnpReader.ExtractItem(vcfLine3); var sa1 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(8121168)); var sa2 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(8121168)); var sa3 = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(8121168)); var additionalItems = dbSnpItems1.Select(dbSnpItem => dbSnpItem.SetSupplementaryAnnotations(sa1)).ToList(); foreach (var item in additionalItems) { item.SetSupplementaryAnnotations(sa1); } additionalItems.Clear(); additionalItems.AddRange(dbSnpItems2.Select(dbSnpItem => dbSnpItem.SetSupplementaryAnnotations(sa2))); foreach (var item in additionalItems) { item.SetSupplementaryAnnotations(sa2); } additionalItems.Clear(); foreach (var dbSnpItem in dbSnpItems3) { additionalItems.Add(dbSnpItem.SetSupplementaryAnnotations(sa3)); } foreach (var item in additionalItems) { item.SetSupplementaryAnnotations(sa3); } sa1.MergeSaCreator(sa2); sa1.MergeSaCreator(sa3); var dbSnp = sa1.SaPosition.AlleleSpecificAnnotations["iAAT"].Annotations[DataSourceCommon.GetIndex(DataSourceCommon.DataSource.DbSnp)] as DbSnpAnnotation; Assert.NotNull(dbSnp); Assert.Equal(2, dbSnp.DbSnp.Count); Assert.Equal(34500567, dbSnp.DbSnp[0]); Assert.Equal(59792241, dbSnp.DbSnp[1]); }
private static bool IsSnv(string refAllele, string altAlleles) { if (!SupplementaryPositionCreator.IsSnv(refAllele)) { return(false); } return(altAlleles.Split(',').All(SupplementaryPositionCreator.IsSnv)); }
public void RwDbsnpGlobalAlleles() { //NIR-1262 var randomPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); // create our expected data source versions var dbSnpVersion = new DataSourceVersion("dbSNP", "147", DateTime.Parse("2016-07-26").Ticks); var expectedDataSourceVersions = new List <DataSourceVersion> { dbSnpVersion }; const string vcfLine1 = "2 141724543 rs112783784 A C,T . . RS=112783784;RSPOS=141724543;dbSNPBuildID=132;SSR=0;SAO=0;VP=0x050100080015140136000100;WGT=1;VC=SNV;SLO;INT;OTH;ASP;VLD;GNO;KGPhase1;KGPhase3;CAF=0.04113,0.9105,0.04832;COMMON=1"; const string vcfLine2 = "2 141724543 rs4300776 A C . . RS=4300776;RSPOS=141724543;dbSNPBuildID=111;SSR=0;SAO=0;VP=0x050100080015000102000100;WGT=1;VC=SNV;SLO;INT;OTH;ASP;GNO;CAF=0.04113,0.9105;COMMON=1"; var sa = new SupplementaryAnnotationPosition(141724543); var saCreator = new SupplementaryPositionCreator(sa); var dbsnpReader = new DbSnpReader(_renamer); foreach (var dbSnpItem in dbsnpReader.ExtractItem(vcfLine1)) { dbSnpItem.SetSupplementaryAnnotations(saCreator); } foreach (var dbSnpItem in dbsnpReader.ExtractItem(vcfLine2)) { dbSnpItem.SetSupplementaryAnnotations(saCreator); } // write the supplementary annotation file using (var writer = new SupplementaryAnnotationWriter(randomPath, "chr1", expectedDataSourceVersions)) { saCreator.FinalizePositionalAnnotations(); writer.Write(saCreator, sa.ReferencePosition); } using (var reader = new SupplementaryAnnotationReader(randomPath)) { // extract the three annotations var observedAnnotation = reader.GetAnnotation(141724543) as SupplementaryAnnotationPosition; Assert.NotNull(observedAnnotation); Assert.Equal("C", observedAnnotation.GlobalMajorAllele); Assert.Equal("0.9105", observedAnnotation.GlobalMajorAlleleFrequency); Assert.Equal("T", observedAnnotation.GlobalMinorAllele); Assert.Equal("0.04832", observedAnnotation.GlobalMinorAlleleFrequency); } File.Delete(randomPath); File.Delete(randomPath + ".idx"); }
public void AllSuppAnnotOutputTest() { const string altAllele = "C"; var sa = new SupplementaryAnnotationPosition(115256529); var oneKg = new OneKGenAnnotation { OneKgAllAn = 5008, OneKgAllAc = 2130, OneKgAmrAn = 694, OneKgAmrAc = 250 }; var dbSnp = new DbSnpAnnotation { DbSnp = new List <long> { 11554290 } }; var saCreator = new SupplementaryPositionCreator(sa); saCreator.AddExternalDataToAsa(DataSourceCommon.DataSource.OneKg, "C", oneKg); saCreator.AddExternalDataToAsa(DataSourceCommon.DataSource.DbSnp, "C", dbSnp); var cosmicItem1 = new CosmicItem("chr1", 115256529, "COSM1000", "T", altAllele, "TP53", new HashSet <CosmicItem.CosmicStudy> { new CosmicItem.CosmicStudy("", "carcinoma", "oesophagus") }, 1, altAllele); var cosmicItem2 = new CosmicItem("chr1", 115256529, "COSM1001", "T", altAllele, "TP53", new HashSet <CosmicItem.CosmicStudy> { new CosmicItem.CosmicStudy("01", "carcinoma", "large_intestine") }, 1, altAllele); cosmicItem1.AddCosmicToSa(saCreator); cosmicItem2.AddCosmicToSa(saCreator); var clinvarItem1 = new ClinVarItem(null, 0, null, altAllele, null, "RCV001", null, null, new List <string> { "ORPHA2462" }, null, null, "other"); sa.ClinVarItems.Add(clinvarItem1); var saReader = new MockSupplementaryAnnotationReader(sa); var infoColumn = VcfUtilities.GetVcfColumn(saReader, "chr1\t115256529\t.\tT\tC\t1000\tPASS\t.\tGT\t0/1", VcfCommon.InfoIndex); Assert.Contains("AF1000G=0.425319", infoColumn); Assert.Contains("cosmic=1|COSM1000,1|COSM1001", infoColumn); Assert.Contains("clinvar=1|other", infoColumn); }
public void CheckSaAltAllele() { var customItem = new CustomItem("chr1", 100, "ATATA", "TTT", "test", "cust101", true, null, null); var spc = new SupplementaryPositionCreator(new SupplementaryAnnotationPosition(100)); customItem.SetSupplementaryAnnotations(spc); Assert.Equal("5TTT", spc.SaPosition.CustomItems[0].SaAltAllele); }
public void MixedVariantType() { var oneKItem = _oneKGenReader.ExtractItems(VcfLine4)[1]; var sa = new SupplementaryPositionCreator(); oneKItem.SetSupplementaryAnnotations(sa); Assert.False(sa.IsRefMinor()); }
public void ReadWriteCustomAnnotation() { var randomPath = GetRandomPath(true); // create our expected data source versions var dbSnpVersion = new DataSourceVersion("dbSNP", "142", DateTime.Parse("2015-01-02").Ticks); var clinVarVersion = new DataSourceVersion("ClinVar", "13.5", DateTime.Parse("2015-01-19").Ticks); var expectedDataSourceVersions = new List <DataSourceVersion> { dbSnpVersion, clinVarVersion }; var customFile = new FileInfo(Resources.TopPath("customCosmic.vcf")); var customReader = new CustomAnnotationReader(customFile, _renamer); // all items from this file should be of type cosmic. var customItems = customReader.ToList(); var sa = new SupplementaryAnnotationPosition(69224); var saCreator = new SupplementaryPositionCreator(sa); foreach (var customItem in customItems) { // NOTE that the two custom items are for different position, but for the purpose of our test, this is not an issue. customItem.SetSupplementaryAnnotations(saCreator); } // the above code was unit tested in MergeDbSnpClinVar() using (var writer = new SupplementaryAnnotationWriter(randomPath, "chr1", expectedDataSourceVersions)) { writer.Write(saCreator, sa.ReferencePosition); } // read the supplementary annotation file using (var reader = new SupplementaryAnnotationReader(randomPath)) { // extract the three annotations var observedAnnotation1 = reader.GetAnnotation(69224); Assert.NotNull(observedAnnotation1); for (var i = 0; i < sa.CustomItems.Count; i++) { Assert.Equal(sa.CustomItems[i].Id, observedAnnotation1.CustomItems[i].Id); Assert.Equal(sa.CustomItems[i].AnnotationType, observedAnnotation1.CustomItems[i].AnnotationType); Assert.Equal(sa.CustomItems[i].IsAlleleSpecific, observedAnnotation1.CustomItems[i].IsAlleleSpecific); Assert.True(sa.CustomItems[i].StringFields.SequenceEqual(observedAnnotation1.CustomItems[i].StringFields)); if (sa.CustomItems[i].BooleanFields.Count > 0) { Assert.True(sa.CustomItems[i].BooleanFields.SequenceEqual(observedAnnotation1.CustomItems[i].BooleanFields)); } } } }
public void RefAlleleMinor() { var sa = new SupplementaryPositionCreator(); foreach (var oneKitem in _oneKGenReader.ExtractItems(VcfLine2)) { oneKitem.SetSupplementaryAnnotations(sa); } sa.FinalizePositionalAnnotations(); Assert.Equal(sa.IsRefMinor(), true); }
public void RefAlleleMajor() { var sa = new SupplementaryPositionCreator(); foreach (var oneKitem in _oneKGenReader.ExtractItems(VcfLine1)) { oneKitem.SetSupplementaryAnnotations(sa); } Assert.False(sa.IsRefMinor()); }