self.failUnlessEqual(lane_dict['lane_number'], lane.lane_number)
self.failUnlessEqual(lane_dict['library_name'], lane.library.library_name)
self.failUnlessEqual(lane_dict['library_id'], lane.library.id)
- self.failUnlessAlmostEqual(lane_dict['pM'], float(lane.pM))
+ self.failUnlessAlmostEqual(float(lane_dict['pM']), float(lane.pM))
self.failUnlessEqual(lane_dict['library_species'],
lane.library.library_species.scientific_name)
self.failUnlessEqual(lane_dict['lane_number'], lane.lane_number)
self.failUnlessEqual(lane_dict['library_name'], lane.library.library_name)
self.failUnlessEqual(lane_dict['library_id'], lane.library.id)
- self.failUnlessAlmostEqual(lane_dict['pM'], float(lane.pM))
+ self.failUnlessAlmostEqual(float(lane_dict['pM']), float(lane.pM))
self.failUnlessEqual(lane_dict['library_species'],
lane.library.library_species.scientific_name)
"experiment_type": 8,
"antibody": null
}
+ },
+ {
+ "pk": "11005",
+ "model": "samples.library",
+ "fields": {
+ "ten_nM_dilution": false,
+ "avg_lib_size": 325,
+ "library_name": "null cell line",
+ "creation_date": "2009-08-05",
+ "cell_line": null,
+ "library_species": 8,
+ "library_type": 2,
+ "made_by": "Lorian",
+ "affiliations": [
+ 41
+ ],
+ "replicate": 1,
+ "condition": 1,
+ "hidden": true,
+ "stopping_point": "1A",
+ "tags": [],
+ "made_for": "",
+ "amplified_from_sample": null,
+ "notes": "7/31/2009 16:08:22\tColor: Blue",
+ "undiluted_concentration": null,
+ "successful_pM": null,
+ "experiment_type": 8,
+ "antibody": null
+ }
}
]
library_json
from htsworkflow.frontend.auth import apidata
+from htsworkflow.util.conversion import unicode_or_none
# The django test runner flushes the database between test suites not cases,
# so to be more compatible with running via nose we flush the database tables
#self.failUnlessEqual(d['amplified_from_sample'], lib.amplified_from_sample)
self.failUnlessEqual(d['antibody_id'], lib.antibody_id)
self.failUnlessEqual(d['avg_lib_size'], lib.avg_lib_size)
- self.failUnlessEqual(d['cell_line'], lib.cell_line.cellline_name)
self.failUnlessEqual(d['cell_line_id'], lib.cell_line_id)
+ self.failUnlessEqual(d['cell_line'], unicode_or_none(lib.cell_line))
self.failUnlessEqual(d['experiment_type'], lib.experiment_type.name)
self.failUnlessEqual(d['experiment_type_id'], lib.experiment_type_id)
self.failUnlessEqual(d['id'], lib.id)
from htsworkflow.pipelines import runfolder
from htsworkflow.pipelines.eland import ResultLane
from htsworkflow.frontend import settings
+from htsworkflow.util.conversion import unicode_or_none
from htsworkflow.util import makebed
from htsworkflow.util import opener
+
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponse, HttpResponseRedirect, Http404
from django.shortcuts import render_to_response
#'antibody_name': lib.antibody_name(), # we have no antibodies.
'antibody_id': lib.antibody_id,
'avg_lib_size': lib.avg_lib_size,
- 'cell_line': lib.cell_line.cellline_name,
'cell_line_id': lib.cell_line_id,
+ 'cell_line': unicode_or_none(lib.cell_line),
'experiment_type': lib.experiment_type.name,
'experiment_type_id': lib.experiment_type_id,
'id': lib.id,
'notes': lib.notes,
'replicate': lib.replicate,
'stopping_point': lib.stopping_point,
- 'successful_pM': unicode(lib.successful_pM),
- 'undiluted_concentration': unicode(lib.undiluted_concentration)
+ 'successful_pM': unicode_or_none(lib.successful_pM),
+ 'undiluted_concentration': unicode_or_none(lib.undiluted_concentration)
}
if lib.library_type_id is None:
info['library_type'] = None
--- /dev/null
+"""
+Miscellaneous, more refined type casting functions
+"""
+
+def unicode_or_none(value):
+ """
+ Convert value to unicode if its not none.
+ """
+ if value is None:
+ return None
+ else:
+ return unicode(value)