A better resolution to a possible circular dependency.
authorDiane Trout <diane@caltech.edu>
Wed, 9 Jan 2013 00:11:13 +0000 (16:11 -0800)
committerDiane Trout <diane@caltech.edu>
Wed, 9 Jan 2013 00:11:13 +0000 (16:11 -0800)
The runfolder subdirectory processing tools (firecrest, bustard, gerald, etc.)
were importing runfolder for some common constants, however runfolder
imported them to actually build the runfolder structure.

My previous solution was to only include the imports for the
sub-directory processing in the function that used them.
However that lead to needing nested functions which seemed confusing.

What I did was move the common constants into pipelines.__init__
and just imported them from there.

23 files changed:
htsworkflow/pipelines/__init__.py
htsworkflow/pipelines/bustard.py
htsworkflow/pipelines/eland.py
htsworkflow/pipelines/firecrest.py
htsworkflow/pipelines/genomemap.py
htsworkflow/pipelines/gerald.py
htsworkflow/pipelines/ipar.py
htsworkflow/pipelines/retrieve_config.py
htsworkflow/pipelines/runfolder.py
htsworkflow/pipelines/summary.py
htsworkflow/pipelines/test/test_extract_results.py
htsworkflow/pipelines/test/test_genomemap.py
htsworkflow/pipelines/test/test_runfolder026.py
htsworkflow/pipelines/test/test_runfolder030.py
htsworkflow/pipelines/test/test_runfolder110.py
htsworkflow/pipelines/test/test_runfolder_casava_1_7.py
htsworkflow/pipelines/test/test_runfolder_ipar100.py
htsworkflow/pipelines/test/test_runfolder_ipar130.py
htsworkflow/pipelines/test/test_runfolder_pair.py
htsworkflow/pipelines/test/test_runfolder_rta.py
htsworkflow/pipelines/test/test_runfolder_rta160.py
htsworkflow/pipelines/test/test_runfolder_rta180.py
htsworkflow/pipelines/test/test_runfolder_rta1_12.py

index beabfd11e081eaaba5a247ec73b398719ff72d94..8b4b191e65efc072db8b74e2c2786020b27cff7d 100644 (file)
@@ -4,3 +4,12 @@ Provide code to interact with the vendor tools to produce useable "raw" data.
 the illumina sub-package contains components to interact with the Illumina provided
 GAPipeline
 """
+import lxml.etree as ElementTree
+
+EUROPEAN_STRPTIME = "%d-%m-%Y"
+EUROPEAN_DATE_RE = "([0-9]{1,2}-[0-9]{1,2}-[0-9]{4,4})"
+VERSION_RE = "([0-9\.]+)"
+USER_RE = "([a-zA-Z0-9]+)"
+LANES_PER_FLOWCELL = 8
+LANE_LIST = range(1, LANES_PER_FLOWCELL + 1)
+
index 2993d06e6b128b00e1beba1154a74c00b3463818..b5bf7e11a925940b284e655932c4aa602b523838 100644 (file)
@@ -13,7 +13,7 @@ import re
 import sys
 import time
 
-from htsworkflow.pipelines.runfolder import \
+from htsworkflow.pipelines import \
    ElementTree, \
    VERSION_RE, \
    EUROPEAN_STRPTIME
index 84eb397930c41ad575f865795921fcf4c0bde0ae..a508a494c8c24900e8574c75f43c3616bf309814 100644 (file)
@@ -10,7 +10,7 @@ import stat
 import sys
 import types
 
-from htsworkflow.pipelines.runfolder import ElementTree, LANE_LIST
+from htsworkflow.pipelines import ElementTree, LANE_LIST
 from htsworkflow.pipelines.samplekey import SampleKey
 from htsworkflow.pipelines.genomemap import GenomeMap
 from htsworkflow.util.ethelp import indent, flatten
index de6b042a5ddd7cc06d0b7c28e99841edc5579ce9..85b9d3967fecc8bf224a9a72ceb9a4bf463590f8 100644 (file)
@@ -17,7 +17,7 @@ import os
 import re
 import time
 
-from htsworkflow.pipelines.runfolder import \
+from htsworkflow.pipelines import \
    ElementTree, \
    VERSION_RE, \
    EUROPEAN_STRPTIME
index fe6254e34a269ebf8d529e3d0c08547c7ec7f276..1dd95df86578bd83b75468779f1d08e1c4f3988e 100644 (file)
@@ -3,7 +3,7 @@
 from glob import glob
 import os
 import collections
-from htsworkflow.pipelines.runfolder import ElementTree
+from htsworkflow.pipelines import ElementTree
 
 vldInfo = collections.namedtuple('vldInfo', 'name is_link')
 
index db687ea34e11f77f0255df8cd76f8eca1f87c8df..2eaff677e6d90c75848a24a43f4b28fad8d2beff 100644 (file)
@@ -12,7 +12,7 @@ from htsworkflow.pipelines.summary import Summary, SummaryGA, SummaryHiSeq
 from htsworkflow.pipelines.eland import eland, ELAND
 from htsworkflow.pipelines.samplekey import SampleKey
 
-from htsworkflow.pipelines.runfolder import \
+from htsworkflow.pipelines import \
    ElementTree, \
    EUROPEAN_STRPTIME, \
    LANES_PER_FLOWCELL, \
index 28f523dcce754c8efb3bae8430d2edd69efec9b5..f818b3495fbf2fd2d8f2fba13d698188e7680d3f 100644 (file)
@@ -19,7 +19,7 @@ import re
 import stat
 import time
 
-from htsworkflow.pipelines.runfolder import \
+from htsworkflow.pipelines import \
    ElementTree, \
    VERSION_RE, \
    EUROPEAN_STRPTIME
index bd220a0ee854472e643df0b4e15ea3d4e3ac1ea1..a189f097e3017b8c8aac8b26b3d96ccbb0ec4460 100644 (file)
@@ -22,7 +22,7 @@ from htsworkflow.util.url import normalize_url
 from htsworkflow.pipelines.genome_mapper import \
      getAvailableGenomes, \
      constructMapperDict
-from htsworkflow.pipelines.runfolder import LANE_LIST
+from htsworkflow.pipelines import LANE_LIST
 # JSON dictionaries use strings
 LANE_LIST_JSON = [ str(l) for l in LANE_LIST ]
 
index a3b745717ca6e958b2ee0b579563c3b6e2024db5..f23b255455c2296bab64113603e9fcf915cb4c3e 100644 (file)
@@ -12,17 +12,16 @@ import sys
 import tarfile
 import time
 
-import lxml.etree as ElementTree
-
 LOGGER = logging.getLogger(__name__)
 
-EUROPEAN_STRPTIME = "%d-%m-%Y"
-EUROPEAN_DATE_RE = "([0-9]{1,2}-[0-9]{1,2}-[0-9]{4,4})"
-VERSION_RE = "([0-9\.]+)"
-USER_RE = "([a-zA-Z0-9]+)"
-LANES_PER_FLOWCELL = 8
-LANE_LIST = range(1, LANES_PER_FLOWCELL + 1)
-
+from htsworkflow.pipelines import firecrest
+from htsworkflow.pipelines import ipar
+from htsworkflow.pipelines import bustard
+from htsworkflow.pipelines import gerald
+from htsworkflow.pipelines import ElementTree, \
+                                  EUROPEAN_STRPTIME, EUROPEAN_DATE_RE, \
+                                  VERSION_RE, USER_RE, \
+                                  LANES_PER_FLOWCELL, LANE_LIST
 from htsworkflow.util.alphanum import alphanum
 from htsworkflow.util.ethelp import indent, flatten
 from htsworkflow.util.queuecommands import QueueCommands
@@ -121,10 +120,6 @@ class PipelineRun(object):
     def set_elements(self, tree):
         # this file gets imported by all the others,
         # so we need to hide the imports to avoid a cyclic imports
-        from htsworkflow.pipelines import firecrest
-        from htsworkflow.pipelines import ipar
-        from htsworkflow.pipelines import bustard
-        from htsworkflow.pipelines import gerald
 
         tag = tree.tag.lower()
         if tag != PipelineRun.PIPELINE_RUN.lower():
index 6fdda43cf8b4abcee39100e4204df7182fa4a48b..8f47670d99521f37fc8afe75ab8edf292b4c5396 100644 (file)
@@ -7,7 +7,6 @@ import re
 import types
 from pprint import pprint
 
-#from htsworkflow.pipelines.runfolder import ElementTree
 from lxml import html
 from lxml import etree
 from htsworkflow.util.ethelp import indent, flatten
index 6f2b4238fe7d648896bd4c3c3bffce3697dc8cf5..7381d8c38908a41753b79a202daecb9d56df847f 100644 (file)
@@ -13,7 +13,7 @@ from htsworkflow.pipelines import ipar
 from htsworkflow.pipelines import bustard
 from htsworkflow.pipelines import gerald
 from htsworkflow.pipelines import runfolder
-from htsworkflow.pipelines.runfolder import ElementTree
+from htsworkflow.pipelines import ElementTree
 
 from htsworkflow.pipelines.test.simulate_runfolder import *
 
index aa2f618f9324faca633dae27a0053ad76c14b54b..7195d0f044a0e29529dc9e903e9598b12d4ad040 100644 (file)
@@ -7,7 +7,7 @@ import shutil
 import tempfile
 from unittest2 import TestCase
 
-from htsworkflow.pipelines.runfolder import ElementTree
+from htsworkflow.pipelines import ElementTree
 from htsworkflow.pipelines import genomemap
 
 MINI_GENOME_XML = '''<sequenceSizes>
index 8eef13096d3694a11c3f80e0704a6d6cdea7ee6b..970dbc27e1dac8c9e91d07098f570305f11c2c83 100644 (file)
@@ -10,7 +10,7 @@ from htsworkflow.pipelines import firecrest
 from htsworkflow.pipelines import bustard
 from htsworkflow.pipelines import gerald
 from htsworkflow.pipelines import runfolder
-from htsworkflow.pipelines.runfolder import ElementTree
+from htsworkflow.pipelines import ElementTree
 
 from htsworkflow.pipelines.test.simulate_runfolder import *
 
index a571944d834a2e897832f777d137ed707369b5df..cb2bf95b3e048e27ceb20df1414f67cf2ffcfb3a 100644 (file)
@@ -10,7 +10,7 @@ from htsworkflow.pipelines import firecrest
 from htsworkflow.pipelines import bustard
 from htsworkflow.pipelines import gerald
 from htsworkflow.pipelines import runfolder
-from htsworkflow.pipelines.runfolder import ElementTree
+from htsworkflow.pipelines import ElementTree
 
 from htsworkflow.pipelines.test.simulate_runfolder import *
 
index 2397c2a6136e4e109d065685f780c65c4b8721fb..c215f557671c4192e49447ef10e524ab8f0d02ee 100644 (file)
@@ -10,7 +10,7 @@ from htsworkflow.pipelines import firecrest
 from htsworkflow.pipelines import bustard
 from htsworkflow.pipelines import gerald
 from htsworkflow.pipelines import runfolder
-from htsworkflow.pipelines.runfolder import ElementTree
+from htsworkflow.pipelines import ElementTree
 
 from htsworkflow.pipelines.test.simulate_runfolder import *
 
index c0b12b468883ca3e1a61c05359aa237047b0f68f..ae8899eeda02df677ca79360035d1b3c4a3c09df 100644 (file)
@@ -13,7 +13,7 @@ from htsworkflow.pipelines import gerald
 from htsworkflow.pipelines import ipar
 from htsworkflow.pipelines import runfolder
 from htsworkflow.pipelines import srf
-from htsworkflow.pipelines.runfolder import ElementTree
+from htsworkflow.pipelines import ElementTree
 
 from htsworkflow.pipelines.test.simulate_runfolder import *
 
index 1e956326fa5cebc5f515934fa623a5661f3db5fe..04e802642446298fd9fd4a4ce0e473573e99be86 100644 (file)
@@ -10,7 +10,7 @@ from htsworkflow.pipelines import ipar
 from htsworkflow.pipelines import bustard
 from htsworkflow.pipelines import gerald
 from htsworkflow.pipelines import runfolder
-from htsworkflow.pipelines.runfolder import ElementTree
+from htsworkflow.pipelines import ElementTree
 
 from htsworkflow.pipelines.test.simulate_runfolder import *
 
index 07c87784fadd9062c977843566511accbf0f8a57..617b917ffa00c87a585356e7b840bf213640a3a8 100644 (file)
@@ -11,7 +11,7 @@ from htsworkflow.pipelines import ipar
 from htsworkflow.pipelines import bustard
 from htsworkflow.pipelines import gerald
 from htsworkflow.pipelines import runfolder
-from htsworkflow.pipelines.runfolder import ElementTree
+from htsworkflow.pipelines import ElementTree
 
 from htsworkflow.pipelines.test.simulate_runfolder import *
 
index b159c5fd9d953e5eff625a996b84ca9b7d9fa6f3..3ed091d351c8174d0badc58050da4e7b137ff80b 100644 (file)
@@ -11,7 +11,7 @@ from htsworkflow.pipelines import bustard
 from htsworkflow.pipelines import gerald
 from htsworkflow.pipelines.eland import SampleKey
 from htsworkflow.pipelines import runfolder
-from htsworkflow.pipelines.runfolder import ElementTree
+from htsworkflow.pipelines import ElementTree
 
 from htsworkflow.pipelines.test.simulate_runfolder import *
 
index 2c82041f4e18e37956661b08f11e2afaf2d3a808..0503ea5916c998eb2a63b06f12c161764dcd5671 100644 (file)
@@ -12,7 +12,7 @@ from htsworkflow.pipelines import bustard
 from htsworkflow.pipelines import gerald
 from htsworkflow.pipelines import runfolder
 from htsworkflow.pipelines.samplekey import SampleKey
-from htsworkflow.pipelines.runfolder import ElementTree
+from htsworkflow.pipelines import ElementTree
 
 from htsworkflow.pipelines.test.simulate_runfolder import *
 
index 9d4879a47f498c70c850bf90cf1332933ffd790a..25ab00f8a23ad4624c794c350e3a04ddcfcc2884 100644 (file)
@@ -12,7 +12,7 @@ from htsworkflow.pipelines import bustard
 from htsworkflow.pipelines import gerald
 from htsworkflow.pipelines import runfolder
 from htsworkflow.pipelines.samplekey import SampleKey
-from htsworkflow.pipelines.runfolder import ElementTree
+from htsworkflow.pipelines import ElementTree
 
 from htsworkflow.pipelines.test.simulate_runfolder import *
 
index be83c3fbdaf06557912e661f6d6c5e8d1a68ffb6..a4039e7991537a01368914cce186e40310524be9 100644 (file)
@@ -12,7 +12,7 @@ from htsworkflow.pipelines import bustard
 from htsworkflow.pipelines import gerald
 from htsworkflow.pipelines import runfolder
 from htsworkflow.pipelines.samplekey import SampleKey
-from htsworkflow.pipelines.runfolder import ElementTree
+from htsworkflow.pipelines import ElementTree
 
 from htsworkflow.pipelines.test.simulate_runfolder import *
 
index 2a64b4fe4d1487a51b1a72be8926bacdf59919c8..b04dfe63affe387ca61f78e45dfd2ddaaa13a755 100644 (file)
@@ -13,7 +13,7 @@ from htsworkflow.pipelines import ipar
 from htsworkflow.pipelines import bustard
 from htsworkflow.pipelines import gerald
 from htsworkflow.pipelines import runfolder
-from htsworkflow.pipelines.runfolder import ElementTree
+from htsworkflow.pipelines import ElementTree
 
 from htsworkflow.pipelines.test.simulate_runfolder import *