@@ -558,20 +558,20 @@ def _clean_validate_template(cls, md_template, study_id,
558558 error = []
559559 if pgsql_reserved :
560560 error .append (
561- "The following column names in the template contain PgSQL "
562- "reserved words: %s ." % ", " .join (pgsql_reserved ))
561+ "These column names are PgSQL reserved words, replace them: "
562+ "~~ %s ~~ ." % ", " .join (pgsql_reserved ))
563563 if invalid :
564564 error .append (
565- "The following column names in the template contain invalid "
566- "chars: %s ." % ", " .join (invalid ))
565+ "These column names contain invalid chars, remove or replace "
566+ "them: ~~ %s ~~ ." % ", " .join (invalid ))
567567 if forbidden :
568568 error .append (
569- "The following column names in the template contain invalid "
570- "values: %s ." % ", " .join (forbidden ))
569+ "These column names are not valid in this information file, "
570+ "remove them: ~~ %s ~~ ." % ", " .join (forbidden ))
571571 if qiime2_reserved :
572572 error .append (
573- "The following column names in the template contain QIIME2 "
574- "reserved words: %s." % ", " .join (pgsql_reserved ))
573+ "These columns are QIIME2 reserved words, replace them: "
574+ " ~~ %s ~~ ." % ", " .join (pgsql_reserved ))
575575
576576 if error :
577577 raise qdb .exceptions .QiitaDBColumnError (
@@ -1160,13 +1160,15 @@ def to_file(self, fp, samples=None):
11601160 df .to_csv (fp , index_label = 'sample_name' , na_rep = "" , sep = '\t ' ,
11611161 encoding = 'utf-8' )
11621162
1163- def _common_to_dataframe_steps (self ):
1163+ def _common_to_dataframe_steps (self , samples = None ):
11641164 """Perform the common to_dataframe steps
11651165
11661166 Returns
11671167 -------
11681168 pandas DataFrame
11691169 The metadata in the template,indexed on sample id
1170+ samples list of string, optional
1171+ A list of the sample names we actually want to retrieve
11701172 """
11711173 with qdb .sql_connection .TRN :
11721174 # Retrieve all the information from the database
@@ -1175,7 +1177,12 @@ def _common_to_dataframe_steps(self):
11751177 FROM qiita.{0}
11761178 WHERE sample_id != '{1}'""" .format (
11771179 self ._table_name (self ._id ), QIITA_COLUMN_NAME )
1178- qdb .sql_connection .TRN .add (sql )
1180+ if samples is None :
1181+ qdb .sql_connection .TRN .add (sql )
1182+ else :
1183+ sql += ' AND sample_id IN %s'
1184+ qdb .sql_connection .TRN .add (sql , [tuple (samples )])
1185+
11791186 # this query is going to return a tuple
11801187 # (sample_id, dict of columns/values); however it's important to
11811188 # notice that we can't assure that all column/values pairs are the
0 commit comments