Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ env:
matrix:
- TEST_ADD_STUDIES=False COVER_PACKAGE=qiita_db
- TEST_ADD_STUDIES=False COVER_PACKAGE=qiita_pet
- TEST_ADD_STUDIES=True COVER_PACKAGE="qiita_core qiita_ware"
- secure: ta4qrBQleTSwDUml9+jtnJES1qHCgLtjUpOHKX25ZCdw3vi/SpXxyErn5yrXvdefIDYtspVv3OWpWesiwFf3Qq1PSWJBeIrxdYizqebRr6GuUcdPN+Mj8PQ09UDWY3GthMfb26oIKmWi9YyELjwqkb6zztSW/e276scrEWppsVI=
- TEST_ADD_STUDIES=True COVER_PACKAGE="qiita_core qiita_ware" secure: ta4qrBQleTSwDUml9+jtnJES1qHCgLtjUpOHKX25ZCdw3vi/SpXxyErn5yrXvdefIDYtspVv3OWpWesiwFf3Qq1PSWJBeIrxdYizqebRr6GuUcdPN+Mj8PQ09UDWY3GthMfb26oIKmWi9YyELjwqkb6zztSW/e276scrEWppsVI=
before_install:
- redis-server --version
- redis-server --port 7777 &
Expand Down
Binary file removed qiita_core/support_files/config_test_travis.cfg.enc
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ Checking for Errors In Sample information

* `Keemei <https://keemei.qiime2.org/>`__ is a Google Sheets add-on for validating sample metadata. Validation of sample metadata is important before beginning any analysis. Install Keemei and follow the instructions on its website to validate your sample information spread sheet.

* Keemei can only be used to validate sample information **not preparation information**

**Remember that spelling and capitalization matters in Qiita**

Attaching the Sample Information to the Study
Expand Down Expand Up @@ -318,12 +320,6 @@ additional column is required.
| | | and ``my-data.fastq`` becomes ``my-data``). |
+------------------+-------------+--------------------------------------------------------------------------------------------+

Checking for Errors In Preparation information
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* `Keemei <https://keemei.qiime2.org/>`__ is a Google Sheets add-on for validating sample metadata. Validation of sample metadata is important before beginning any analysis. Install Keemei and follow the instructions on its website to validate your sample information spread sheet.

**Remember that spelling and capitalization matters in Qiita**

Attaching Preparation Information to the Study
----------------------------------------------
Expand Down
24 changes: 11 additions & 13 deletions qiita_ware/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@
from qiita_ware.exceptions import ComputeError, EBISubmissionError


def submit_EBI(preprocessed_data_id, action, send):
"""Submit a preprocessed data to EBI
def submit_EBI(artifact_id, action, send):
"""Submit a artifact to EBI
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a -> an

... 👀


Parameters
----------
preprocessed_data_id : int
The preprocesssed data id
artifact_id : int
The artifact id
action : %s
The action to perform with this data
send : bool
True to actually send the files
"""
# step 1: init and validate
ebi_submission = EBISubmission(preprocessed_data_id, action)
ebi_submission = EBISubmission(artifact_id, action)

# step 2: generate demux fastq files
ebi_submission.study.ebi_submission_status = 'submitting'
Expand All @@ -46,7 +46,7 @@ def submit_EBI(preprocessed_data_id, action, send):
rmtree(ebi_submission.full_ebi_dir)
ebi_submission.study.ebi_submission_status = 'failed: %s' % error_msg
LogEntry.create('Runtime', error_msg,
info={'ebi_submission': preprocessed_data_id})
info={'ebi_submission': artifact_id})
raise

# step 3: generate and write xml files
Expand All @@ -60,7 +60,7 @@ def submit_EBI(preprocessed_data_id, action, send):

LogEntry.create('Runtime',
("Submitting sequences for pre_processed_id: "
"%d" % preprocessed_data_id))
"%d" % artifact_id))
for cmd in ebi_submission.generate_send_sequences_cmd():
stdout, stderr, rv = system_call(cmd)
if rv != 0:
Expand All @@ -72,14 +72,13 @@ def submit_EBI(preprocessed_data_id, action, send):
environ['ASPERA_SCP_PASS'] = old_ascp_pass
LogEntry.create('Runtime',
('Submission of sequences of pre_processed_id: '
'%d completed successfully' %
preprocessed_data_id))
'%d completed successfully' % artifact_id))

# step 5: sending xml and parsing answer
xmls_cmds = ebi_submission.generate_curl_command()
LogEntry.create('Runtime',
("Submitting XMLs for pre_processed_id: "
"%d" % preprocessed_data_id))
"%d" % artifact_id))
xml_content, stderr, rv = system_call(xmls_cmds)
if rv != 0:
error_msg = ("Error:\nStd output:%s\nStd error:%s" % (
Expand All @@ -88,8 +87,7 @@ def submit_EBI(preprocessed_data_id, action, send):
else:
LogEntry.create('Runtime',
('Submission of sequences of pre_processed_id: '
'%d completed successfully' %
preprocessed_data_id))
'%d completed successfully' % artifact_id))
open(ebi_submission.curl_reply, 'w').write(
'stdout:\n%s\n\nstderr: %s' % (xml_content, stderr))

Expand All @@ -99,7 +97,7 @@ def submit_EBI(preprocessed_data_id, action, send):
except EBISubmissionError as e:
le = LogEntry.create(
'Fatal', "Command: %s\nError: %s\n" % (xml_content, str(e)),
info={'ebi_submission': preprocessed_data_id})
info={'ebi_submission': artifact_id})
ebi_submission.study.ebi_submission_status = (
"failed: XML parsing, log id: %d" % le.id)
raise ComputeError("EBI Submission failed! Log id: %d" % le.id)
Expand Down
20 changes: 8 additions & 12 deletions qiita_ware/test/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,24 +134,20 @@ def generate_new_study_with_preprocessed_data(self):
return ppd

def test_submit_EBI_step_2_failure(self):
# see issue #406
# ppd = self.write_demux_files(PrepTemplate(1), False)
#
# with self.assertRaises(AttributeError):
# submit_EBI(ppd.id, 'ADD', True)
pass
ppd = self.write_demux_files(PrepTemplate(1), False)

with self.assertRaises(AttributeError):
submit_EBI(ppd.id, 'VALIDATE', True)

def test_submit_EBI_parse_EBI_reply_failure(self):
ppd = self.write_demux_files(PrepTemplate(1))
with self.assertRaises(ComputeError):
submit_EBI(ppd.id, 'ADD', True)
submit_EBI(ppd.id, 'VALIDATE', True)

def test_full_submission(self):
# see issue #406
# ppd = self.generate_new_study_with_preprocessed_data()
#
# submit_EBI(ppd.id, 'ADD', True)
pass
ppd = self.generate_new_study_with_preprocessed_data()

submit_EBI(ppd.id, 'VALIDATE', True)


FASTA_EXAMPLE = """>1.SKB2.640194_1 X orig_bc=X new_bc=X bc_diffs=0
Expand Down
6 changes: 3 additions & 3 deletions scripts/qiita
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,16 @@ def load_prep_template(fp, study, data_type):
# #############################################################################

@ebi.command()
@click.option('--preprocessed_data_id', required=True, type=int)
@click.option('--artifact-id', required=True, type=int)
@click.option('--action', type=click.Choice(EBISubmission.valid_ebi_actions),
default='submit', help='The generated XML files will specify '
'this "action", which controls how the EBI servers handle the '
'metadata')
@click.option('--send/--no-send', default=False, help="Controls whether or "
"not sequence files and metadata will actually be sent to EBI "
"(default is to generate all the files, but not to send)")
def submit(preprocessed_data_id, action, send):
_submit_EBI(preprocessed_data_id, action, send)
def submit(artifact_id, action, send):
_submit_EBI(artifact_id, action, send)


# #############################################################################
Expand Down