Skip to content

Commit

Permalink
Merge branch 'EBIvariation:master' into docker-metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
nitin-ebi authored Jul 3, 2023
2 parents c671cdd + ea18009 commit be65e30
Show file tree
Hide file tree
Showing 9 changed files with 449 additions and 24 deletions.
10 changes: 5 additions & 5 deletions bin/retrieve_archives_from_lts.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ def main():
# Load the config_file from default location
load_config()

with ELOADRetrieval() as eload_retrieval:
eload_retrieval.retrieve_eloads_and_projects(args.eload, args.retrieve_associated_project, args.update_path,
args.eload_dirs_files, args.project, args.project_dirs_files,
args.eload_lts_dir, args.project_lts_dir, args.eload_retrieval_dir,
args.project_retrieval_dir)
eload_retrieval = ELOADRetrieval()
eload_retrieval.retrieve_eloads_and_projects(args.eload, args.retrieve_associated_project, args.update_path,
args.eload_dirs_files, args.project, args.project_dirs_files,
args.eload_lts_dir, args.project_lts_dir, args.eload_retrieval_dir,
args.project_retrieval_dir)


if __name__ == "__main__":
Expand Down
49 changes: 49 additions & 0 deletions bin/submission_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env python

# Copyright 2020 EMBL - European Bioinformatics Institute
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import logging
from argparse import ArgumentParser

from ebi_eva_common_pyutils.logger import logging_config as log_cfg

from eva_submission.eload_status import EloadStatus
from eva_submission.eload_validation import EloadValidation
from eva_submission.submission_config import load_config

logger = log_cfg.get_logger(__name__)


def main():
argparse = ArgumentParser(description='Provide a submission status for any ELOAD based on what has been accessioned and loaded.')
argparse.add_argument('--eload', required=True, type=int, help='The ELOAD number for this submission')
argparse.add_argument('--debug', action='store_true', default=False,
help='Set the script to output logging information at debug level')

args = argparse.parse_args()

log_cfg.add_stdout_handler()
if args.debug:
log_cfg.set_log_level(logging.DEBUG)

# Load the config_file from default location
load_config()

with EloadStatus(args.eload) as eload:
eload.status()


if __name__ == "__main__":
main()
19 changes: 18 additions & 1 deletion eva_submission/eload_brokering.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import csv
import os
import shutil
import subprocess
Expand Down Expand Up @@ -144,10 +145,26 @@ def _get_valid_vcf_files(self):
valid_vcf_files.extend(files) if files else None
return valid_vcf_files

def _generate_csv_mappings(self):
vcf_files_mapping_csv = os.path.join(self.eload_dir, 'brokering_vcf_files_mapping.csv')
with open(vcf_files_mapping_csv, 'w', newline='') as file:
writer = csv.writer(file)
writer.writerow(['vcf', 'fasta', 'report', 'assembly_accession'])
sub_analyses = self.eload_cfg.query('submission', 'analyses')
valid_analyses = self.eload_cfg.query('validation', 'valid', 'analyses')
for analysis_alias in valid_analyses:
fasta = sub_analyses[analysis_alias]['assembly_fasta']
report = sub_analyses[analysis_alias]['assembly_report']
assembly_accession = sub_analyses[analysis_alias]['assembly_accession']
for vcf_file in valid_analyses[analysis_alias]['vcf_files']:
writer.writerow([vcf_file, fasta, report, assembly_accession])
return vcf_files_mapping_csv

def _run_brokering_prep_workflow(self):
output_dir = self.create_nextflow_temp_output_directory()
cfg['executable']['python']['script_path'] = os.path.dirname(os.path.dirname(__file__))
brokering_config = {
'vcf_files': self._get_valid_vcf_files(),
'vcf_files_mapping': self._generate_csv_mappings(),
'output_dir': output_dir,
'executable': cfg['executable']
}
Expand Down
Loading

0 comments on commit be65e30

Please sign in to comment.