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

initial working version of refgenie integration #1090

Merged
merged 21 commits into from
Jul 6, 2022
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fixed issues with refgenie test
KevinMenden committed May 25, 2021
commit a1730af635c7b5d3ad9749ee9c4bd5d582d24728
6 changes: 4 additions & 2 deletions nf_core/refgenie.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@
import os
import re
import rich
import refgenconf

# import refgenconf
from warnings import warn
from rich.logging import RichHandler
import nf_core.utils
@@ -47,7 +48,8 @@ def _print_nf_config(rgc):
for asset in asset_list:
try:
pth = rgc.seek(genome, asset)
except refgenconf.exceptions.MissingSeekKeyError:
# Catch general exception instead of refgencof exception --> no refgenconf import needed
except Exception as e:
log.warn(f"{genome}/{asset} is incomplete, ignoring...")
else:
genomes_str += ' {} = "{}"\n'.format(asset.ljust(20, " "), pth)
22 changes: 9 additions & 13 deletions tests/test_refgenie.py
Original file line number Diff line number Diff line change
@@ -2,17 +2,13 @@
""" Tests covering the refgenie integration code
"""

import nf_core.refgenie
import refgenconf
import json
import os
import pytest
import time
import unittest
import tempfile
from unittest import mock
import subprocess
from rich.console import Console
import shlex

import nf_core.refgenie


class TestRefgenie(unittest.TestCase):
@@ -33,18 +29,18 @@ def setUp(self):
# Initialize a refgenie config
os.system(f"refgenie init -c {self.REFGENIE}")

# Populate the config with a genome
os.system(f"refgenie pull t7/fasta -c {self.REFGENIE}")

# Add NXF_REFGENIE_PATH to refgenie config
with open(self.REFGENIE, "a") as fh:
fh.write(f"nextflow_config: {os.path.join(self.NXF_REFGENIE_PATH)}")
fh.write(f"nextflow_config: {os.path.join(self.NXF_REFGENIE_PATH)}\n")

def tearDown(self) -> None:
# Remove the tempdir again
os.system(f"rm -rf {self.tmp_dir}")

def test_update_refgenie_genomes_config(self):
"""Test that listing pipelines works"""
rgc = refgenconf.RefGenConf(self.REFGENIE)
# Populate the config with a genome
cmd = f"refgenie pull t7/fasta -c {self.REFGENIE}"
out = subprocess.check_output(shlex.split(cmd), stderr=subprocess.STDOUT)

assert nf_core.refgenie.update_config(rgc) == True
assert "Updated nf-core genomes config" in str(out)