Skip to content

Commit

Permalink
bubble models up to package level
Browse files Browse the repository at this point in the history
  • Loading branch information
vreuter committed Nov 16, 2017
1 parent dbb5edf commit cb37516
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
5 changes: 2 additions & 3 deletions pep/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
import os
from sys import stdout
from ._version import __version__
from .models import *


FLAGS = ["completed", "running", "failed", "waiting", "partial"]

GENERIC_PROTOCOL_KEY = "*"
IMPLICATIONS_DECLARATION = "implied_columns"
SAMPLE_INDEPENDENT_PROJECT_SECTIONS = \
["metadata", "derived_columns", IMPLICATIONS_DECLARATION, "trackhubs"]
SAMPLE_NAME_COLNAME = "sample_name"
["metadata", "derived_columns", "implied_columns", "trackhubs"]
LOGGING_LEVEL = "INFO"
LOGGING_LOCATIONS = (stdout, )

Expand Down
4 changes: 2 additions & 2 deletions pep/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
import pandas as _pd
import yaml

from . import IMPLICATIONS_DECLARATION, SAMPLE_NAME_COLNAME
from .utils import \
add_project_sample_constants, alpha_cased, check_bam, check_fastq, \
expandpath, get_file_size, grab_project_data, import_from_source, \
Expand All @@ -85,6 +84,7 @@

COMPUTE_SETTINGS_VARNAME = "PEPENV"
DEFAULT_COMPUTE_RESOURCES_NAME = "default"
SAMPLE_NAME_COLNAME = "sample_name"
DATA_SOURCE_COLNAME = "data_source"
SAMPLE_ANNOTATIONS_KEY = "sample_annotation"
DATA_SOURCES_SECTION = "data_sources"
Expand Down Expand Up @@ -2028,7 +2028,7 @@ def set_file_paths(self, project=None):

project = project or self.prj

self.infer_columns(implications=project.get(IMPLICATIONS_DECLARATION))
self.infer_columns(implications=project.get("implied_columns"))

for col in project.get("derived_columns", []):
# Only proceed if the specified column exists
Expand Down
5 changes: 2 additions & 3 deletions tests/models/independent/test_Project.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
import pytest
import yaml
import pep
from pep import SAMPLE_NAME_COLNAME
from pep.models import \
AttributeDict, Project, Sample, \
_MissingMetadataException, SAMPLE_ANNOTATIONS_KEY
AttributeDict, Project, Sample, _MissingMetadataException, \
SAMPLE_ANNOTATIONS_KEY, SAMPLE_NAME_COLNAME


__author__ = "Vince Reuter"
Expand Down
6 changes: 2 additions & 4 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
import copy
import mock
import pytest
from pep import \
IMPLICATIONS_DECLARATION, SAMPLE_INDEPENDENT_PROJECT_SECTIONS, \
SAMPLE_NAME_COLNAME
from pep import SAMPLE_INDEPENDENT_PROJECT_SECTIONS, SAMPLE_NAME_COLNAME
from pep.models import AttributeDict, Project, Sample
from pep.utils import add_project_sample_constants, grab_project_data
from tests.helpers import named_param, nonempty_powerset
Expand Down Expand Up @@ -38,7 +36,7 @@ def basic_project_data():
"results_subdir": "results_pipeline",
"submission_subdir": "submission"},
"derived_columns": ["data_source"],
IMPLICATIONS_DECLARATION: {"organism": {"genomes": {
"implied_columns": {"organism": {"genomes": {
"mouse": "mm10", "rat": "rn6", "human": "hg38"}}},
"trackhubs": []
}
Expand Down

0 comments on commit cb37516

Please sign in to comment.