def testParseLengthCTX(self): '''Create leght if on same chrom, otherwiser print CTX ''' annotsv_df = self.annotsv_df.copy() annotsv_df = annotsv_df.apply( annotsv_summary.parse_sv_event1, axis=1).apply(annotsv_summary.parse_sv_alt, axis=1).apply( annotsv_summary.parse_gene_promoter, axis=1).apply(annotsv_summary.parse_dgv, axis=1).apply( annotsv_summary.parse_repeats, axis=1).apply(annotsv_summary.parse_info, axis=1).apply(annotsv_summary.parse_location, axis=1) o_event = 'gridss29_10153o' input_o_data = self.annotsv_df.loc[(annotsv_df['ID'] == o_event)] o_dict = annotsv_summary.collapse_event(input_o_data) o_event1 = annotsv_df.loc[annotsv_df['ID'] == o_event, 'Event1'].iloc[0] o_event2 = annotsv_df.loc[annotsv_df['ID'] == o_event, 'Event2'].iloc[0] event1 = o_event1 event2 = o_event2 length = annotsv_summary.parse_length(event1, event2) self.assertEqual(length, 'CTX')
def testCollapseEvent(self): ''' Combine various column entries into one string each''' o_event = 'gridss137_4056o' input_o_data = self.annotsv_df.loc[(self.annotsv_df['ID'] == o_event)] o_dict = annotsv_summary.collapse_event(input_o_data) expected_o_dict = { 'INFO': 'AS=1;ASQ=85.61;ASRP=3;ASSR=11;BA=0;BANRP=0;BANRPQ=0.00;BANSR=0;BANSRQ=0.00;BAQ=0.00;BASRP=0;BASSR=0;BEID=asm137-11351,asm137-6182;BEIDH=0,0;BEIDL=115,300;BQ=0.00;BSC=0;BSCQ=0.00;BUM=0;BUMQ=0.00;BVF=0;CAS=0;CASQ=0.00;CIPOS=-2,0;CIRPOS=-2,0;CQ=322.03;EVENT=gridss137_4056;HOMLEN=2;HOMSEQ=GA;IC=0;IHOMPOS=-2,0;IQ=0.00;PARID=gridss137_4056h;RAS=1;RASQ=140.29;REF=0;REFPAIR=0;RP=2;RPQ=21.04;SB=0.0;SC=1X1N1X176M;SR=4;SRQ=75.09;SVTYPE=BND;VF=9', 'Repeats_type_right': 'MLT2B1', 'Repeats_type_left': 'MLT2B1', 'NM': 'NM_001164665', 'DGV_GAIN_n_samples_tested': '0', 'DGV_LOSS_n_samples_with_SV': '0', 'promoters': '', '1000g_max_AF': '', 'DGV_GAIN_n_samples_with_SV': '0', 'SV end': '138541914', 'ID': 'gridss137_4056o', 'FILTER': 'LOW_QUAL', 'QUAL': '322.03', 'Gene name': 'KIAA1549', 'SV start': '138541913', 'DGV_LOSS_n_samples_tested': '0', 'ALT': ']7:140490765]C', '1000g_event': '', 'SV chrom': '7', 'location': 'intron16-intron6' } self.assertEqual(o_dict, expected_o_dict)
def testParseSingleton(self): annotsv_df=self.annotsv_df.copy() annotsv_df=annotsv_df.apply(annotsv_summary.parse_sv_event1, axis=1).apply(annotsv_summary.parse_sv_alt, axis=1).apply(annotsv_summary.parse_gene_promoter,axis=1).apply(annotsv_summary.parse_dgv, axis=1).apply(annotsv_summary.parse_repeats,axis=1).apply(annotsv_summary.parse_info, axis=1).apply(annotsv_summary.parse_location, axis=1) o_event='gridss133_319o' o_dict = annotsv_summary.collapse_event(annotsv_df.loc[(annotsv_df['ID']==o_event)]) output=annotsv_summary.parse_singleton(o_dict) expected_output=['chr7:98550671', 'chr7:98550704', 'TRRAP', 'TRRAP', 'intron37', 'SINGLETON EVENT', 'NM_003496', '215.25', 'SINGLETON EVENT;LOW_QUAL', '', '', 'MER4C/(TG)n[left];MER4C/(TG)n[right]', 'SINGLETON EVENT', '0|0', '0|0'] self.assertEqual(sorted(output), sorted(expected_output))
def testCollapseEvent(self): ''' Combine various column entries into one string each''' o_event='gridss137_4056o' input_o_data=self.annotsv_df.loc[(self.annotsv_df['ID']==o_event)] o_dict = annotsv_summary.collapse_event(input_o_data) expected_o_dict={'INFO': 'AS=1;ASQ=85.61;ASRP=3;ASSR=11;BA=0;BANRP=0;BANRPQ=0.00;BANSR=0;BANSRQ=0.00;BAQ=0.00;BASRP=0;BASSR=0;BEID=asm137-11351,asm137-6182;BEIDH=0,0;BEIDL=115,300;BQ=0.00;BSC=0;BSCQ=0.00;BUM=0;BUMQ=0.00;BVF=0;CAS=0;CASQ=0.00;CIPOS=-2,0;CIRPOS=-2,0;CQ=322.03;EVENT=gridss137_4056;HOMLEN=2;HOMSEQ=GA;IC=0;IHOMPOS=-2,0;IQ=0.00;PARID=gridss137_4056h;RAS=1;RASQ=140.29;REF=0;REFPAIR=0;RP=2;RPQ=21.04;SB=0.0;SC=1X1N1X176M;SR=4;SRQ=75.09;SVTYPE=BND;VF=9', 'Repeats_type_right': 'MLT2B1', 'Repeats_type_left': 'MLT2B1', 'NM': 'NM_001164665', 'DGV_GAIN_n_samples_tested': '0', 'DGV_LOSS_n_samples_with_SV': '0', 'promoters': '', '1000g_max_AF': '', 'DGV_GAIN_n_samples_with_SV': '0', 'SV end': '138541914', 'ID': 'gridss137_4056o', 'FILTER': 'LOW_QUAL', 'QUAL': '322.03', 'Gene name': 'KIAA1549', 'SV start': '138541913', 'DGV_LOSS_n_samples_tested': '0', 'ALT': ']7:140490765]C', '1000g_event': '', 'SV chrom': '7', 'location': 'intron16-intron6'} self.assertEqual(o_dict, expected_o_dict)
def testParseSingleton(self): annotsv_df = self.annotsv_df.copy() annotsv_df = annotsv_df.apply( annotsv_summary.parse_sv_event1, axis=1).apply(annotsv_summary.parse_sv_alt, axis=1).apply( annotsv_summary.parse_gene_promoter, axis=1).apply(annotsv_summary.parse_dgv, axis=1).apply( annotsv_summary.parse_repeats, axis=1).apply(annotsv_summary.parse_info, axis=1).apply(annotsv_summary.parse_location, axis=1) o_event = 'gridss133_319o' o_dict = annotsv_summary.collapse_event( annotsv_df.loc[(annotsv_df['ID'] == o_event)]) output = annotsv_summary.parse_singleton(o_dict) expected_output = [ 'chr7:98550671', 'chr7:98550704', 'TRRAP', 'TRRAP', 'intron37', 'SINGLETON EVENT', 'NM_003496', '215.25', 'SINGLETON EVENT;LOW_QUAL', '', '', 'MER4C/(TG)n[left];MER4C/(TG)n[right]', 'SINGLETON EVENT', '0|0', '0|0' ] self.assertEqual(sorted(output), sorted(expected_output))