Skip to content

Commit

Permalink
Merge aea005a into abcfda0
Browse files Browse the repository at this point in the history
  • Loading branch information
thermokarst committed Feb 10, 2020
2 parents abcfda0 + aea005a commit f6e1c9c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ci/recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ requirements:
- scikit-bio >=0.5.4
- numpy
- blas=*=openblas
- pandas
- pandas >=1
- biom-format >=2.1.5,<2.2.0
- ijson
- h5py
Expand Down
10 changes: 6 additions & 4 deletions q2_types/feature_data/_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,14 @@ def _taxonomy_formats_to_dataframe(filepath, has_header=None):
if df.index.has_duplicates:
raise ValueError(
"Taxonomy format feature IDs must be unique. The following IDs "
"are duplicated: %s" % ', '.join(df.index.get_duplicates()))
"are duplicated: %s" %
', '.join(df.index[df.index.duplicated()].unique()))

if df.columns.has_duplicates:
raise ValueError(
"Taxonomy format column names must be unique. The following "
"column names are duplicated: %s" %
', '.join(df.columns.get_duplicates()))
', '.join(df.columns[df.columns.duplicated()].unique()))

df['Taxon'] = df['Taxon'].str.strip()
return df
Expand Down Expand Up @@ -117,13 +118,14 @@ def _dataframe_to_tsv_taxonomy_format(df):
if df.index.has_duplicates:
raise ValueError(
"Taxonomy format feature IDs must be unique. The following IDs "
"are duplicated: %s" % ', '.join(df.index.get_duplicates()))
"are duplicated: %s" %
', '.join(df.index[df.index.duplicated()].unique()))

if df.columns.has_duplicates:
raise ValueError(
"Taxonomy format column names must be unique. The following "
"column names are duplicated: %s" %
', '.join(df.columns.get_duplicates()))
', '.join(df.columns[df.columns.duplicated()].unique()))

ff = TSVTaxonomyFormat()
df.to_csv(str(ff), sep='\t', header=True, index=True)
Expand Down
2 changes: 1 addition & 1 deletion q2_types/feature_data/tests/test_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def test_has_header_with_headerless(self):
has_header=True)

def test_jagged(self):
with self.assertRaises(pandas.io.common.CParserError):
with self.assertRaises(pandas.io.common.ParserError):
_taxonomy_formats_to_dataframe(
self.get_data_path(os.path.join('taxonomy', 'jagged.tsv')))

Expand Down

0 comments on commit f6e1c9c

Please sign in to comment.