Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EVA-3641 Specify the analysis only option correctly #219

Merged
merged 4 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 4 additions & 2 deletions eva_submission/eload_brokering.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def upload_to_bioSamples(self, force=False):
sample_name_to_accession = sample_metadata_submitter.already_submitted_sample_names_to_accessions()
self.eload_cfg.set('brokering', 'Biosamples', 'Samples', value=sample_name_to_accession)
elif (
self.eload_cfg.query('brokering', 'Biosamples', 'Samples')
self.eload_cfg.query('brokering', 'Biosamples', 'Samples')
and self.eload_cfg.query('brokering', 'Biosamples', 'pass')
):
self.info('BioSamples brokering is already done, Skip!')
Expand All @@ -124,7 +124,9 @@ def upload_to_bioSamples(self, force=False):
if not passed:
raise ValueError(f'Not all samples were successfully brokered to BioSamples! '
f'Found {len(sample_name_to_accession)} and expected '
f'{len(sample_metadata_submitter.all_sample_names())}')
f'{len(sample_metadata_submitter.all_sample_names())}. '
f'Missing samples are '
f'{[sample_name for sample_name in sample_metadata_submitter.all_sample_names() if sample_name not in sample_name_to_accession]}')

def update_biosamples_with_study(self, force=False):
if not self.eload_cfg.query('brokering', 'Biosamples', 'backlinks') or force:
Expand Down
7 changes: 4 additions & 3 deletions eva_submission/eload_ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def load_from_ena_from_project_or_analysis(self, analysis_accession=None):
command = (f"perl {cfg['executable']['load_from_ena']} -p {self.project_accession} -c submitted -v 1 "
f"-l {self._get_dir('scratch')} -e {str(self.eload_num)}")
if analysis_accession:
command += f' -A -a {analysis_accession}'
command += f' -A 1 -a {analysis_accession}'
Copy link
Member Author

Choose a reason for hiding this comment

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

This is an error that was compensated by another in metadata

try:
command_utils.run_command_with_output('Load metadata from ENA to EVAPRO', command)
self.eload_cfg.set(self.config_section, 'ena_load', value='success')
Expand Down Expand Up @@ -555,7 +555,7 @@ def update_files_with_ftp_path(self):
execute_query(conn, ftp_update)

def update_loaded_assembly_in_browsable_files(self):
# find assembly associated with each browseable file and copy it to the browsable file table
# find assembly associated with each browsable file and copy it to the browsable file table
query = ('select bf.file_id, a.vcf_reference_accession '
'from analysis a '
'join analysis_file af on a.analysis_accession=af.analysis_accession '
Expand All @@ -564,7 +564,8 @@ def update_loaded_assembly_in_browsable_files(self):
with self.metadata_connection_handle as conn:
rows = get_all_results_for_query(conn, query)
if len(rows) == 0:
raise ValueError('Something went wrong with loading from ENA')
raise ValueError(f'No files found associated with project {self.project_accession}. '
f'Something went wrong with loading from ENA')

# Update each file with its associated assembly accession
for file_id, assembly_accession in rows:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_eload_ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def test_load_from_ena_from_analysis(self):
analysis_accession = 'ERZ2499196'
self.eload.load_from_ena_from_project_or_analysis(analysis_accession)
command = ('perl /path/to/load_from_ena_script -p PRJEB12345 -c submitted -v 1 -l '
f'{self.eload._get_dir("scratch")} -e 33 -A -a ERZ2499196')
f'{self.eload._get_dir("scratch")} -e 33 -A 1 -a ERZ2499196')
mockrun.assert_called_once_with('Load metadata from ENA to EVAPRO', command)

def test_ingest_accession(self):
Expand Down
Loading