Skip to content

Commit

Permalink
Merge pull request #167 from apriltuesday/submission-fixes
Browse files Browse the repository at this point in the history
Fixes from submission processing
  • Loading branch information
apriltuesday authored Aug 7, 2023
2 parents 832aca3 + e199906 commit c65adb5
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion eva_submission/eload_preparation.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def check_submitted_filenames(self):
f'{", ".join(set(submitted_vcfs).difference(set(spreadsheet_vcfs)))}')
analysis_alias = ''
if len(eva_xls_reader.analysis) == 1:
analysis_alias = self._unique_alias(eva_xls_reader.analysis[0].get('Analysis Alias')) or ''
analysis_alias = eva_xls_reader.analysis[0].get('Analysis Alias') or ''
elif len(eva_xls_reader.analysis) > 1:
self.error("Multiple analyses found, can't add submitted VCF to spreadsheet")
raise ValueError("Multiple analyses found, can't add submitted VCF to spreadsheet")
Expand Down
8 changes: 8 additions & 0 deletions eva_submission/eload_submission.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,19 @@ def update_metadata_spreadsheet(self, input_spreadsheet, output_spreadsheet=None
elif self.eload not in project_row['Project Alias']:
# Add the eload id to ensure that the project alias is unique
project_row['Project Alias'] = self._unique_alias(project_row['Project Alias'])

analysis_rows = reader.analysis
for analysis_row in analysis_rows:
if self.eload not in analysis_row['Analysis Alias']:
# Add the eload id to ensure that the analysis alias is unique
analysis_row['Analysis Alias'] = self._unique_alias(analysis_row['Analysis Alias'])

if output_spreadsheet:
eva_xls_writer = EvaXlsxWriter(input_spreadsheet, output_spreadsheet)
else:
eva_xls_writer = EvaXlsxWriter(input_spreadsheet)
eva_xls_writer.set_project(project_row)
eva_xls_writer.set_analysis(analysis_rows)
eva_xls_writer.set_samples(sample_rows)
eva_xls_writer.set_files(file_rows)
eva_xls_writer.save()
Expand Down
3 changes: 0 additions & 3 deletions eva_submission/eload_validation.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#!/usr/bin/env python
import copy
import csv
import os
import re
import shutil
import subprocess
import gzip

import yaml
from ebi_eva_common_pyutils import command_utils
Expand Down
2 changes: 1 addition & 1 deletion eva_submission/nextflow/prepare_brokering.nf
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ process normalise_vcf {
trap 'if [[ \$? == 1 || \$? == 139 || \$? == 255 ]]; then exit 0; fi' EXIT
mkdir normalised_vcfs
$params.executable.bcftools norm --no-version -f $fasta -O z -o normalised_vcfs/$vcf_file $vcf_file 2> normalised_vcfs/${vcf_file.getBaseName()}_bcftools_norm.log
$params.executable.bcftools norm --no-version -cw -f $fasta -O z -o normalised_vcfs/$vcf_file $vcf_file 2> normalised_vcfs/${vcf_file.getBaseName()}_bcftools_norm.log
$params.executable.bcftools index -c normalised_vcfs/$vcf_file
"""
}
Expand Down
8 changes: 4 additions & 4 deletions tests/test_vep_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def fake_dir(path, callback):

def test_get_vep_versions_from_ensembl(self):
vep_version, cache_version = get_vep_and_vep_cache_version_from_ensembl('GCA_000827895.1')
self.assertEqual(vep_version, 109)
self.assertEqual(cache_version, 56)
self.assertEqual(vep_version, 110)
self.assertEqual(cache_version, 57)
assert os.path.exists(os.path.join(cfg['vep_cache_path'], 'thelohanellus_kitauei'))
assert os.listdir(os.path.join(cfg['vep_cache_path'], 'thelohanellus_kitauei')) == ['56_ASM82789v1']
assert os.listdir(os.path.join(cfg['vep_cache_path'], 'thelohanellus_kitauei')) == ['57_ASM82789v1']

def test_get_vep_versions_from_ensembl_not_found(self):
vep_version, cache_version = get_vep_and_vep_cache_version_from_ensembl('GCA_015220235.1')
Expand Down Expand Up @@ -133,7 +133,7 @@ def test_get_species_and_assembly(self):
'GCA_000001405.1': ('homo_sapiens', 'GRCh37', False, '9606'),
'GCA_000001405.14': ('homo_sapiens', 'GRCh37.p13', False, '9606'),
'GCA_000001405.20': ('homo_sapiens', 'GRCh38.p5', False, '9606'),
'GCA_000001405.28': ('homo_sapiens', 'GRCh38.p13', True, '9606'),
'GCA_000001405.29': ('homo_sapiens', 'GRCh38.p14', True, '9606'),
'GCA_000001635.2': ('mus_musculus', 'GRCm38', False, '10090'),
'GCA_000002285.2': ('canis_lupus_familiaris', 'CanFam3.1', False, '9615'),
'GCA_000002315.5': ('gallus_gallus', 'GRCg6a', True, '9031'),
Expand Down

0 comments on commit c65adb5

Please sign in to comment.