Example #1
0
 def test_na(self):
     self.dat.loc[0, 'SNP'] = float('NaN')
     self.dat.loc[1, 'A2'] = float('NaN')
     self.dat_gen = [
         self.dat.loc[0:4, :], self.dat.loc[5:9, :].reset_index(drop=True)]
     dat = munge.parse_dat(
         self.dat_gen, self.convert_colname, None, log, self.args)
     assert_frame_equal(
         dat, self.dat.loc[2:, ['SNP', 'A1', 'A2', 'P']].reset_index(drop=True))
Example #2
0
 def test_merge_alleles(self):
     self.args.merge_alleles = True
     merge_alleles = pd.DataFrame()
     merge_alleles['SNP'] = ['rs' + str(i) for i in range(3)]
     merge_alleles['MA'] = ['AG', 'AG', 'AG']
     dat = munge.parse_dat(self.dat_gen, self.convert_colname,
                           merge_alleles, log, self.args)
     print self.dat.loc[0:2, ['SNP', 'A1', 'A2', 'P']]
     assert_frame_equal(dat, self.dat.loc[0:2, ['SNP', 'A1', 'A2', 'P']])
Example #3
0
 def test_merge_alleles(self):
     self.args.merge_alleles = True
     merge_alleles = pd.DataFrame()
     merge_alleles['SNP'] = ['rs' + str(i) for i in range(3)]
     merge_alleles['MA'] = ['AG', 'AG', 'AG']
     dat = munge.parse_dat(
         self.dat_gen, self.convert_colname, merge_alleles, log, self.args)
     print self.dat.loc[0:2, ['SNP', 'A1', 'A2', 'P']]
     assert_frame_equal(dat, self.dat.loc[0:2, ['SNP', 'A1', 'A2', 'P']])
Example #4
0
 def test_na(self):
     self.dat.loc[0, 'SNP'] = float('NaN')
     self.dat.loc[1, 'A2'] = float('NaN')
     self.dat_gen = [
         self.dat.loc[0:4, :], self.dat.loc[5:9, :].reset_index(drop=True)]
     dat = munge.parse_dat(
         self.dat_gen, self.convert_colname, None, log, self.args)
     assert_frame_equal(
         dat, self.dat.loc[2:, ['SNP', 'A1', 'A2', 'P']].reset_index(drop=True))
Example #5
0
 def test_no_alleles(self):
     # test that it doesn't crash with no allele columns and the
     # --no-alleles flag set
     dat = self.dat.drop(['A1', 'A2'], axis=1)
     dat_gen = [dat.loc[0:4, :], dat.loc[5:9, :].reset_index(drop=True)]
     self.args.no_alleles = True
     dat = munge.parse_dat(dat_gen, self.convert_colname, None, log,
                           self.args)
     assert_frame_equal(dat,
                        self.dat.drop(['INFO', 'FRQ', 'A1', 'A2'], axis=1))
Example #6
0
 def test_no_alleles(self):
     # test that it doesn't crash with no allele columns and the
     # --no-alleles flag set
     dat = self.dat.drop(['A1', 'A2'], axis=1)
     dat_gen = [dat.loc[0:4, :], dat.loc[5:9, :].reset_index(drop=True)]
     self.args.no_alleles = True
     dat = munge.parse_dat(
         dat_gen, self.convert_colname, None, log, self.args)
     assert_frame_equal(
         dat, self.dat.drop(['INFO', 'FRQ', 'A1', 'A2'], axis=1))
Example #7
0
 def test_standard(self):
     dat = munge.parse_dat(self.dat_gen, self.convert_colname, None, log,
                           self.args)
     assert_frame_equal(dat, self.dat.drop(['INFO', 'FRQ'], axis=1))
Example #8
0
 def test_standard(self):
     dat = munge.parse_dat(
         self.dat_gen, self.convert_colname, None, log, self.args)
     assert_frame_equal(dat, self.dat.drop(['INFO', 'FRQ'], axis=1))