convert all the string handling to unicode.
to make the RDF stuff work I needed to mark those strings
as byte arrays
47 files changed:
+from __future__ import unicode_literals
+
from django.contrib import admin
from .models import KeywordMap, Printer
from django.contrib import admin
from .models import KeywordMap, Printer
+from __future__ import unicode_literals
+
from django import forms
class BarcodeMagicForm(forms.Form):
from django import forms
class BarcodeMagicForm(forms.Form):
+from __future__ import unicode_literals
+
from django.db import models
#FIXME: Should be made more generic and probably pre-populated supported list
from django.db import models
#FIXME: Should be made more generic and probably pre-populated supported list
label_height = models.FloatField(help_text='height in inches')
notes = models.TextField()
label_height = models.FloatField(help_text='height in inches')
notes = models.TextField()
- def __unicode__(self):
- return u'%s, %s, %s, %s, %sx%s' % (self.name, self.model, self.ip_address, self.label_shape, self.label_width, self.label_width)
\ No newline at end of file
+ def __str__(self):
+ return '%s, %s, %s, %s, %sx%s' % (self.name, self.model, self.ip_address, self.label_shape, self.label_width, self.label_width)
+from __future__ import unicode_literals
+
BCM_PLUGINS = {
#'cmd_move_sample': bcm_cmds.cmd_move_sample
}
BCM_PLUGINS = {
#'cmd_move_sample': bcm_cmds.cmd_move_sample
}
+from __future__ import unicode_literals
+
from django.conf.urls import patterns
urlpatterns = patterns('',
from django.conf.urls import patterns
urlpatterns = patterns('',
+from __future__ import unicode_literals
+
from django.conf import settings
import ftplib
from django.conf import settings
import ftplib
+from __future__ import unicode_literals
+
from django.http import HttpResponse
from django.template import RequestContext, Template, Context
from django.shortcuts import render_to_response
from django.http import HttpResponse
from django.template import RequestContext, Template, Context
from django.shortcuts import render_to_response
+from __future__ import unicode_literals
+
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
+from __future__ import unicode_literals
+
from django import forms
from django.forms.util import ErrorList
from django import forms
from django.forms.util import ErrorList
+from __future__ import unicode_literals
+
from django.db import models
# Create your models here.
from django.db import models
# Create your models here.
+from __future__ import unicode_literals
+
from django.conf.urls import patterns, url
urlpatterns = patterns('',
from django.conf.urls import patterns, url
urlpatterns = patterns('',
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
from django.conf import settings
from django.http import HttpResponse
from django.conf import settings
from django.http import HttpResponse
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
from itertools import chain
from itertools import chain
def render_option(self, selected_choices, option_value, option_label):
def render_option(self, selected_choices, option_value, option_label):
- disabled_sequencers = [ unicode(s.id) for s in self.queryset.filter(active=False) ]
- option_value = unicode(option_value)
+ disabled_sequencers = [ str(s.id) for s in self.queryset.filter(active=False) ]
+ option_value = str(option_value)
selected_html = (option_value in selected_choices) and u' selected="selected"' or ''
cssclass = "strikeout" if option_value in disabled_sequencers else ''
return u'<option class="%s" value="%s"%s>%s</option>' % (
selected_html = (option_value in selected_choices) and u' selected="selected"' or ''
cssclass = "strikeout" if option_value in disabled_sequencers else ''
return u'<option class="%s" value="%s"%s>%s</option>' % (
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
# some core functions of the exp tracker module
from datetime import datetime, timedelta
# some core functions of the exp tracker module
from datetime import datetime, timedelta
'library_name': lane.library.library_name,
'library_id': lane.library.id,
'library_species': lane.library.library_species.scientific_name,
'library_name': lane.library.library_name,
'library_id': lane.library.id,
'library_species': lane.library.library_species.scientific_name,
- 'pM': unicode(lane.pM),
'read_length': lane.flowcell.read_length,
'status_code': lane.status,
'status': LANE_STATUS_MAP[lane.status]
'read_length': lane.flowcell.read_length,
'status_code': lane.status,
'status': LANE_STATUS_MAP[lane.status]
+from __future__ import unicode_literals
+
import datetime
import factory
import datetime
import factory
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
import datetime
import glob
import datetime
import glob
class Meta:
ordering = ["-isdefault", "name"]
class Meta:
ordering = ["-isdefault", "name"]
- def __unicode__(self):
- return unicode(self.name)
+ def __str__(self):
+ return str(self.name)
@staticmethod
def update_isdefault(sender, instance, **kwargs):
@staticmethod
def update_isdefault(sender, instance, **kwargs):
class Meta:
ordering = ["-isdefault", "-active", "name"]
class Meta:
ordering = ["-isdefault", "-active", "name"]
- def __unicode__(self):
- name = [unicode(self.name)]
+ def __str__(self):
+ name = [str(self.name)]
if self.instrument_name is not None:
if self.instrument_name is not None:
- name.append("(%s)" % (unicode(self.instrument_name),))
+ name.append("(%s)" % (str(self.instrument_name),))
return " ".join(name)
@models.permalink
return " ".join(name)
@models.permalink
notes = models.TextField(blank=True)
notes = models.TextField(blank=True)
- def __unicode__(self):
- return unicode(self.flowcell_id)
+ def __str__(self):
+ return str(self.flowcell_id)
def Lanes(self):
html = ['<table>']
def Lanes(self):
html = ['<table>']
"""Convert our boolean 'is paired' flag to a name
"""
if self.paired_end:
"""Convert our boolean 'is paired' flag to a name
"""
if self.paired_end:
@models.permalink
def get_absolute_url(self):
@models.permalink
def get_absolute_url(self):
return ('experiments.views.flowcell_lane_detail',
[str(self.id)])
return ('experiments.views.flowcell_lane_detail',
[str(self.id)])
- def __unicode__(self):
- return self.flowcell.flowcell_id + ':' + unicode(self.lane_number)
+ def __str__(self):
+ return self.flowcell.flowcell_id + ':' + str(self.lane_number)
class DataRun(models.Model):
class DataRun(models.Model):
return self.name.replace(' ', '_').lower()
normalized_name = property(_get_normalized_name)
return self.name.replace(' ', '_').lower()
normalized_name = property(_get_normalized_name)
- def __unicode__(self):
- #return u"<FileType: %s>" % (self.name,)
+ def __str__(self):
+ #return "<FileType: %s>" % (self.name,)
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
from django.test import TestCase
from ..models import ClusterStation, cluster_station_default
from django.test import TestCase
from ..models import ClusterStation, cluster_station_default
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
from django.test import TestCase
from django.test import TestCase
file_type_objects = FileType.objects
name = 'QSEQ tarfile'
file_type_object = file_type_objects.get(name=name)
file_type_objects = FileType.objects
name = 'QSEQ tarfile'
file_type_object = file_type_objects.get(name=name)
- self.assertEqual(u"QSEQ tarfile",
- unicode(file_type_object))
+ self.assertEqual("QSEQ tarfile",
+ str(file_type_object))
def test_find_file_type(self):
file_type_objects = FileType.objects
def test_find_file_type(self):
file_type_objects = FileType.objects
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
from django.test import TestCase
from ..models import Sequencer, sequencer_default
from django.test import TestCase
from ..models import Sequencer, sequencer_default
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
import re
from lxml.html import fromstring
import re
from lxml.html import fromstring
+from __future__ import unicode_literals
+
from django.conf.urls import patterns
urlpatterns = patterns('',
from django.conf.urls import patterns
urlpatterns = patterns('',
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
# Create your views here.
from datetime import datetime
# Create your views here.
from datetime import datetime
This includes the version number, run date, bustard executable parameters, and
phasing estimates.
"""
This includes the version number, run date, bustard executable parameters, and
phasing estimates.
"""
-from __future__ import print_function
+from __future__ import print_function, unicode_literals
from copy import copy
from datetime import date
from copy import copy
from datetime import date
for b in base_order:
for value in self.base[b]:
crosstalk_value = ElementTree.SubElement(root, CrosstalkMatrix.ELEMENT)
for b in base_order:
for value in self.base[b]:
crosstalk_value = ElementTree.SubElement(root, CrosstalkMatrix.ELEMENT)
- crosstalk_value.text = unicode(value)
+ crosstalk_value.text = str(value)
crosstalk_value.tail = os.linesep
return root
crosstalk_value.tail = os.linesep
return root
opts, args = parser.parse_args(cmdline)
for bustard_dir in args:
opts, args = parser.parse_args(cmdline)
for bustard_dir in args:
- print(u'analyzing bustard directory: ' + unicode(bustard_dir))
+ print(u'analyzing bustard directory: ' + str(bustard_dir))
bustard_object = bustard(bustard_dir)
bustard_object.dump()
bustard_object = bustard(bustard_dir)
bustard_object.dump()
"""Provide access to information stored in the GERALD directory.
"""
"""Provide access to information stored in the GERALD directory.
"""
-from __future__ import print_function
+from __future__ import print_function, unicode_literals
import collections
from datetime import datetime, date
import collections
from datetime import datetime, date
return None
gerald = ElementTree.Element(root_tag,
return None
gerald = ElementTree.Element(root_tag,
- {'version': unicode(Gerald.XML_VERSION)})
+ {'version': str(Gerald.XML_VERSION)})
gerald.append(self.tree)
gerald.append(self.summary.get_elements())
if self.eland_results:
gerald.append(self.tree)
gerald.append(self.summary.get_elements())
if self.eland_results:
"""
Analyze the Summary.htm file produced by GERALD
"""
"""
Analyze the Summary.htm file produced by GERALD
"""
-from __future__ import print_function
+from __future__ import print_function, unicode_literals
def get_elements(self):
summary = etree.Element(Summary.SUMMARY,
def get_elements(self):
summary = etree.Element(Summary.SUMMARY,
- {'version': unicode(Summary.XML_VERSION)})
+ {'version': str(Summary.XML_VERSION)})
for end in self.lane_results:
for lane in end.values():
summary.append(lane.get_elements())
for end in self.lane_results:
for lane in end.values():
summary.append(lane.get_elements())
def get_elements(self):
lane_result = etree.Element(
LaneResultSummary.LANE_RESULT_SUMMARY,
def get_elements(self):
lane_result = etree.Element(
LaneResultSummary.LANE_RESULT_SUMMARY,
- {'lane': unicode(self.lane), 'end': unicode(self.end)})
+ {'lane': str(self.lane), 'end': str(self.end)})
for tag, variable_name in LaneResultSummary.TAGS.items():
value = getattr(self, variable_name)
if value is None:
for tag, variable_name in LaneResultSummary.TAGS.items():
value = getattr(self, variable_name)
if value is None:
)
else:
element = etree.SubElement(lane_result, tag)
)
else:
element = etree.SubElement(lane_result, tag)
- element.text = unicode(value)
+ element.text = str(value)
return lane_result
def set_elements(self, tree):
return lane_result
def set_elements(self, tree):
"""
Miscellaneous, more refined type casting functions
"""
"""
Miscellaneous, more refined type casting functions
"""
+from __future__ import unicode_literals
-def unicode_or_none(value):
- Convert value to unicode if its not none.
+ Convert value to unicode string if its not none.
"""
if value is None:
return None
else:
"""
if value is None:
return None
else:
def parse_flowcell_id(flowcell_id):
"""
def parse_flowcell_id(flowcell_id):
"""
ns = fixup_namespace(ns)
logger.debug("load_string_into_model parser={0}, len={1}".format(
parser_name, len(data)))
ns = fixup_namespace(ns)
logger.debug("load_string_into_model parser={0}, len={1}".format(
parser_name, len(data)))
- rdf_parser = RDF.Parser(name=parser_name)
+ rdf_parser = RDF.Parser(name=str(parser_name))
for s in rdf_parser.parse_string_as_stream(data, ns):
conditionally_add_statement(model, s, ns)
for s in rdf_parser.parse_string_as_stream(data, ns):
conditionally_add_statement(model, s, ns)
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
from django.contrib import admin
from django.contrib import admin
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
name = models.CharField(max_length=256)
url = models.URLField(blank=True, null=True)
name = models.CharField(max_length=256)
url = models.URLField(blank=True, null=True)
- def __unicode__(self):
- return u"%s" % (self.name)
+ def __str__(self):
+ return "%s" % (self.name)
class Location(models.Model):
class Location(models.Model):
notes = models.TextField(blank=True, null=True)
notes = models.TextField(blank=True, null=True)
if len(self.location_description) > 16:
if len(self.location_description) > 16:
- return u"%s: %s" % (self.name, self.location_description[0:16]+u"...")
+ return "%s: %s" % (self.name, self.location_description[0:16]+"...")
- return u"%s: %s" % (self.name, self.location_description)
+ return "%s: %s" % (self.name, self.location_description)
post_init.connect(_assign_uuid, sender=Location)
post_init.connect(_assign_uuid, sender=Location)
notes = models.TextField(blank=True, null=True)
notes = models.TextField(blank=True, null=True)
name = u''
if self.model_id:
name = u''
if self.model_id:
- name += u"model:%s " % (self.model_id)
+ name += "model:%s " % (self.model_id)
- name += u"part:%s " % (self.part_number)
+ name += "part:%s " % (self.part_number)
- name += u"lot:%s " % (self.lot_number)
+ name += "lot:%s " % (self.lot_number)
- return u"%s: %s" % (name, self.purchase_date)
+ return "%s: %s" % (name, self.purchase_date)
class Meta:
verbose_name_plural = "Item Info"
class Meta:
verbose_name_plural = "Item Info"
name = models.CharField(max_length=64, unique=True)
description = models.TextField(blank=True, null=True)
name = models.CharField(max_length=64, unique=True)
description = models.TextField(blank=True, null=True)
- def __unicode__(self):
- return u"%s" % (self.name)
+ def __str__(self):
+ return "%s" % (self.name)
class ItemStatus(models.Model):
name = models.CharField(max_length=64, unique=True)
notes = models.TextField(blank=True, null=True)
class ItemStatus(models.Model):
name = models.CharField(max_length=64, unique=True)
notes = models.TextField(blank=True, null=True)
return self.name
class Meta:
return self.name
class Meta:
notes = models.TextField(blank=True, null=True)
notes = models.TextField(blank=True, null=True)
if self.barcode_id is None or len(self.barcode_id) == 0:
if self.barcode_id is None or len(self.barcode_id) == 0:
- return u"invu|%s" % (self.uuid)
+ return "invu|%s" % (self.uuid)
- return u"invb|%s" % (self.barcode_id)
+ return "invb|%s" % (self.barcode_id)
def get_absolute_url(self):
return '/inventory/%s/' % (self.uuid)
def get_absolute_url(self):
return '/inventory/%s/' % (self.uuid)
template = models.TextField()
template = models.TextField()
if self.default:
return u'%s %s' % (self.item_type.name, self.printer.name)
else:
if self.default:
return u'%s %s' % (self.item_type.name, self.printer.name)
else:
creation_date = models.DateTimeField(auto_now_add=True)
modified_date = models.DateTimeField(auto_now=True)
creation_date = models.DateTimeField(auto_now_add=True)
modified_date = models.DateTimeField(auto_now=True)
- def __unicode__(self):
- return u"%s: %s" % (str(self.flowcell), ', '.join([str(s) for s in self.storage_devices.iterator()]))
+ def __str__(self):
+ return "%s: %s" % (str(self.flowcell), ', '.join([str(s) for s in self.storage_devices.iterator()]))
class Meta:
verbose_name_plural = "Long Term Storage"
class Meta:
verbose_name_plural = "Long Term Storage"
"""
flowcell = models.ForeignKey(FlowCell)
"""
flowcell = models.ForeignKey(FlowCell)
- def __unicode__(self):
- return u"%s: %s" % (str(self.flowcell), ', '.join([str(s) for s in self.reagent.iterator()]))
+ def __str__(self):
+ return "%s: %s" % (str(self.flowcell), ', '.join([str(s) for s in self.reagent.iterator()]))
class ReagentLibrary(ReagentBase):
class ReagentLibrary(ReagentBase):
"""
library = models.ForeignKey(Library)
"""
library = models.ForeignKey(Library)
- def __unicode__(self):
- return u"%s: %s" % (str(self.library), ', '.join([str(s) for s in self.reagent.iterator()]))
+ def __str__(self):
+ return "%s: %s" % (str(self.library), ', '.join([str(s) for s in self.reagent.iterator()]))
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
itemNode = RDF.Node(RDF.Uri(url))
item_type = fromTypedNode(
itemNode = RDF.Node(RDF.Uri(url))
item_type = fromTypedNode(
- model.get_target(itemNode, inventoryOntology['item_type']))
+ model.get_target(itemNode, inventoryOntology[b'item_type']))
self.failUnlessEqual(item_type, item.item_type.name)
def test_itemindex(self):
self.failUnlessEqual(item_type, item.item_type.name)
def test_itemindex(self):
+from __future__ import unicode_literals
+
from django.conf.urls import patterns
urlpatterns = patterns('',
from django.conf.urls import patterns
urlpatterns = patterns('',
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.conf import settings
from django.contrib.auth.decorators import login_required
+from __future__ import unicode_literals
+
from django.template import Context, Template
from django.contrib import admin
from django.template import Context, Template
from django.contrib import admin
+from __future__ import unicode_literals
+
from django.db import models
class LabelPrinter(models.Model):
from django.db import models
class LabelPrinter(models.Model):
labels = models.CharField(max_length=200)
notes = models.TextField(null=True, blank=True)
labels = models.CharField(max_length=200)
notes = models.TextField(null=True, blank=True)
- def __unicode__(self):
- return u'%s: %s' % (self.name, self.labels)
+ def __str__(self):
+ return '%s: %s' % (self.name, self.labels)
class LabelTemplate(models.Model):
"""
class LabelTemplate(models.Model):
"""
ZPL_code = models.TextField('template')
ZPL_code = models.TextField('template')
return '%s %s' % (self.name, self.printer.name)
class LabelContent(models.Model):
return '%s %s' % (self.name, self.printer.name)
class LabelContent(models.Model):
Replace these with more appropriate tests for your application.
"""
Replace these with more appropriate tests for your application.
"""
+from __future__ import unicode_literals
from django.test import TestCase
from django.test import TestCase
+from __future__ import unicode_literals
# Create your views here.
# Create your views here.
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
from django.contrib import admin
from django.contrib.admin import widgets
from django.contrib import admin
from django.contrib.admin import widgets
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
from django.conf import settings
from django.contrib.auth.backends import ModelBackend
from django.conf import settings
from django.contrib.auth.backends import ModelBackend
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
import django
from django.contrib.admin.views.main import ChangeList
import django
from django.contrib.admin.views.main import ChangeList
+from __future__ import unicode_literals
+
import types
import logging
from django.db import models
import types
import logging
from django.db import models
source = models.CharField(max_length=500, blank=True, null=True, db_index=True)
biology = models.TextField(blank=True, null=True)
notes = models.TextField(blank=True, null=True)
source = models.CharField(max_length=500, blank=True, null=True, db_index=True)
biology = models.TextField(blank=True, null=True)
notes = models.TextField(blank=True, null=True)
- def __unicode__(self):
- return u'%s - %s' % (self.antigene, self.antibodies)
+ def __str__(self):
+ return '%s - %s' % (self.antigene, self.antibodies)
class Meta:
verbose_name_plural = "antibodies"
ordering = ["antigene"]
class Meta:
verbose_name_plural = "antibodies"
ordering = ["antigene"]
db_index=True)
notes = models.TextField(blank=True)
db_index=True)
notes = models.TextField(blank=True)
- def __unicode__(self):
- return unicode(self.cellline_name)
+ def __str__(self):
+ return str(self.cellline_name)
class Meta:
ordering = ["cellline_name"]
class Meta:
ordering = ["cellline_name"]
verbose_name = 'Short Name')
notes = models.TextField(blank=True)
verbose_name = 'Short Name')
notes = models.TextField(blank=True)
- def __unicode__(self):
- return unicode(self.condition_name)
+ def __str__(self):
+ return str(self.condition_name)
class Meta:
ordering = ["condition_name"]
class Meta:
ordering = ["condition_name"]
class ExperimentType(models.Model):
name = models.CharField(max_length=50, unique=True)
class ExperimentType(models.Model):
name = models.CharField(max_length=50, unique=True)
- def __unicode__(self):
- return unicode(self.name)
+ def __str__(self):
+ return str(self.name)
class Tag(models.Model):
tag_name = models.CharField(max_length=100, db_index=True,blank=False,null=False)
class Tag(models.Model):
tag_name = models.CharField(max_length=100, db_index=True,blank=False,null=False)
context = models.CharField(max_length=50,
choices=TAG_CONTEXT, default='Library')
context = models.CharField(max_length=50,
choices=TAG_CONTEXT, default='Library')
- def __unicode__(self):
- return u'%s' % (self.tag_name)
+ def __str__(self):
+ return '%s' % (self.tag_name)
class Meta:
ordering = ["context","tag_name"]
class Meta:
ordering = ["context","tag_name"]
common_name = models.CharField(max_length=256, blank=True)
#use_genome_build = models.CharField(max_length=100, blank=False, null=False)
common_name = models.CharField(max_length=256, blank=True)
#use_genome_build = models.CharField(max_length=100, blank=False, null=False)
- def __unicode__(self):
- return u'%s (%s)' % (self.scientific_name, self.common_name)
+ def __str__(self):
+ return '%s (%s)' % (self.scientific_name, self.common_name)
class Meta:
verbose_name_plural = "species"
class Meta:
verbose_name_plural = "species"
users = models.ManyToManyField('HTSUser', null=True, blank=True)
users.admin_order_field = "username"
users = models.ManyToManyField('HTSUser', null=True, blank=True)
users.admin_order_field = "username"
- def __unicode__(self):
- str = unicode(self.name)
+ def __str__(self):
+ name = str(self.name)
if self.contact is not None and len(self.contact) > 0:
if self.contact is not None and len(self.contact) > 0:
- str += u' ('+self.contact+u')'
- return str
+ name += ' ('+self.contact+')'
+ return name
def Users(self):
users = self.users.all().order_by('username')
def Users(self):
users = self.users.all().order_by('username')
- return ", ".join([unicode(a) for a in users ])
+ return ", ".join([str(a) for a in users ])
class Meta:
ordering = ["name","contact"]
class Meta:
ordering = ["name","contact"]
can_multiplex = models.BooleanField(default=True,
help_text="Does this adapter provide multiplexing?")
can_multiplex = models.BooleanField(default=True,
help_text="Does this adapter provide multiplexing?")
- def __unicode__(self):
- return unicode(self.name)
+ def __str__(self):
+ return str(self.name)
class Meta:
ordering = ["-id"]
class Meta:
ordering = ["-id"]
undiluted_concentration = models.DecimalField("Concentration",
max_digits=5, decimal_places=2, blank=True, null=True,
undiluted_concentration = models.DecimalField("Concentration",
max_digits=5, decimal_places=2, blank=True, null=True,
- help_text=u"Undiluted concentration (ng/\u00b5l)")
+ help_text = "Undiluted concentration (ng/\u00b5l)")
# note \u00b5 is the micro symbol in unicode
successful_pM = models.DecimalField(max_digits=9,
decimal_places=1, blank=True, null=True)
# note \u00b5 is the micro symbol in unicode
successful_pM = models.DecimalField(max_digits=9,
decimal_places=1, blank=True, null=True)
bioanalyzer_summary = models.TextField(blank=True,default="")
bioanalyzer_concentration = models.DecimalField(max_digits=5,
decimal_places=2, blank=True, null=True,
bioanalyzer_summary = models.TextField(blank=True,default="")
bioanalyzer_concentration = models.DecimalField(max_digits=5,
decimal_places=2, blank=True, null=True,
- help_text=u"(ng/\u00b5l)")
+ help_text="(ng/\u00b5l)")
bioanalyzer_image_url = models.URLField(blank=True,default="")
bioanalyzer_image_url = models.URLField(blank=True,default="")
- def __unicode__(self):
- return u'#%s: %s' % (self.id, self.library_name)
+ def __str__(self):
+ return '#%s: %s' % (self.id, self.library_name)
class Meta:
verbose_name_plural = "libraries"
class Meta:
verbose_name_plural = "libraries"
tstr = ''
ar = []
for t in affs:
tstr = ''
ar = []
for t in affs:
- ar.append(t.__unicode__())
return '%s' % (", ".join(ar))
def is_archived(self):
return '%s' % (", ".join(ar))
def is_archived(self):
affs = self.tags.all().order_by('tag_name')
ar = []
for t in affs:
affs = self.tags.all().order_by('tag_name')
ar = []
for t in affs:
- ar.append(t.__unicode__())
- return u'%s' % ( ", ".join(ar))
+ ar.append(t.__str__())
+ return '%s' % ( ", ".join(ar))
def DataRun(self):
str ='<a target=_self href="/admin/experiments/datarun/?q='+self.id+'" title="Check All Data Runs for This Specific Library ..." ">Data Run</a>'
def DataRun(self):
str ='<a target=_self href="/admin/experiments/datarun/?q='+self.id+'" title="Check All Data Runs for This Specific Library ..." ">Data Run</a>'
# Check data sanity
if res[2] != "OK":
# Check data sanity
if res[2] != "OK":
- return u'<div style="border:solid red 2px">'+res[2]+'</div>'
+ return '<div style="border:solid red 2px">'+res[2]+'</div>'
rc = "%1.2f" % (res[1]/1000000.0)
# Color Scheme: green is more than 10M, blue is more than 5M, orange is more than 3M and red is less. For RNAseq, all those thresholds should be doubled
rc = "%1.2f" % (res[1]/1000000.0)
# Color Scheme: green is more than 10M, blue is more than 5M, orange is more than 3M and red is less. For RNAseq, all those thresholds should be doubled
if res[1] > rc_thr[2]:
bgcolor ='#ffcc33' # Orange
tstr = '<div style="background-color:'+bgcolor+';color:black">'
if res[1] > rc_thr[2]:
bgcolor ='#ffcc33' # Orange
tstr = '<div style="background-color:'+bgcolor+';color:black">'
- tstr += res[0].__unicode__()+' Lanes, '+rc+' M Reads'
+ tstr += res[0].__str__()+' Lanes, '+rc+' M Reads'
tstr += '</div>'
else: tstr = 'not processed yet'
return tstr
tstr += '</div>'
else: tstr = 'not processed yet'
return tstr
def admin_url(self):
return '/admin/%s/%s/%d' % (self._meta.app_label, self._meta.module_name, self.id)
def admin_url(self):
return '/admin/%s/%s/%d' % (self._meta.app_label, self._meta.module_name, self.id)
- def __unicode__(self):
- #return unicode(self.username) + u" (" + unicode(self.get_full_name()) + u")"
- return unicode(self.get_full_name()) + u' (' + unicode(self.username) + ')'
+ def __str__(self):
+ #return str(self.username) + " (" + str(self.get_full_name()) + u")"
+ return str(self.get_full_name()) + ' (' + str(self.username) + ')'
def HTSUserInsertID(sender, instance, **kwargs):
"""
def HTSUserInsertID(sender, instance, **kwargs):
"""
+from __future__ import unicode_literals
+
from django.conf import settings
import glob
from django.conf import settings
import glob
+from __future__ import unicode_literals
+
import datetime
import factory
import datetime
import factory
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
import datetime
import unittest
import datetime
import unittest
from .samples_factory import *
from htsworkflow.auth import apidata
from .samples_factory import *
from htsworkflow.auth import apidata
-from htsworkflow.util.conversion import unicode_or_none
+from htsworkflow.util.conversion import str_or_none
from htsworkflow.util.ethelp import validate_xhtml
class LibraryTestCase(TestCase):
from htsworkflow.util.ethelp import validate_xhtml
class LibraryTestCase(TestCase):
lib_dict = library_dict(library.id)
url = '/samples/library/%s/json' % (library.id,)
lib_response = self.client.get(url, apidata)
lib_dict = library_dict(library.id)
url = '/samples/library/%s/json' % (library.id,)
lib_response = self.client.get(url, apidata)
- lib_json = json.loads(lib_response.content)['result']
+ lib_json = json.loads(str(lib_response.content))['result']
for d in [lib_dict, lib_json]:
# amplified_from_sample is a link to the library table,
for d in [lib_dict, lib_json]:
# amplified_from_sample is a link to the library table,
#self.failUnlessEqual(d['amplified_from_sample'], lib.amplified_from_sample)
self.failUnlessEqual(d['antibody_id'], library.antibody_id)
self.failUnlessEqual(d['cell_line_id'], library.cell_line_id)
#self.failUnlessEqual(d['amplified_from_sample'], lib.amplified_from_sample)
self.failUnlessEqual(d['antibody_id'], library.antibody_id)
self.failUnlessEqual(d['cell_line_id'], library.cell_line_id)
- self.failUnlessEqual(d['cell_line'], unicode_or_none(library.cell_line))
+ self.failUnlessEqual(d['cell_line'], str_or_none(library.cell_line))
self.failUnlessEqual(d['experiment_type'], library.experiment_type.name)
self.failUnlessEqual(d['experiment_type_id'], library.experiment_type_id)
self.failUnlessEqual(d['gel_cut_size'], library.gel_cut_size)
self.failUnlessEqual(d['experiment_type'], library.experiment_type.name)
self.failUnlessEqual(d['experiment_type_id'], library.experiment_type_id)
self.failUnlessEqual(d['gel_cut_size'], library.gel_cut_size)
self.failUnlessEqual(d['stopping_point'], library.stopping_point)
self.failUnlessEqual(d['successful_pM'], library.successful_pM)
self.failUnlessEqual(d['undiluted_concentration'],
self.failUnlessEqual(d['stopping_point'], library.stopping_point)
self.failUnlessEqual(d['successful_pM'], library.successful_pM)
self.failUnlessEqual(d['undiluted_concentration'],
- unicode(library.undiluted_concentration))
+ str(library.undiluted_concentration))
import RDF
HAVE_RDF = True
import RDF
HAVE_RDF = True
- rdfNS = RDF.NS("http://www.w3.org/1999/02/22-rdf-syntax-ns#")
- xsdNS = RDF.NS("http://www.w3.org/2001/XMLSchema#")
- libNS = RDF.NS("http://jumpgate.caltech.edu/wiki/LibraryOntology#")
+ rdfNS = RDF.NS(b"http://www.w3.org/1999/02/22-rdf-syntax-ns#")
+ xsdNS = RDF.NS(b"http://www.w3.org/2001/XMLSchema#")
+ libNS = RDF.NS(b"http://jumpgate.caltech.edu/wiki/LibraryOntology#")
from htsworkflow.util.rdfhelp import dump_model
except ImportError as e:
from htsworkflow.util.rdfhelp import dump_model
except ImportError as e:
def test_parse_rdfa(self):
model = get_rdf_memory_model()
def test_parse_rdfa(self):
model = get_rdf_memory_model()
- parser = RDF.Parser(name='rdfa')
+ parser = RDF.Parser(name=b'rdfa')
bob = AffiliationFactory.create(name='Bob')
bob = AffiliationFactory.create(name='Bob')
#with open('/tmp/test.ttl', 'w') as outstream:
# dump_model(model, outstream)
# http://jumpgate.caltech.edu/wiki/LibraryOntology#affiliation>
#with open('/tmp/test.ttl', 'w') as outstream:
# dump_model(model, outstream)
# http://jumpgate.caltech.edu/wiki/LibraryOntology#affiliation>
- self.check_literal_object(model, ['Bob'], p=libNS['affiliation'])
+ self.check_literal_object(model, ['Bob'], p=libNS[b'affiliation'])
self.check_literal_object(model,
['experiment type name'],
self.check_literal_object(model,
['experiment type name'],
- p=libNS['experiment_type'])
- self.check_literal_object(model, ['400'], p=libNS['gel_cut'])
+ p=libNS[b'experiment_type'])
+ self.check_literal_object(model, ['400'], p=libNS[b'gel_cut'])
self.check_literal_object(model,
['microfluidics bot 7321'],
self.check_literal_object(model,
['microfluidics bot 7321'],
self.check_literal_object(model,
[lib_object.library_name],
self.check_literal_object(model,
[lib_object.library_name],
self.check_literal_object(model,
[lib_object.library_species.scientific_name],
self.check_literal_object(model,
[lib_object.library_species.scientific_name],
- p=libNS['species_name'])
+ p=libNS[b'species_name'])
def check_literal_object(self, model, values, s=None, p=None, o=None):
def check_literal_object(self, model, values, s=None, p=None, o=None):
self.failUnlessEqual(len(statements), len(values),
"Couln't find %s %s %s" % (s,p,o))
for s in statements:
self.failUnlessEqual(len(statements), len(values),
"Couln't find %s %s %s" % (s,p,o))
for s in statements:
- self.failUnless(unicode(s.object.uri) in values)
+ self.failUnless(str(s.object.uri) in values)
+from __future__ import unicode_literals
+
from django.conf.urls import patterns, url
urlpatterns = patterns('samples.views',
from django.conf.urls import patterns, url
urlpatterns = patterns('samples.views',
-from __future__ import absolute_import, print_function
+from __future__ import absolute_import, print_function, unicode_literals
# Create your views here.
import logging
# Create your views here.
import logging
from htsworkflow.pipelines import runfolder
from htsworkflow.pipelines.eland import ResultLane
from htsworkflow.pipelines.samplekey import SampleKey
from htsworkflow.pipelines import runfolder
from htsworkflow.pipelines.eland import ResultLane
from htsworkflow.pipelines.samplekey import SampleKey
-from htsworkflow.util.conversion import unicode_or_none, parse_flowcell_id
+from htsworkflow.util.conversion import str_or_none, parse_flowcell_id
from htsworkflow.util import makebed
from htsworkflow.util import opener
from htsworkflow.util import makebed
from htsworkflow.util import opener
summary['lanes_run'] = lanes_run
summary['is_archived'] = lib.is_archived()
records.append(summary)
summary['lanes_run'] = lanes_run
summary['is_archived'] = lib.is_archived()
records.append(summary)
- cl.result_count = unicode(cl.paginator._count)
+ cl.result_count = str(cl.paginator._count)
return {'library_list': records}
return {'library_list': records}
#'antibody_name': lib.antibody_name(), # we have no antibodies.
'antibody_id': lib.antibody_id,
'cell_line_id': lib.cell_line_id,
#'antibody_name': lib.antibody_name(), # we have no antibodies.
'antibody_id': lib.antibody_id,
'cell_line_id': lib.cell_line_id,
- 'cell_line': unicode_or_none(lib.cell_line),
+ 'cell_line': str_or_none(lib.cell_line),
'experiment_type': lib.experiment_type.name,
'experiment_type_id': lib.experiment_type_id,
'gel_cut_size': lib.gel_cut_size,
'experiment_type': lib.experiment_type.name,
'experiment_type_id': lib.experiment_type_id,
'gel_cut_size': lib.gel_cut_size,
'notes': lib.notes,
'replicate': lib.replicate,
'stopping_point': lib.stopping_point,
'notes': lib.notes,
'replicate': lib.replicate,
'stopping_point': lib.stopping_point,
- 'successful_pM': unicode_or_none(lib.successful_pM),
- 'undiluted_concentration': unicode_or_none(lib.undiluted_concentration)
+ 'successful_pM': str_or_none(lib.successful_pM),
+ 'undiluted_concentration': str_or_none(lib.undiluted_concentration)
}
if lib.library_type_id is None:
info['library_type'] = None
}
if lib.library_type_id is None:
info['library_type'] = None