Move parse_flowcell_id out of frontend.samples.results
authorDiane Trout <diane@caltech.edu>
Wed, 22 Jun 2011 22:05:59 +0000 (15:05 -0700)
committerDiane Trout <diane@caltech.edu>
Wed, 22 Jun 2011 22:05:59 +0000 (15:05 -0700)
this is so the fastq extraction code can run on systems without
django installed.

htsworkflow/frontend/experiments/models.py
htsworkflow/frontend/samples/results.py
htsworkflow/frontend/samples/views.py
htsworkflow/pipelines/srf2fastq.py
htsworkflow/submission/condorfastq.py
htsworkflow/util/conversion.py

index 15209fc59b57761fecbb3ad5b2c3072b912fcddd..f6bac3f3fc23135db33b37d9564e6ca2bed46fbb 100755 (executable)
@@ -13,7 +13,7 @@ from django.db import models
 from django.db.models.signals import post_init
 
 from htsworkflow.frontend.samples.models import Library
-from htsworkflow.frontend.samples.results import parse_flowcell_id
+from htsworkflow.util.conversion import parse_flowcell_id
 from htsworkflow.pipelines import runfolder
 
 logger = logging.getLogger(__name__)
index 3c6543a31bce847e7ab6d4ec72d8ff153e44c836..2724a378a3f6b50610a13325a92812df5252bc41 100644 (file)
@@ -120,19 +120,3 @@ def cn_mTobp(cn_m):
     pass
 
 
-def parse_flowcell_id(flowcell_id):
-    """
-    Return flowcell id and any status encoded in the id
-  
-    We stored the status information in the flowcell id name.
-    this was dumb, but database schemas are hard to update.
-    """
-    fields = flowcell_id.split()
-    fcid = None
-    status = None
-    if len(fields) > 0:
-        fcid = fields[0]
-    if len(fields) > 1:
-        status = fields[1]
-    return fcid, status
-    
index c48826c0e2b884109f73d8c3aeddd15ea3c51351..95270d8c99493d23f8c6ea01c368f5286cac5ae7 100644 (file)
@@ -13,12 +13,12 @@ from htsworkflow.frontend.auth import require_api_key
 from htsworkflow.frontend.experiments.models import FlowCell, Lane, LANE_STATUS_MAP
 from htsworkflow.frontend.samples.changelist import ChangeList
 from htsworkflow.frontend.samples.models import Library, Species, HTSUser
-from htsworkflow.frontend.samples.results import get_flowcell_result_dict, parse_flowcell_id
+from htsworkflow.frontend.samples.results import get_flowcell_result_dict
 from htsworkflow.frontend.bcmagic.forms import BarcodeMagicForm
 from htsworkflow.pipelines.runfolder import load_pipeline_run_xml
 from htsworkflow.pipelines import runfolder
 from htsworkflow.pipelines.eland import ResultLane
-from htsworkflow.util.conversion import unicode_or_none
+from htsworkflow.util.conversion import unicode_or_none, parse_flowcell_id
 from htsworkflow.util import makebed
 from htsworkflow.util import opener
 
index adaa1b2dfe4efcfcd5186bfa86a350ce093de88e..3131fddc7e6edef563a953081f2f9f97e1ff37d2 100755 (executable)
@@ -44,7 +44,7 @@ def main(cmdline=None):
     
     # open the srf, fastq, or compressed fastq
     if is_srf(args[0]):
-        source = srf_open(args[0])
+        source = srf_open(args[0], opts.cnf1)
     else:
         source = autoopen(args[0])
 
@@ -77,6 +77,8 @@ You can also force the flowcell ID to be added to the header.""")
                       help="show information about what we're doing.")
     parser.add_option('--version', default=False, action="store_true",
                       help="Report software version")
+    parser.add_option('--cnf1', default=False, action="store_true",
+                      help="Force cnf1 mode in srf2fastq")
     return parser
 
 
@@ -85,7 +87,7 @@ def srf_open(filename, cnf1=False):
     Make a stream from srf file using srf2fastq
     """
     cmd = ['srf2fastq']
-    if is_cnf1(filename):
+    if cnf1 or is_cnf1(filename):
         cmd.append('-c')
     cmd.append(filename)
       
index 3833dc5d068f4d872ead6c5c7c78c67f6d8ed3e0..462c1772ff2e472d1889b8f263da8f1677f47b2a 100644 (file)
@@ -5,11 +5,11 @@ import os
 import sys
 import types
 
-from htsworkflow.frontend.samples.results import parse_flowcell_id
 from htsworkflow.pipelines.sequences import scan_for_sequences
 from htsworkflow.pipelines import qseq2fastq
 from htsworkflow.pipelines import srf2fastq
 from htsworkflow.util.api import HtswApi
+from htsworkflow.util.conversion import parse_flowcell_id
 
 logger = logging.getLogger(__name__)
 
@@ -83,8 +83,8 @@ class CondorFastqExtract(object):
     def get_qseq_condor_header(self):
         return """Universe=vanilla
 executable=%(exe)s
-error=%(log)s/qseq2fastq.err.$(process).log
-output=%(log)s/qseq2fastq.out.$(process).log
+error=%(log)s/qseq2fastq.$(process).out
+output=%(log)s/qseq2fastq.$(process).out
 log=%(log)s/qseq2fastq.log
 
 """ % {'exe': sys.executable,
@@ -93,10 +93,10 @@ log=%(log)s/qseq2fastq.log
     def get_srf_condor_header(self):
         return """Universe=vanilla
 executable=%(exe)s
-output=%(log)s/srf_pair_fastq.out.$(process).log
-error=%(log)s/srf_pair_fastq.err.$(process).log
+output=%(log)s/srf_pair_fastq.$(process).out
+error=%(log)s/srf_pair_fastq.$(process).out
 log=%(log)s/srf_pair_fastq.log
-environment="%(env)s"
+environment="PYTHONPATH=%(env)s"
     
 """ % {'exe': sys.executable,
            'log': self.log_path,
@@ -198,7 +198,7 @@ environment="%(env)s"
                             flowcell=None,
                             mid=None):
         py = srf2fastq.__file__
-        args = [ py, srf_file, ]
+        args = [ py, srf_file, '--verbose']
         if paired:
             args.extend(['--left', target_pathname])
             # this is ugly. I did it because I was pregenerating the target
index 9246468fc9cf8c49d142eb905851c9517742e8da..18cabef485aaedeafc7f0f1d16761c7c5937b6ea 100644 (file)
@@ -10,3 +10,20 @@ def unicode_or_none(value):
         return None
     else:
         return unicode(value)
+
+def parse_flowcell_id(flowcell_id):
+    """
+    Return flowcell id and any status encoded in the id
+  
+    We stored the status information in the flowcell id name.
+    this was dumb, but database schemas are hard to update.
+    """
+    fields = flowcell_id.split()
+    fcid = None
+    status = None
+    if len(fields) > 0:
+        fcid = fields[0]
+    if len(fields) > 1:
+        status = fields[1]
+    return fcid, status
+