From: Diane Trout Date: Wed, 22 Jun 2011 22:05:59 +0000 (-0700) Subject: Move parse_flowcell_id out of frontend.samples.results X-Git-Tag: 0.5.2~12 X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=2045ea9a60f315dabf1fb190713dda237c7a6b0b Move parse_flowcell_id out of frontend.samples.results this is so the fastq extraction code can run on systems without django installed. --- diff --git a/htsworkflow/frontend/experiments/models.py b/htsworkflow/frontend/experiments/models.py index 15209fc..f6bac3f 100755 --- a/htsworkflow/frontend/experiments/models.py +++ b/htsworkflow/frontend/experiments/models.py @@ -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__) diff --git a/htsworkflow/frontend/samples/results.py b/htsworkflow/frontend/samples/results.py index 3c6543a..2724a37 100644 --- a/htsworkflow/frontend/samples/results.py +++ b/htsworkflow/frontend/samples/results.py @@ -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 - diff --git a/htsworkflow/frontend/samples/views.py b/htsworkflow/frontend/samples/views.py index c48826c..95270d8 100644 --- a/htsworkflow/frontend/samples/views.py +++ b/htsworkflow/frontend/samples/views.py @@ -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 diff --git a/htsworkflow/pipelines/srf2fastq.py b/htsworkflow/pipelines/srf2fastq.py index adaa1b2..3131fdd 100755 --- a/htsworkflow/pipelines/srf2fastq.py +++ b/htsworkflow/pipelines/srf2fastq.py @@ -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) diff --git a/htsworkflow/submission/condorfastq.py b/htsworkflow/submission/condorfastq.py index 3833dc5..462c177 100644 --- a/htsworkflow/submission/condorfastq.py +++ b/htsworkflow/submission/condorfastq.py @@ -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 diff --git a/htsworkflow/util/conversion.py b/htsworkflow/util/conversion.py index 9246468..18cabef 100644 --- a/htsworkflow/util/conversion.py +++ b/htsworkflow/util/conversion.py @@ -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 +