Skip to content

Commit

Permalink
use yacman; close databio#156
Browse files Browse the repository at this point in the history
  • Loading branch information
vreuter committed Jun 20, 2019
1 parent 1e88d90 commit b894a8e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
8 changes: 2 additions & 6 deletions pypiper/manager.py
Expand Up @@ -29,6 +29,7 @@

from attmap import AttMapEcho
from hashlib import md5
from yacman import load_yaml
from .exceptions import PipelineHalt, SubprocessError
from .flags import *
from .utils import \
Expand Down Expand Up @@ -315,12 +316,7 @@ def __init__(
if config_to_load is not None:
print("\nLoading config file: {}\n".format(config_to_load))
with open(config_to_load, 'r') as conf:
# Set the args to the new config file, so it can be used
# later to pass to, for example, toolkits
import yaml
# An also use yaml.FullLoader for trusted input. . .
config = yaml.load(conf, Loader=yaml.SafeLoader)
self.config = AttMapEcho(config)
self.config = AttMapEcho(load_yaml(conf))
else:
print("No config file")
self.config = None
Expand Down
14 changes: 4 additions & 10 deletions pypiper/ngstk.py
@@ -1,15 +1,15 @@
#!/usr/env python
""" Broadly applicable NGS processing/analysis functionality """

import os
import re
import subprocess
import errno
from attmap import AttMapEcho
from yacman import load_yaml
from .exceptions import UnsupportedFiletypeException
from .utils import is_fastq, is_gzipped_fastq, is_sam_or_bam



class NGSTk(AttMapEcho):
"""
Class to hold functions to build command strings used during pipeline runs.
Expand Down Expand Up @@ -42,14 +42,8 @@ class NGSTk(AttMapEcho):
def __init__(self, config_file=None, pm=None):
# parse yaml into the project's attributes
# self.add_entries(**config)

if config_file is None:
super(NGSTk, self).__init__()
else:
import yaml
with open(config_file, 'r') as config_file:
config = yaml.load(config_file)
super(NGSTk, self).__init__(config)
super(NGSTk, self).__init__(
None if config_file is None else load_yaml(config_file))

# Keep a link to the pipeline manager, if one is provided.
# if None is provided, instantiate "tools" and "parameters" with empty AttMaps
Expand Down
2 changes: 1 addition & 1 deletion requirements/reqs-ngstk.txt
@@ -1,4 +1,4 @@
numpy
pandas
pysam
pyyaml
yacman
4 changes: 2 additions & 2 deletions requirements/reqs-pypiper.txt
@@ -1,4 +1,4 @@
attmap>=0.12.5
pyyaml>=5
psutil
pandas
pandas
yacman

0 comments on commit b894a8e

Please sign in to comment.