Skip to content

Commit

Permalink
Merge pull request #41 from tcezard/package_data
Browse files Browse the repository at this point in the history
Move the Nextflow and etc folders to eva_submission
  • Loading branch information
tcezard authored Jun 1, 2021
2 parents c8369ed + f871ed2 commit 7687e7a
Show file tree
Hide file tree
Showing 15 changed files with 21 additions and 16 deletions.
6 changes: 5 additions & 1 deletion eva_submission/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import os
import eva_submission


ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # This is your Project Root
MODULE_DIR = os.path.dirname(os.path.abspath(__file__)) # This is the module Root

NEXTFLOW_DIR = os.path.join(os.path.dirname(os.path.abspath(eva_submission.__file__)), 'nextflow')
ETC_DIR = os.path.join(os.path.dirname(os.path.abspath(eva_submission.__file__)), 'etc')
4 changes: 2 additions & 2 deletions eva_submission/eload_brokering.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ebi_eva_common_pyutils import command_utils
from ebi_eva_common_pyutils.config import cfg

from eva_submission import ROOT_DIR
from eva_submission import ROOT_DIR, NEXTFLOW_DIR
from eva_submission.ENA_submission.upload_to_ENA import ENAUploader
from eva_submission.biosamples_submission import SampleMetadataSubmitter
from eva_submission.eload_submission import Eload
Expand Down Expand Up @@ -94,7 +94,7 @@ def _run_brokering_prep_workflow(self):
brokering_config_file = os.path.join(self.eload_dir, 'brokering_config_file.yaml')
with open(brokering_config_file, 'w') as open_file:
yaml.safe_dump(brokering_config, open_file)
validation_script = os.path.join(ROOT_DIR, 'nextflow', 'prepare_brokering.nf')
validation_script = os.path.join(NEXTFLOW_DIR, 'prepare_brokering.nf')
try:
command_utils.run_command_with_output(
'Nextflow brokering preparation process',
Expand Down
6 changes: 3 additions & 3 deletions eva_submission/eload_ingestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from ebi_eva_common_pyutils.pg_utils import get_all_results_for_query, execute_query
import pymongo

from eva_submission import ROOT_DIR
from eva_submission import NEXTFLOW_DIR
from eva_submission.assembly_taxonomy_insertion import insert_new_assembly_and_taxonomy
from eva_submission.eload_submission import Eload
from eva_submission.eload_utils import get_metadata_conn, get_mongo_creds, get_accession_pg_creds
Expand Down Expand Up @@ -246,7 +246,7 @@ def run_accession_workflow(self):
accession_config_file = os.path.join(self.project_dir, 'accession_config_file.yaml')
with open(accession_config_file, 'w') as open_file:
yaml.safe_dump(accession_config, open_file)
accession_script = os.path.join(ROOT_DIR, 'nextflow', 'accession.nf')
accession_script = os.path.join(NEXTFLOW_DIR, 'accession.nf')
try:
command_utils.run_command_with_output(
'Nextflow Accessioning process',
Expand Down Expand Up @@ -296,7 +296,7 @@ def run_variant_load_workflow(self):
load_config_file = os.path.join(self.project_dir, 'load_config_file.yaml')
with open(load_config_file, 'w') as open_file:
yaml.safe_dump(load_config, open_file)
variant_load_script = os.path.join(ROOT_DIR, 'nextflow', 'variant_load.nf')
variant_load_script = os.path.join(NEXTFLOW_DIR, 'variant_load.nf')
try:
command_utils.run_command_with_output(
'Nextflow Variant Load process',
Expand Down
4 changes: 2 additions & 2 deletions eva_submission/eload_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ebi_eva_common_pyutils import command_utils
from ebi_eva_common_pyutils.config import cfg

from eva_submission import ROOT_DIR
from eva_submission import NEXTFLOW_DIR
from eva_submission.eload_submission import Eload
from eva_submission.eload_utils import resolve_single_file_path
from eva_submission.samples_checker import compare_spreadsheet_and_vcf
Expand Down Expand Up @@ -130,7 +130,7 @@ def _run_validation_workflow(self):
validation_confg_file = os.path.join(self.eload_dir, 'validation_confg_file.yaml')
with open(validation_confg_file, 'w') as open_file:
yaml.safe_dump(validation_config, open_file)
validation_script = os.path.join(ROOT_DIR, 'nextflow', 'validation.nf')
validation_script = os.path.join(NEXTFLOW_DIR, 'validation.nf')
try:
command_utils.run_command_with_output(
'Nextflow Validation process',
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions eva_submission/xlsx/xlsx_parser_eva.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
from cached_property import cached_property
from ebi_eva_common_pyutils.logger import AppLogger

from eva_submission import ROOT_DIR
from eva_submission import ETC_DIR
from eva_submission.xlsx.xlsx_parser import XlsxReader, XlsxWriter


class EvaXlsxReader(AppLogger):

def __init__(self, metadata_file):
conf = os.path.join(ROOT_DIR, 'etc', 'eva_project_conf.yaml')
conf = os.path.join(ETC_DIR, 'eva_project_conf.yaml')
self.reader = XlsxReader(metadata_file, conf)
self.metadata_file=metadata_file

Expand Down Expand Up @@ -97,7 +97,7 @@ def files_per_analysis(self):
class EvaXlsxWriter(AppLogger):

def __init__(self, metadata_source, metadata_dest=None):
conf = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), 'etc', 'eva_project_conf.yaml')
conf = os.path.join(ETC_DIR, 'eva_project_conf.yaml')
self.writer = XlsxWriter(metadata_source, conf)
self.metadata_source = metadata_source
if metadata_dest:
Expand Down
4 changes: 2 additions & 2 deletions eva_submission/xlsx/xlsx_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ebi_eva_common_pyutils.variation.assembly_utils import retrieve_genbank_assembly_accessions_from_ncbi
from requests import HTTPError

from eva_submission import ROOT_DIR
from eva_submission import ETC_DIR
from eva_submission.eload_utils import cast_list
from eva_submission.xlsx.xlsx_parser_eva import EvaXlsxReader

Expand All @@ -33,7 +33,7 @@ def cerberus_validation(self):
Leverage cerberus validation to check the format of the metadata.
This function adds error statements to the errors attribute
"""
config_file = os.path.join(ROOT_DIR, 'etc', 'eva_project_validation.yaml')
config_file = os.path.join(ETC_DIR, 'eva_project_validation.yaml')
with open(config_file) as open_file:
validation_schema = yaml.safe_load(open_file)
validator = Validator(validation_schema)
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
setup(
name='eva_submission',
packages=['eva_submission', 'eva_submission.ENA_submission', 'eva_submission.xlsx'],
version='0.5.6',
package_data={'eva_submission': ['nextflow/*', 'etc/*']},
version='0.5.7',
license='Apache',
description='EBI EVA - submission processing tools',
url='https://github.com/EBIVariation/eva-submission',
Expand Down
4 changes: 2 additions & 2 deletions tests/test_eload_brokering.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from ebi_eva_common_pyutils.config import cfg

from eva_submission import ROOT_DIR
from eva_submission import NEXTFLOW_DIR
from eva_submission.biosamples_submission import SampleMetadataSubmitter
from eva_submission.eload_brokering import EloadBrokering
from eva_submission.eload_submission import Eload
Expand Down Expand Up @@ -68,7 +68,7 @@ def test_run_brokering_prep_workflow(self):
'nextflow': 'path_to_nextflow'
}
temp_dir = 'temporary_directory'
nf_script = os.path.join(ROOT_DIR, 'nextflow', 'prepare_brokering.nf')
nf_script = os.path.join(NEXTFLOW_DIR, 'prepare_brokering.nf')
config_file = os.path.join(self.eload.eload_dir, 'brokering_config_file.yaml')

with patch('eva_submission.eload_brokering.command_utils.run_command_with_output') as m_execute, \
Expand Down

0 comments on commit 7687e7a

Please sign in to comment.