本文整理汇总了Python中htsworkflow.pipelines.ElementTree.tostring方法的典型用法代码示例。如果您正苦于以下问题:Python ElementTree.tostring方法的具体用法?Python ElementTree.tostring怎么用?Python ElementTree.tostring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类htsworkflow.pipelines.ElementTree
的用法示例。
在下文中一共展示了ElementTree.tostring方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_runfolder
# 需要导入模块: from htsworkflow.pipelines import ElementTree [as 别名]
# 或者: from htsworkflow.pipelines.ElementTree import tostring [as 别名]
def test_runfolder(self):
runs = runfolder.get_runs(self.runfolder_dir)
# do we get the flowcell id from the filename?
self.assertEqual(len(runs), 1)
name = 'run_4286GAAXX_%s.xml' % ( date.today().strftime('%Y-%m-%d'),)
self.assertEqual(runs[0].serialization_filename, name)
self.assertEqual(runs[0].runfolder_name, '090220_HWI-EAS229_0093_30VR0AAXX')
# do we get the flowcell id from the FlowcellId.xml file
make_flowcell_id(self.runfolder_dir, '207BTAAXY')
runs = runfolder.get_runs(self.runfolder_dir)
self.assertEqual(len(runs), 1)
name = 'run_207BTAAXY_%s.xml' % ( date.today().strftime('%Y-%m-%d'),)
self.assertEqual(runs[0].serialization_filename, name)
r1 = runs[0]
xml = r1.get_elements()
xml_str = ElementTree.tostring(xml)
r2 = runfolder.PipelineRun(xml=xml)
self.assertEqual(r1.serialization_filename, r2.serialization_filename)
self.assertNotEqual(r2.image_analysis, None)
self.assertNotEqual(r2.bustard, None)
self.assertNotEqual(r2.gerald, None)
示例2: test_runfolder
# 需要导入模块: from htsworkflow.pipelines import ElementTree [as 别名]
# 或者: from htsworkflow.pipelines.ElementTree import tostring [as 别名]
def test_runfolder(self):
runs = runfolder.get_runs(self.runfolder_dir)
# do we get the flowcell id from the filename?
self.assertEqual(len(runs), 1)
# firecrest's date depends on filename not the create time.
name = 'run_207BTAAXX_2009-02-22.xml'
self.assertEqual(runs[0].serialization_filename, name)
# do we get the flowcell id from the FlowcellId.xml file
make_flowcell_id(self.runfolder_dir, '207BTAAXY')
runs = runfolder.get_runs(self.runfolder_dir)
self.assertEqual(len(runs), 1)
name = 'run_207BTAAXY_2009-02-22.xml'
self.assertEqual(runs[0].serialization_filename, name)
r1 = runs[0]
xml = r1.get_elements()
xml_str = ElementTree.tostring(xml)
r2 = runfolder.PipelineRun(xml=xml)
self.assertEqual(r1.serialization_filename, r2.serialization_filename)
self.assertNotEqual(r2.image_analysis, None)
self.assertNotEqual(r2.bustard, None)
self.assertNotEqual(r2.gerald, None)
示例3: main
# 需要导入模块: from htsworkflow.pipelines import ElementTree [as 别名]
# 或者: from htsworkflow.pipelines.ElementTree import tostring [as 别名]
def main(cmdline=None):
"""Run eland extraction against the specified gerald directory"""
from optparse import OptionParser
parser = OptionParser("%prog: <gerald dir>+")
opts, args = parser.parse_args(cmdline)
logging.basicConfig(level=logging.DEBUG)
for a in args:
LOGGER.info("Starting scan of %s" % (a,))
e = eland(a)
print(ElementTree.tostring(e.get_elements()))
return
示例4: main
# 需要导入模块: from htsworkflow.pipelines import ElementTree [as 别名]
# 或者: from htsworkflow.pipelines.ElementTree import tostring [as 别名]
def main(cmdline):
parser = make_cmdline_parser()
opts, args = parser.parse_args(cmdline)
for bustard_dir in args:
print(u'analyzing bustard directory: ' + str(bustard_dir))
bustard_object = bustard(bustard_dir)
bustard_object.dump()
bustard_object2 = Bustard(xml=bustard_object.get_elements())
print('-------------------------------------')
bustard_object2.dump()
print('=====================================')
b1_tree = bustard_object.get_elements()
b1 = ElementTree.tostring(b1_tree).split(os.linesep)
b2_tree = bustard_object2.get_elements()
b2 = ElementTree.tostring(b2_tree).split(os.linesep)
for line1, line2 in zip(b1, b2):
if b1 != b2:
print("b1: ", b1)
print("b2: ", b2)
示例5: test_eland
# 需要导入模块: from htsworkflow.pipelines import ElementTree [as 别名]
# 或者: from htsworkflow.pipelines.ElementTree import tostring [as 别名]
def test_eland(self):
hg_map = {'Lambda.fa': 'Lambda.fa'}
for i in range(1,22):
short_name = 'chr%d.fa' % (i,)
long_name = 'hg18/chr%d.fa' % (i,)
hg_map[short_name] = long_name
genome_maps = { 1:hg_map, 2:hg_map, 3:hg_map, 4:hg_map,
5:hg_map, 6:hg_map, 7:hg_map, 8:hg_map }
eland = gerald.eland(self.gerald_dir, genome_maps=genome_maps)
for key in eland:
lane = eland[key]
self.assertEqual(lane.reads, 6)
self.assertEqual(lane.sample_name, "s")
self.assertEqual(lane.lane_id, key.lane)
self.assertEqual(len(lane.mapped_reads), 17)
self.assertEqual(lane.mapped_reads['hg18/chr5.fa'], 4)
self.assertEqual(lane.mapped_reads['spike.fa/sample1'], 1)
self.assertEqual(lane.mapped_reads['spike.fa/sample2'], 1)
self.assertEqual(lane.match_codes['U0'], 3)
self.assertEqual(lane.match_codes['R0'], 2)
self.assertEqual(lane.match_codes['U1'], 1)
self.assertEqual(lane.match_codes['R1'], 9)
self.assertEqual(lane.match_codes['U2'], 0)
self.assertEqual(lane.match_codes['R2'], 12)
self.assertEqual(lane.match_codes['NM'], 1)
self.assertEqual(lane.match_codes['QC'], 0)
xml = eland.get_elements()
# just make sure that element tree can serialize the tree
xml_str = ElementTree.tostring(xml)
e2 = gerald.ELAND(xml=xml)
for key in eland:
l1 = eland[key]
l2 = e2[key]
self.assertEqual(l1.reads, l2.reads)
self.assertEqual(l1.sample_name, l2.sample_name)
self.assertEqual(l1.lane_id, l2.lane_id)
self.assertEqual(len(l1.mapped_reads), len(l2.mapped_reads))
self.assertEqual(len(l1.mapped_reads), 17)
for k in l1.mapped_reads.keys():
self.assertEqual(l1.mapped_reads[k],
l2.mapped_reads[k])
self.assertEqual(len(l1.match_codes), 9)
self.assertEqual(len(l1.match_codes), len(l2.match_codes))
for k in l1.match_codes.keys():
self.assertEqual(l1.match_codes[k],
l2.match_codes[k])
示例6: test_ipar
# 需要导入模块: from htsworkflow.pipelines import ElementTree [as 别名]
# 或者: from htsworkflow.pipelines.ElementTree import tostring [as 别名]
def test_ipar(self):
"""
Construct a firecrest object
"""
i = ipar.ipar(self.image_analysis_dir)
self.assertEqual(i.version, '1.4.6.0')
self.assertEqual(i.start, 1)
self.assertEqual(i.stop, 38)
xml = i.get_elements()
# just make sure that element tree can serialize the tree
xml_str = ElementTree.tostring(xml)
i2 = ipar.IPAR(xml=xml)
self.assertEqual(i.version, i2.version)
self.assertEqual(i.start, i2.start)
self.assertEqual(i.stop, i2.stop)
self.assertEqual(i.date, i2.date)
示例7: test_eland
# 需要导入模块: from htsworkflow.pipelines import ElementTree [as 别名]
# 或者: from htsworkflow.pipelines.ElementTree import tostring [as 别名]
def test_eland(self):
dm3_map = { 'chrUextra.fa' : 'dm3/chrUextra.fa',
'chr2L.fa': 'dm3/chr2L.fa',
'Lambda.fa': 'Lambda.fa'}
genome_maps = { 1:dm3_map, 2:dm3_map, 3:dm3_map, 4:dm3_map,
5:dm3_map, 6:dm3_map, 7:dm3_map, 8:dm3_map }
eland = gerald.eland(self.gerald_dir, genome_maps=genome_maps)
for key in eland:
lane = eland[key]
self.assertEqual(lane.reads, 4)
self.assertEqual(lane.sample_name, "s")
self.assertEqual(lane.lane_id, key.lane)
self.assertEqual(len(lane.mapped_reads), 3)
self.assertEqual(lane.mapped_reads['Lambda.fa'], 1)
self.assertEqual(lane.mapped_reads['dm3/chr2L.fa'], 1)
self.assertEqual(lane.match_codes['U1'], 2)
self.assertEqual(lane.match_codes['NM'], 1)
xml = eland.get_elements()
# just make sure that element tree can serialize the tree
xml_str = ElementTree.tostring(xml)
e2 = gerald.ELAND(xml=xml)
for key in eland:
l1 = eland[key]
l2 = e2[key]
self.assertEqual(l1.reads, l2.reads)
self.assertEqual(l1.sample_name, l2.sample_name)
self.assertEqual(l1.lane_id, l2.lane_id)
self.assertEqual(len(l1.mapped_reads), len(l2.mapped_reads))
self.assertEqual(len(l1.mapped_reads), 3)
for k in l1.mapped_reads.keys():
self.assertEqual(l1.mapped_reads[k],
l2.mapped_reads[k])
self.assertEqual(len(l1.match_codes), 9)
self.assertEqual(len(l1.match_codes), len(l2.match_codes))
for k in l1.match_codes.keys():
self.assertEqual(l1.match_codes[k],
l2.match_codes[k])
示例8: test_runfolder
# 需要导入模块: from htsworkflow.pipelines import ElementTree [as 别名]
# 或者: from htsworkflow.pipelines.ElementTree import tostring [as 别名]
def test_runfolder(self):
runs = runfolder.get_runs(self.runfolder_dir)
# do we get the flowcell id from the filename?
self.assertEqual(len(runs), 1)
self.assertEqual(runs[0].serialization_filename, 'run_207BTAAXX_2008-04-19.xml')
# do we get the flowcell id from the FlowcellId.xml file
make_flowcell_id(self.runfolder_dir, '207BTAAXY')
runs = runfolder.get_runs(self.runfolder_dir)
self.assertEqual(len(runs), 1)
self.assertEqual(runs[0].serialization_filename, 'run_207BTAAXY_2008-04-19.xml')
r1 = runs[0]
xml = r1.get_elements()
xml_str = ElementTree.tostring(xml)
r2 = runfolder.PipelineRun(xml=xml)
self.assertEqual(r1.serialization_filename, r2.serialization_filename)
self.assertNotEqual(r2.image_analysis, None)
self.assertNotEqual(r2.bustard, None)
self.assertNotEqual(r2.gerald, None)
示例9: test_firecrest
# 需要导入模块: from htsworkflow.pipelines import ElementTree [as 别名]
# 或者: from htsworkflow.pipelines.ElementTree import tostring [as 别名]
def test_firecrest(self):
"""
Construct a firecrest object
"""
f = firecrest.firecrest(self.image_analysis_dir)
self.assertEqual(f.software, 'Firecrest')
self.assertEqual(f.version, '1.9.6')
self.assertEqual(f.start, 1)
self.assertEqual(f.stop, 37)
self.assertEqual(f.user, 'diane')
self.assertEqual(f.date, date(2008,10,20))
xml = f.get_elements()
# just make sure that element tree can serialize the tree
xml_str = ElementTree.tostring(xml)
f2 = firecrest.Firecrest(xml=xml)
self.assertEqual(f.software, f2.software)
self.assertEqual(f.version, f2.version)
self.assertEqual(f.start, f2.start)
self.assertEqual(f.stop, f2.stop)
self.assertEqual(f.user, f2.user)
示例10: test_runfolder
# 需要导入模块: from htsworkflow.pipelines import ElementTree [as 别名]
# 或者: from htsworkflow.pipelines.ElementTree import tostring [as 别名]
def test_runfolder(self):
runs = runfolder.get_runs(self.runfolder_dir)
# do we get the flowcell id from the filename?
self.assertEqual(len(runs), 1)
name = 'run_%s_%s.xml' % ( FCID, date.today().strftime('%Y-%m-%d'),)
self.assertEqual(runs[0].serialization_filename, name)
# do we get the flowcell id from the FlowcellId.xml file
make_flowcell_id(self.runfolder_dir, FCID)
runs = runfolder.get_runs(self.runfolder_dir)
self.assertEqual(len(runs), 1)
name = 'run_%s_%s.xml' % ( FCID, date.today().strftime('%Y-%m-%d'),)
self.assertEqual(runs[0].serialization_filename, name)
r1 = runs[0]
xml = r1.get_elements()
xml_str = ElementTree.tostring(xml)
r2 = runfolder.PipelineRun(xml=xml)
self.assertEqual(r1.serialization_filename, r2.serialization_filename)
self.assertNotEqual(r2.image_analysis, None)
self.assertNotEqual(r2.bustard, None)
self.assertNotEqual(r2.gerald, None)
示例11: test_runfolder
# 需要导入模块: from htsworkflow.pipelines import ElementTree [as 别名]
# 或者: from htsworkflow.pipelines.ElementTree import tostring [as 别名]
def test_runfolder(self):
runs = runfolder.get_runs(self.runfolder_dir)
# do we get the flowcell id from the filename?
self.assertEqual(len(runs), 1)
self.assertEqual(runs[0].flowcell_id, self.flowcell_id)
name = 'run_%s_%s.xml' % ( self.flowcell_id,
date.today().strftime('%Y-%m-%d'),)
self.assertEqual(runs[0].serialization_filename, name)
bustard_dir = os.path.join(self.runfolder_dir, 'Unaligned')
r1 = runs[0]
self.assertEqual(r1.bustard.sequence_format, 'fastq')
self.assertEqual(r1.bustard.pathname, bustard_dir)
self.assertEqual(r1.gerald.runfolder_name, 'Unaligned')
xml = r1.get_elements()
xml_str = ElementTree.tostring(xml)
r2 = runfolder.PipelineRun(xml=xml)
self.assertEqual(r1.serialization_filename, r2.serialization_filename)
self.assertNotEqual(r2.image_analysis, None)
self.assertNotEqual(r2.bustard, None)
self.assertNotEqual(r2.gerald, None)
示例12: test_firecrest
# 需要导入模块: from htsworkflow.pipelines import ElementTree [as 别名]
# 或者: from htsworkflow.pipelines.ElementTree import tostring [as 别名]
def test_firecrest(self):
"""
Construct a firecrest object
"""
f = firecrest.firecrest(self.image_analysis_dir)
self.assertEqual(f.software, 'Firecrest')
self.assertEqual(f.version, '1.9.6')
self.assertEqual(f.start, 1)
self.assertEqual(f.stop, 152)
self.assertEqual(f.user, 'diane')
# As of 2008-12-8, the date was being set in
# simulate_runfolder.make_firecrest_dir
self.assertEqual(f.date, date(2008,4,12))
xml = f.get_elements()
# just make sure that element tree can serialize the tree
xml_str = ElementTree.tostring(xml)
f2 = firecrest.Firecrest(xml=xml)
self.assertEqual(f.software, f2.software)
self.assertEqual(f.version, f2.version)
self.assertEqual(f.start, f2.start)
self.assertEqual(f.stop, f2.stop)
self.assertEqual(f.user, f2.user)
示例13: test_gerald
# 需要导入模块: from htsworkflow.pipelines import ElementTree [as 别名]
# 或者: from htsworkflow.pipelines.ElementTree import tostring [as 别名]
def test_gerald(self):
# need to update gerald and make tests for it
g = gerald.gerald(self.gerald_dir)
self.assertEqual(g.software, 'GERALD')
self.assertEqual(g.version, '1.171')
self.assertEqual(g.date, datetime(2009,2,22,21,15,59))
self.assertEqual(len(g.lanes), len(g.lanes.keys()))
self.assertEqual(len(g.lanes), len(g.lanes.items()))
# list of genomes, matches what was defined up in
# make_gerald_config.
# the first None is to offset the genomes list to be 1..9
# instead of pythons default 0..8
genomes = [None,
'/g/mm9',
'/g/mm9',
'/g/elegans190',
'/g/arabidopsis01222004',
'/g/mm9',
'/g/mm9',
'/g/mm9',
'/g/mm9', ]
# test lane specific parameters from gerald config file
for i in range(1,9):
cur_lane = g.lanes[i]
self.assertEqual(cur_lane.analysis, 'eland_extended')
self.assertEqual(cur_lane.eland_genome, genomes[i])
self.assertEqual(cur_lane.read_length, '37')
self.assertEqual(cur_lane.use_bases, 'Y'*37)
# I want to be able to use a simple iterator
for l in g.lanes.values():
self.assertEqual(l.analysis, 'eland_extended')
self.assertEqual(l.read_length, '37')
self.assertEqual(l.use_bases, 'Y'*37)
# raw cluster numbers extracted from summary file
# its the first +/- value in the lane results summary
# section
clusters = [None,
(190220, 15118), (190560, 14399),
(187597, 12369), (204142, 16877),
(247308, 11600), (204298, 15640),
(202707, 15404), (198075, 14702),]
self.assertEqual(len(g.summary), 1)
for i in range(1,9):
summary_lane = g.summary[0][i]
self.assertEqual(summary_lane.cluster, clusters[i])
self.assertEqual(summary_lane.lane, i)
xml = g.get_elements()
# just make sure that element tree can serialize the tree
xml_str = ElementTree.tostring(xml)
g2 = gerald.Gerald(xml=xml)
# do it all again after extracting from the xml file
self.assertEqual(g.software, g2.software)
self.assertEqual(g.version, g2.version)
self.assertEqual(g.date, g2.date)
self.assertEqual(len(g.lanes.keys()), len(g2.lanes.keys()))
self.assertEqual(len(g.lanes.items()), len(g2.lanes.items()))
# test lane specific parameters from gerald config file
for i in range(1,9):
g_lane = g.lanes[i]
g2_lane = g2.lanes[i]
self.assertEqual(g_lane.analysis, g2_lane.analysis)
self.assertEqual(g_lane.eland_genome, g2_lane.eland_genome)
self.assertEqual(g_lane.read_length, g2_lane.read_length)
self.assertEqual(g_lane.use_bases, g2_lane.use_bases)
self.assertEqual(len(g.summary), 1)
# test (some) summary elements
for i in range(1,9):
g_summary = g.summary[0][i]
g2_summary = g2.summary[0][i]
self.assertEqual(g_summary.cluster, g2_summary.cluster)
self.assertEqual(g_summary.lane, g2_summary.lane)
g_eland = g.eland_results
g2_eland = g2.eland_results
for key in g_eland:
g_results = g_eland[key]
g2_results = g2_eland[key]
self.assertEqual(g_results.reads,
g2_results.reads)
self.assertEqual(len(g_results.mapped_reads),
len(g2_results.mapped_reads))
for k in g_results.mapped_reads.keys():
self.assertEqual(g_results.mapped_reads[k],
g2_results.mapped_reads[k])
self.assertEqual(len(g_results.match_codes),
len(g2_results.match_codes))
for k in g_results.match_codes.keys():
self.assertEqual(g_results.match_codes[k],
#.........这里部分代码省略.........
示例14: test_gerald
# 需要导入模块: from htsworkflow.pipelines import ElementTree [as 别名]
# 或者: from htsworkflow.pipelines.ElementTree import tostring [as 别名]
def test_gerald(self):
# need to update gerald and make tests for it
g = gerald.gerald(self.gerald_dir)
self.assertEqual(g.software, 'GERALD')
self.assertEqual(g.version, '1.171')
self.assertEqual(g.date, datetime(2009,2,22,21,15,59))
self.assertEqual(len(g.lanes), len(g.lanes.keys()))
self.assertEqual(len(g.lanes), len(g.lanes.items()))
# list of genomes, matches what was defined up in
# make_gerald_config.
# the first None is to offset the genomes list to be 1..9
# instead of pythons default 0..8
genomes = [None,
'/g/mm9',
'/g/mm9',
'/g/elegans190',
'/g/arabidopsis01222004',
'/g/mm9',
'/g/mm9',
'/g/mm9',
'/g/mm9', ]
# test lane specific parameters from gerald config file
for i in range(1,9):
cur_lane = g.lanes[i]
self.assertEqual(cur_lane.analysis, 'eland_extended')
self.assertEqual(cur_lane.eland_genome, genomes[i])
self.assertEqual(cur_lane.read_length, '37')
self.assertEqual(cur_lane.use_bases, 'Y'*37)
# I want to be able to use a simple iterator
for l in g.lanes.values():
self.assertEqual(l.analysis, 'eland_extended')
self.assertEqual(l.read_length, '37')
self.assertEqual(l.use_bases, 'Y'*37)
# test data extracted from summary file
clusters = [None,
(281331, 11169), (203841, 13513),
(220889, 15653), (137294, 14666),
(129388, 14525), (262092, 10751),
(185754, 13503), (233765, 9537),]
self.assertEqual(len(g.summary), 1)
for i in range(1,9):
summary_lane = g.summary[0][i]
self.assertEqual(summary_lane.cluster, clusters[i])
self.assertEqual(summary_lane.lane, i)
xml = g.get_elements()
# just make sure that element tree can serialize the tree
xml_str = ElementTree.tostring(xml)
g2 = gerald.Gerald(xml=xml)
# do it all again after extracting from the xml file
self.assertEqual(g.software, g2.software)
self.assertEqual(g.version, g2.version)
self.assertEqual(g.date, g2.date)
self.assertEqual(len(g.lanes.keys()), len(g2.lanes.keys()))
self.assertEqual(len(g.lanes.items()), len(g2.lanes.items()))
# test lane specific parameters from gerald config file
for i in range(1,9):
g_lane = g.lanes[i]
g2_lane = g2.lanes[i]
self.assertEqual(g_lane.analysis, g2_lane.analysis)
self.assertEqual(g_lane.eland_genome, g2_lane.eland_genome)
self.assertEqual(g_lane.read_length, g2_lane.read_length)
self.assertEqual(g_lane.use_bases, g2_lane.use_bases)
# test (some) summary elements
self.assertEqual(len(g.summary), 1)
for i in range(1,9):
g_summary = g.summary[0][i]
g2_summary = g2.summary[0][i]
self.assertEqual(g_summary.cluster, g2_summary.cluster)
self.assertEqual(g_summary.lane, g2_summary.lane)
g_eland = g.eland_results
g2_eland = g2.eland_results
for lane in g_eland:
g_results = g_eland[lane]
g2_results = g2_eland[lane]
self.assertEqual(g_results.reads,
g2_results.reads)
if isinstance(g_results, eland.ElandLane):
self.assertEqual(len(g_results.mapped_reads),
len(g2_results.mapped_reads))
for k in g_results.mapped_reads.keys():
self.assertEqual(g_results.mapped_reads[k],
g2_results.mapped_reads[k])
self.assertEqual(len(g_results.match_codes),
len(g2_results.match_codes))
for k in g_results.match_codes.keys():
self.assertEqual(g_results.match_codes[k],
g2_results.match_codes[k])
示例15: test_eland
# 需要导入模块: from htsworkflow.pipelines import ElementTree [as 别名]
# 或者: from htsworkflow.pipelines.ElementTree import tostring [as 别名]
def test_eland(self):
hg_map = {'Lambda.fa': 'Lambda.fa'}
for i in range(1,22):
short_name = 'chr%d.fa' % (i,)
long_name = 'hg18/chr%d.fa' % (i,)
hg_map[short_name] = long_name
genome_maps = { 1:hg_map, 2:hg_map, 3:hg_map, 4:hg_map,
5:hg_map, 6:hg_map, 7:hg_map, 8:hg_map }
eland_container = gerald.eland(self.gerald_dir, genome_maps=genome_maps)
# I added sequence lanes to the last 2 lanes of this test case
keys = [SampleKey(lane=i, read=1, sample='s') for i in range(1,7)]
for key in keys:
lane = eland_container[key]
self.assertEqual(lane.reads, 28)
self.assertEqual(lane.sample_name, "s")
self.assertEqual(lane.lane_id, key.lane)
self.assertEqual(len(lane.mapped_reads), 7)
self.assertEqual(lane.mapped_reads['hg18/chr7.fa'], 4)
self.assertEqual(lane.mapped_reads['Lambda_1-1_11936nts.fa'], 1)
self.assertEqual(lane.match_codes['U0'], 1)
self.assertEqual(lane.match_codes['R0'], 20)
self.assertEqual(lane.match_codes['U1'], 1)
self.assertEqual(lane.match_codes['R1'], 2)
self.assertEqual(lane.match_codes['U2'], 11)
self.assertEqual(lane.match_codes['R2'], 0)
self.assertEqual(lane.match_codes['NM'], 2)
self.assertEqual(lane.match_codes['QC'], 9)
# test scarf
lane = eland_container[SampleKey(lane=7, read=1, sample='s')]
self.assertEqual(lane.reads, 5)
self.assertEqual(lane.sample_name, 's')
self.assertEqual(lane.lane_id, 7)
self.assertEqual(lane.sequence_type, eland.SequenceLane.SCARF_TYPE)
# test fastq
lane = eland_container[SampleKey(lane=8, read=1, sample='s')]
self.assertEqual(lane.reads, 3)
self.assertEqual(lane.sample_name, 's')
self.assertEqual(lane.lane_id, 8)
self.assertEqual(lane.sequence_type, eland.SequenceLane.FASTQ_TYPE)
xml = eland_container.get_elements()
# just make sure that element tree can serialize the tree
xml_str = ElementTree.tostring(xml)
e2 = gerald.ELAND(xml=xml)
for key in eland_container:
l1 = eland_container[key]
l2 = e2.results[key]
self.assertEqual(l1.reads, l2.reads)
self.assertEqual(l1.sample_name, l2.sample_name)
self.assertEqual(l1.lane_id, l2.lane_id)
if isinstance(l1, eland.ElandLane):
self.assertEqual(len(l1.mapped_reads), len(l2.mapped_reads))
self.assertEqual(len(l1.mapped_reads), 7)
for k in l1.mapped_reads.keys():
self.assertEqual(l1.mapped_reads[k],
l2.mapped_reads[k])
self.assertEqual(len(l1.match_codes), 9)
self.assertEqual(len(l1.match_codes), len(l2.match_codes))
for k in l1.match_codes.keys():
self.assertEqual(l1.match_codes[k],
l2.match_codes[k])
elif isinstance(l1, eland.SequenceLane):
self.assertEqual(l1.sequence_type, l2.sequence_type)