Skip to content

Commit

Permalink
Minor fixes, feedback from the code review
Browse files Browse the repository at this point in the history
- remove emg-backlog-schema as dependency
- address minor comments
  • Loading branch information
mberacochea committed Mar 28, 2022
1 parent 6f2cb66 commit f8348f3
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 5 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ jobs:
- name: 🔧 - Install Dependencies
run: |
pip install -U git+git://github.com/EBI-Metagenomics/emg-backlog-schema.git
pip install -U git+git://github.com/EBI-Metagenomics/ena-api-handler.git
pip install -U -r requirements.txt
pip install -U -r requirements-test.txt
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ Install application::
conda create -q -n myenv python=3.6.8
source activate myenv

pip install -U git+git://github.com/EBI-Metagenomics/emg-backlog-schema.git;
pip install -U git+git://github.com/EBI-Metagenomics/ena-api-handler.git
pip install https://github.com/EBI-Metagenomics/emgapi/archive/$latestTag.tar.gz

Expand Down Expand Up @@ -133,7 +132,6 @@ How to install the webuploader (one off)?
conda create -q -n myenv python=3.6.8
source activate myenv

pip install -U git+git://github.com/EBI-Metagenomics/emg-backlog-schema.git
pip install -U git+git://github.com/EBI-Metagenomics/ena-api-handler.git

pip install -U -r https://raw.githubusercontent.com/EBI-Metagenomics/emgapi/webuploader/requirements-webuploader.txt
Expand Down
4 changes: 4 additions & 0 deletions emgapianns/management/commands/create_study_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ def handle(self, *args, **options):
if not options['rootpath']:
raise ValueError("rootpath (RESULTS_PRODUCTION_DIR setting) cannot by empty)")


rootpath = os.path.abspath(options['rootpath'])

if not os.path.isdir(rootpath):
raise ValueError(f"rootpath {rootpath} is not a directory")

gen = StudySummaryGenerator(accession=study_accession, pipeline=pipeline, rootpath=rootpath,
database=database)
gen.run()
4 changes: 3 additions & 1 deletion emgapianns/management/commands/import_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def add_arguments(self, parser):
help='Library strategy',
choices=['AMPLICON', 'WGS', 'ASSEMBLY', 'RNA-Seq', 'WGA'])
parser.add_argument('--pipeline', help='Pipeline version',
choices=['4.1', '5.0'], default='4.1')
choices=['4.1', '5.0'], default='5.0')
parser.add_argument('--database',
help='Target emg_db_name alias',
choices=['default', 'dev', 'prod'],
Expand Down Expand Up @@ -170,13 +170,15 @@ def __find_existing_result_dir(self, secondary_study_accession, run_accession, v
# find version_{} folder
result_folder = []
if len(study_folder) == 0:
# TODO: replace with raise CommandError
sys.exit('Could not find result directory for: {}'.format(secondary_study_accession))
for cur_study_folder in study_folder:
directory = os.path.join(cur_study_folder, 'version_{}/'.format(version))
result_folder += self.__find_folder(directory, search_pattern=run_accession, maxdepth=3)

# if len(result_folder) > 1: take the latest created version_{} folder
if len(result_folder) == 0:
# TODO: replace with raise CommandError
sys.exit('Could not find result directory for: {}'.format(run_accession))
else:
latest_folder = max(result_folder, key=os.path.getctime)
Expand Down
1 change: 1 addition & 0 deletions emgapianns/management/commands/import_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def create_or_update_sample(self, ena_db_model, api_data):
except emg_models.Biome.DoesNotExist as exception:
logger.exception(exception)
logger.error(f'The supplied biome is not valid. Biome: "{self.biome}"')
# TODO: replace with raise CommandError
sys.exit(1)

logger.info('Creating sample {}'.format(accession))
Expand Down
2 changes: 1 addition & 1 deletion emgapianns/management/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def add_arguments(self, parser):
'4.0',
'4.1',
'5.0'],
default='4.1'
default='5.0'
)

def handle(self, *args, **options):
Expand Down
1 change: 1 addition & 0 deletions emgapianns/management/lib/genome_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def sanity_check_catalogue_dir(d):
for e in errors:
logger.error(e)
logger.error('Validation failed, see errors above')
# TODO: replace with raise CommandError
sys.exit(1)


Expand Down
1 change: 1 addition & 0 deletions emgapianns/management/lib/study_summary_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def __init__(self, accession, pipeline, rootpath, database):

def run(self):
if not os.path.exists(self.study_result_dir):
# TODO: replace with raise CommandError
sys.exit(
"Study result directory for {} does not exist:\n{}".format(self.study_accession, self.study_result_dir))

Expand Down

0 comments on commit f8348f3

Please sign in to comment.