From: Diane Trout Date: Wed, 17 Jun 2009 19:24:29 +0000 (+0000) Subject: Loading really old run xml files caused the website to crash X-Git-Tag: 0.2.5~6 X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=31f2a7d8e7fdbf919155136b629bc9b295303248 Loading really old run xml files caused the website to crash with an attribute error. frontend/samples/views.py line 220 had eland_summary = run.gerald.eland_results.results[end][lane_id] However really old run.xmls lacked any eland_results so I added some code to add dummy entries if the Eland class wasn't initialized. Also this adds a bit of test code which at least tries to load a couple run xml files. --- diff --git a/htsworkflow/pipelines/eland.py b/htsworkflow/pipelines/eland.py index 559a2a2..2e0d9dc 100644 --- a/htsworkflow/pipelines/eland.py +++ b/htsworkflow/pipelines/eland.py @@ -8,7 +8,7 @@ import os import re import stat -from htsworkflow.pipelines.runfolder import ElementTree +from htsworkflow.pipelines.runfolder import ElementTree, LANE_LIST from htsworkflow.util.ethelp import indent, flatten from htsworkflow.util.opener import autoopen @@ -423,7 +423,6 @@ class SequenceLane(ResultLane): self._reads = int(element.text) elif tag == SequenceLane.SEQUENCE_TYPE.lower(): self.sequence_type = lookup_sequence_type.get(element.text, None) - print self.sequence_type else: logging.warn("SequenceLane unrecognized tag %s" % (element.tag,)) @@ -445,6 +444,12 @@ class ELAND(object): if xml is not None: self.set_elements(xml) + if len(self.results[0]) == 0: + # Initialize our eland object with meaningless junk + for l in LANE_LIST: + self.results[0][l] = ResultLane(lane_id=l, end=0) + + def get_elements(self): root = ElementTree.Element(ELAND.ELAND, {'version': unicode(ELAND.XML_VERSION)}) diff --git a/htsworkflow/pipelines/test/test_load_run_xml.py b/htsworkflow/pipelines/test/test_load_run_xml.py new file mode 100644 index 0000000..3a8713b --- /dev/null +++ b/htsworkflow/pipelines/test/test_load_run_xml.py @@ -0,0 +1,25 @@ +import os +import unittest +from StringIO import StringIO + +from simulate_runfolder import TESTDATA_DIR +from htsworkflow.pipelines.runfolder import load_pipeline_run_xml + +class testLoadRunXML(unittest.TestCase): + def testVerson0(self): + runxml_path = os.path.join(TESTDATA_DIR, 'run_FC12150_2007-09-27.xml') + run = load_pipeline_run_xml(runxml_path) + eland_summary_by_lane = run.gerald.eland_results.results[0] + assert len(eland_summary_by_lane) == 8 + + def testVerson1(self): + runxml_path = os.path.join(TESTDATA_DIR, 'run_207B2AAXX_2008-04-12.xml') + run = load_pipeline_run_xml(runxml_path) + eland_summary_by_lane = run.gerald.eland_results.results[0] + assert len(eland_summary_by_lane) == 8 + +def suite(): + return unittest.makeSuite(testLoadRunXML,'test') + +if __name__ == "__main__": + unittest.main(defaultTest="suite") diff --git a/htsworkflow/pipelines/test/testdata/run_207B2AAXX_2008-04-12.xml b/htsworkflow/pipelines/test/testdata/run_207B2AAXX_2008-04-12.xml new file mode 100644 index 0000000..4ea73db --- /dev/null +++ b/htsworkflow/pipelines/test/testdata/run_207B2AAXX_2008-04-12.xml @@ -0,0 +1,836 @@ + + 207B2AAXX + + 1.8.28 + 1 + 33 + 1207983600.0 + diane + # Auto-generated frequency response matrix +> A +> C +> G +> T +0.77 0.15 -0.04 -0.04 +0.76 1.02 -0.05 -0.06 +-0.10 -0.10 1.17 -0.03 +-0.13 -0.12 0.80 1.27 + + + + 1.8.28 + 1207983600.0 + diane + + + 0.0099 + 0.0035 + + + 0.0099 + 0.0035 + + + 0.0099 + 0.0035 + + + 0.0099 + 0.0035 + + + 0.0099 + 0.0035 + + + 0.0099 + 0.0035 + + + 0.0099 + 0.0035 + + + 0.0099 + 0.0035 + + + + + + + default + + + + + Need_to_specify_ELAND_genome_directory + 8 + + domain.com + diane + localhost:25 + /home/diane/gec/080408_HWI-EAS229_0023_207B2AAXX/Data/C1-33_Firecrest1.8.28_12-04-2008_diane/Bustard1.8.28_12-04-2008_diane + /home/diane/gec + 1 + /home/diane/proj/SolexaPipeline-0.2.2.6/Goat/../Gerald/../../Genomes + Need_to_specify_genome_file_name + genome + /home/diane/gec/080408_HWI-EAS229_0023_207B2AAXX/Data/C1-33_Firecrest1.8.28_12-04-2008_diane/Bustard1.8.28_12-04-2008_diane/GERALD_12-04-2008_diane + + _prb.txt + 12 + '((CHASTITY>=0.6))' + _qhg.txt + --symbolic + 32 + --scarf + _seq.txt + _sig2.txt + _sig.txt + @(#) Id: GERALD.pl,v 1.68.2.2 2007/06/13 11:08:49 km Exp + s_[1-8]_[0-9][0-9][0-9][0-9] + s + Sat Apr 12 08:51:25 2008 + /home/diane/proj/SolexaPipeline-0.2.2.6/Goat/../Gerald + all + http://host.domain.com/yourshare/ + + + + eland + eland + eland + eland + eland + eland + eland + eland + + + /data-store01/compbio/genomes/canfam2 + /data-store01/compbio/genomes/equcab1 + /data-store01/compbio/genomes/hg18 + /data-store01/compbio/genomes/hg18 + /data-store01/compbio/genomes/strpur2 + /data-store01/compbio/genomes/elegans170 + /data-store01/compbio/genomes/elegans170 + /data-store01/compbio/genomes/elegans170 + + + 32 + 32 + 32 + 32 + 32 + 32 + 32 + 32 + + + YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY + YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY + YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY + YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY + YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY + YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY + YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY + YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + s + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8305385 + + + s + 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 12607931 + + + s + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 9599296 + + + s + 5 + + + + + + + + + + + + + + + + + + + + + + 9308969 + + + s + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 13709480 + + + s + 7 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 13294465 + + + s + 6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 8926451 + + + s + 8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 11737186 + + + + diff --git a/htsworkflow/pipelines/test/testdata/run_FC12150_2007-09-27.xml b/htsworkflow/pipelines/test/testdata/run_FC12150_2007-09-27.xml new file mode 100644 index 0000000..a9f3ec3 --- /dev/null +++ b/htsworkflow/pipelines/test/testdata/run_FC12150_2007-09-27.xml @@ -0,0 +1,173 @@ + + FC12150 + + 1.8.28 + 1 + 36 + 1190876400.0 + # Auto-generated frequency response matrix +> A +> C +> G +> T +2.19 0.39 -0.03 -0.02 +3.09 2.85 -0.15 -0.12 +-0.02 -0.01 0.39 -0.00 +-0.02 -0.02 0.37 0.51 + + + + 1.8.28 + 1190876400.0 + + + + + default + + + /data-store01/compbio/genomes + + Need_to_specify_ELAND_genome_directory + 8 + + domain.com + diane + localhost:25 + /zpool1/compbio/diane/sequencer/070924_USI-EAS44_0022_FC12150/Data/C1-36_Firecrest1.8.28_27-09-2007_diane/Bustard1.8.28_27-09-2007_diane + /zpool1/compbio/diane/sequencer + 1 + /data-store01/compbio/genomes + Need_to_specify_genome_file_name + genome + /zpool1/compbio/diane/sequencer/070924_USI-EAS44_0022_FC12150/Data/C1-36_Firecrest1.8.28_27-09-2007_diane/Bustard1.8.28_27-09-2007_diane/GERALD_27-09-2007_diane + + _prb.txt + 12 + '((CHASTITY>=0.6))' + _qhg.txt + --symbolic + 32 + --scarf + _seq.txt + _sig2.txt + _sig.txt + @(#) Id: GERALD.pl,v 1.68.2.2 2007/06/13 11:08:49 km Exp + s_[1-8]_[0-9][0-9][0-9][0-9] + s + Thu Sep 27 14:22:54 2007 + /home/diane/proj/SolexaPipeline-0.2.2.6/Goat/../Gerald + all + http://host.domain.com/yourshare/ + + + + eland + eland + eland + eland + eland + eland + eland + eland + + + /data-store01/compbio/genomes/hg18 + /data-store01/compbio/genomes/hg18 + /data-store01/compbio/genomes/hg18 + /data-store01/compbio/genomes/hg18 + /data-store01/compbio/genomes/hg18 + /data-store01/compbio/genomes/hg18 + /data-store01/compbio/genomes/hg18 + /data-store01/compbio/genomes/hg18 + + + 32 + 32 + 32 + 32 + 32 + 32 + 32 + 32 + + + YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY + YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY + YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY + YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY + YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY + YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY + YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY + YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +