Skip to content

Commit

Permalink
added test for column presence
Browse files Browse the repository at this point in the history
  • Loading branch information
tanaes committed Jan 18, 2023
1 parent 08b9962 commit 498bf4b
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions drep/d_choose.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,16 @@ def score_genomes(genomes, Gdb, Edb=None, **kwargs):
g2e = {}

# Test for NaNs in Gdb['strain_heterogeneity']

if Gdb['strain_heterogeneity'].isnull().values.any():
kwargs['strain_heterogeneity_weight'] = 0
logging.warning ('NaNs found in Gdb strain_heterogeneity! '
'This may have happened if CheckM results '
'were imported for some but not all '
'genomes. \n\n'
'Setting strain_heterogeneity_weight to zero')
Gdb.drop('strain_heterogeneity',
axis=1,
inplace=True)
if 'strain_heterogeneity' in Gdb.columns:
if Gdb['strain_heterogeneity'].isnull().values.any():
kwargs['strain_heterogeneity_weight'] = 0
logging.warning ('NaNs found in Gdb strain_heterogeneity! '
'This may have happened if CheckM results '
'were imported for some but not all '
'genomes. \n\n'
'Setting strain_heterogeneity_weight to zero')
Gdb.drop('strain_heterogeneity',
axis=1, inplace=True)

Table = {'genome':[],'score':[]}
for genome in genomes:
Expand Down

0 comments on commit 498bf4b

Please sign in to comment.