Merge branch 'master' of mus.cacr.caltech.edu:htsworkflow
authorDiane Trout <diane@caltech.edu>
Thu, 17 Feb 2011 08:39:54 +0000 (00:39 -0800)
committerDiane Trout <diane@caltech.edu>
Thu, 17 Feb 2011 08:39:54 +0000 (00:39 -0800)
15 files changed:
extra/ucsc_encode_submission/encode_find.py [new file with mode: 0644]
htsworkflow/frontend/samples/models.py
htsworkflow/frontend/samples/views.py
htsworkflow/frontend/settings.py
htsworkflow/frontend/templates/admin/pagination.html [new file with mode: 0644]
htsworkflow/frontend/templates/app_base.html [deleted file]
htsworkflow/frontend/templates/base.html
htsworkflow/frontend/templates/flowcell_libraries_app.html [deleted file]
htsworkflow/frontend/templates/inventory/inventory_app.html [deleted file]
htsworkflow/frontend/templates/registration/login.html
htsworkflow/frontend/templates/registration/profile.html
htsworkflow/frontend/templates/samples/lanes_for.html
htsworkflow/frontend/templates/samples/library_detail.html
htsworkflow/frontend/templates/samples/library_index.html
htsworkflow/pipelines/test/test_qseq2fastq.py [new file with mode: 0644]

diff --git a/extra/ucsc_encode_submission/encode_find.py b/extra/ucsc_encode_submission/encode_find.py
new file mode 100644 (file)
index 0000000..7c614dc
--- /dev/null
@@ -0,0 +1,275 @@
+#!/usr/bin/env python
+
+from BeautifulSoup import BeautifulSoup
+from datetime import datetime
+import httplib2
+from operator import attrgetter
+from optparse import OptionParser
+# python keyring
+import keyring
+import logging
+import os
+import re
+# redland rdf lib
+import RDF 
+import sys
+import urllib
+
+libraryNS = RDF.NS("http://jumpgate.caltech.edu/library/")
+submissionNS = RDF.NS("http://encodesubmit.ucsc.edu/pipeline/show/")
+submitNS = RDF.NS("http://jumpgate.caltech.edu/wiki/EncodeSubmit#")
+dublinCoreNS = RDF.NS("http://purl.org/dc/elements/1.1/")
+rdfNS = RDF.NS("http://www.w3.org/1999/02/22-rdf-syntax-ns#")
+rdfsNS= RDF.NS("http://www.w3.org/2000/01/rdf-schema#")
+
+LOGIN_URL = 'http://encodesubmit.ucsc.edu/account/login'
+USER_URL = 'http://encodesubmit.ucsc.edu/pipeline/show_user'
+DETAIL_URL = 'http://encodesubmit.ucsc.edu/pipeline/show/{0}'
+LIBRARY_URL = 'http://jumpgate.caltech.edu/library/{0}'
+USERNAME = 'detrout'
+
+def main(cmdline=None):
+    parser = make_parser()
+    opts, args = parser.parse_args(cmdline)
+
+    cookie = login()
+    if cookie is None:
+        print "Failed to login"
+
+    submissions = my_submissions(cookie)
+    for s in submissions:
+        for t in s.triples():
+            print t
+            
+def make_parser():
+    parser = OptionParser()
+    return parser
+
+
+def login():
+    keys = keyring.get_keyring()
+    password = keys.get_password(LOGIN_URL, USERNAME)
+    credentials = {'login': USERNAME,
+                   'password': password}
+    headers = {'Content-type': 'application/x-www-form-urlencoded'}
+    http = httplib2.Http()
+    response, content = http.request(LOGIN_URL,
+                                     'POST',
+                                     headers=headers,
+                                     body=urllib.urlencode(credentials))
+    logging.debug("Login to {0}, status {1}".format(LOGIN_URL,
+                                                    response['status']))
+    
+    cookie = response.get('set-cookie', None)
+    return cookie
+
+def my_submissions(cookie):
+    soup = get_url_as_soup(USER_URL, 'GET', cookie)
+    p = soup.find('table', attrs={'id':'projects'})
+    tr = p.findNext('tr')
+    # first record is header
+    tr = tr.findNext()
+    submissions = []
+    while tr is not None:
+        td = tr.findAll('td')
+        if td is not None and len(td) > 1:
+            subid = td[0].contents[0].contents[0]
+            species = get_contents(td[2])
+            name = get_contents(td[4])
+            status = get_contents(td[6]).strip()
+            date = get_date_contents(td[8])
+            age = get_contents(td[10])
+            submissions.append(
+                Submission(subid, species, name, status, date, age, cookie)
+            )
+        tr = tr.findNext('tr')
+    return submissions
+
+def get_contents(element):
+    """Return contents or none.
+    """
+    if len(element.contents) == 0:
+        return None
+
+    a = element.find('a')
+    if a is not None:
+        return a.contents[0]
+
+    return element.contents[0]
+
+def get_date_contents(element):
+    data = get_contents(element)
+    if data:
+        return datetime.strptime(data, "%Y-%m-%d %H:%M")
+    else:
+        return None
+
+SUBMISSIONS_LACKING_LIBID = [
+    ('1x75-Directional-HeLa-Rep1',    '11208'),
+    ('1x75-Directional-HeLa-Rep2',    '11207'),
+    ('1x75-Directional-HepG2-Rep1',   '11210'),
+    ('1x75-Directional-HepG2-Rep2',   '11209'),
+    ('1x75-Directional-H1-hESC-Rep1', '10947'),
+    ('1x75-Directional-H1-hESC-Rep2', '11009'),
+    ('1x75-Directional-HUVEC-Rep1',   '11206'),
+    ('1x75-Directional-HUVEC-Rep2',   '11205'),
+    ('1x75-Directional-K562-Rep1',    '11008'),
+    ('1x75-Directional-K562-Rep2',    '11007'),
+    ('1x75-Directional-NHEK-Rep1',    '11204'),
+    ]
+
+class Submission(object):
+    def __init__(self, subid, species, name, status, date, age, cookie=None):
+        self.cookie = cookie
+        self.subid = subid
+        self.species = species
+        self.name = name
+        self.status = status
+        self.date = date
+        self.age = age
+        self._library_id = None
+        self._created_date = None
+
+    def triples(self):
+        subNode = submissionNS[self.subid.encode('utf-8')]
+        dateNode = self.date.strftime("%Y-%m-%d")
+        s = [RDF.Statement(subNode, submitNS['name'],
+                           self.name.encode('utf-8')),
+             RDF.Statement(subNode, submitNS['status'],
+                           self.status.encode('utf-8')),
+             RDF.Statement(subNode, submitNS['last_modify_date'], dateNode),
+             ]
+        if self.species is not None:
+            s.append(RDF.Statement(subNode, submitNS['species'],
+                                   self.species.encode('utf-8')))
+        if self.library_id is not None:
+             libId = libraryNS[self.library_id.encode('utf-8')]
+             s.append(RDF.Statement(subNode, rdfsNS['seeAlso'], libId))
+        
+        return s
+        
+
+    def _get_library_id(self):
+        if self._library_id is None:
+            match = re.search(r"[ -](?P<id>([\d]{5})|(SL[\d]{4}))", self.name)
+            if match is not None:
+                self._library_id = match.group('id')
+            else:
+                for dir_lib_name, lib_id in SUBMISSIONS_LACKING_LIBID:
+                    if dir_lib_name in self.name:
+                        self._library_id = lib_id
+                        break
+            
+        return self._library_id
+    
+    library_id = property(_get_library_id)
+
+    def _get_detail(self):
+        detail = DETAIL_URL.format(self.subid)
+        soup = get_url_as_soup(detail, 'GET', self.cookie)
+
+        created_label = soup.find(text="Created: ")
+        if created_label:
+            self._created_date = get_date_contents(created_label.next)
+            
+    def _get_created_date(self):
+        if self._created_date is None:
+            self._get_detail()
+        return self._created_date
+    created_date = property(_get_created_date)
+    
+    def __unicode__(self):
+        return u"{0}\t{1}\t{2}".format(self.subid, self.library_id, self.name)
+
+    def __repr__(self):
+        return u"<Submission ({0}) '{1}'>".format(self.subid, self.name)
+
+
+def select_by_library_id(submission_list):
+    subl = [ (x.library_id, x) for x in submission_list if x.library_id ]
+    libraries = {}
+    for lib_id, subobj in subl:
+        libraries.setdefault(lib_id, []).append(subobj)
+
+    for submission in libraries.values():
+        submission.sort(key=attrgetter('date'), reverse=True)
+        
+    return libraries
+
+def library_to_freeze(selected_libraries):
+    freezes = ['2010-Jan', '2010-Jul', '2011-Jan']
+    lib_ids = sorted(selected_libraries.keys())
+    report = ['<html><table border="1">']
+    report = ["""<html>
+<head>
+<style type="text/css">
+ td {border-width:0 0 1px 1px; border-style:solid;}
+</style>
+</head>
+<body>
+<table>
+"""]
+    report.append('<thead>')
+    report.append('<tr><td>Library ID</td><td>Name</td>')
+    for f in freezes:
+        report.append('<td>{0}</td>'.format(f))
+    report.append('</tr>')
+    report.append('</thead>')
+    report.append('<tbody>')
+    for lib_id in lib_ids:
+        report.append('<tr>')
+        lib_url = LIBRARY_URL.format(lib_id)
+        report.append('<td><a href="{0}">{1}</a></td>'.format(lib_url, lib_id))
+        submissions = selected_libraries[lib_id]
+        report.append('<td>{0}</td>'.format(submissions[0].name))
+        batched = {}
+        for sub in submissions:
+            date = date_to_freeze(sub.date)
+            batched.setdefault(date, []).append(sub)
+        print lib_id, batched
+        for d in freezes:
+            report.append('<td>')
+            for s in batched.get(d, []):
+                subid = '<a href="http://encodesubmit.ucsc.edu/pipeline/show/{0}">{0}</a>'.format(s.subid)
+                report.append("{0}:{1}".format(subid, s.status))
+            report.append('</td>')
+        else:
+            report.append('<td></td>')
+        report.append("</tr>")
+    report.append('</tbody>')
+    report.append("</table></html>")
+    return "\n".join(report)
+
+            
+def date_to_freeze(d):
+    freezes = [ (datetime(2010, 1, 30), '2010-Jan'),
+                (datetime(2010, 7, 30), '2010-Jul'),
+                (datetime(2011, 1, 30), '2011-Jan'),
+                ]
+    for end, name in freezes:
+        if d < end:
+            return name
+    else:
+        return None
+    
+                
+def get_url_as_soup(url, method, cookie=None):
+    http = httplib2.Http()
+    headers = {}
+    if cookie is not None:
+        headers['Cookie'] = cookie
+    response, content = http.request(url, method, headers=headers)
+    if response['status'] == '200':
+        soup = BeautifulSoup(content,
+                             fromEncoding="utf-8", # should read from header
+                             convertEntities=BeautifulSoup.HTML_ENTITIES
+                             )
+        return soup
+    else:
+        msg = "error accessing {0}, status {1}"
+        msg = msg.format(url, response['status'])
+        e = httplib2.HttpLib2ErrorWithResponse(msg, response, content)
+
+if __name__ == "__main__":
+    main()
+    
index 59b4c244d8b77805207a3562de316172463113fc..8314c71f5e685f2cd44d28805959ddafeb3e5adf 100644 (file)
@@ -1,3 +1,4 @@
+import logging
 import urlparse
 from django.db import models
 from django.contrib.auth.models import User, UserManager
@@ -6,7 +7,9 @@ from django.db import connection
 from htsworkflow.frontend import settings
 from htsworkflow.frontend.reports.libinfopar import *
 
+
 # Create your models here.
+logger = logging.getLogger(__name__)
 
 class Antibody(models.Model):
     antigene = models.CharField(max_length=500, db_index=True)
@@ -166,6 +169,8 @@ class Library(models.Model):
       ('2A', 'Ligation, PCR, gel, PCR'),
       ('Done', 'Completed'),
     )
+  PROTOCOL_END_POINTS_DICT = dict(PROTOCOL_END_POINTS)
+  
   stopping_point = models.CharField(max_length=25, choices=PROTOCOL_END_POINTS, default='Done')
   amplified_from_sample = models.ForeignKey('self', blank=True, null=True, related_name='amplified_into_sample')  
   
@@ -189,9 +194,9 @@ class Library(models.Model):
     return u'#%s: %s' % (self.id, self.library_name)
   
   class Meta:
-    verbose_name_plural = "libraries"
-    #ordering = ["-creation_date"] 
-    ordering = ["-id"]
+      verbose_name_plural = "libraries"
+      #ordering = ["-creation_date"] 
+      ordering = ["-id"]
   
   def antibody_name(self):
     str ='<a target=_self href="/admin/samples/antibody/'+self.antibody.id.__str__()+'/" title="'+self.antibody.__str__()+'">'+self.antibody.nickname+'</a>' 
@@ -218,6 +223,15 @@ class Library(models.Model):
     else:
         return False
 
+  def stopping_point_name(self):
+      end_points = Library.PROTOCOL_END_POINTS_DICT
+      name = end_points.get(self.stopping_point, None)
+      if name is None:
+          name = "Lookup Error"
+          logger.error("protocol stopping point in database didn't match names in library model")
+      return name
+      
+
   def libtags(self):
     affs = self.tags.all().order_by('tag_name')
     ar = []
index afccc022586e1570b15117f0651351dbc63cfa8d..a6286d7313072c706ed2e8225e3fd398d28dd290 100644 (file)
@@ -84,7 +84,7 @@ def create_library_context(cl):
        summary['lanes_run'] = lanes_run
        summary['is_archived'] = lib.is_archived()
        records.append(summary)
-    cl.result_count = unicode(cl.paginator._count) + u" libraries"
+    cl.result_count = unicode(cl.paginator._count)
     return {'library_list': records }
 
 def library(request):
@@ -100,16 +100,8 @@ def library(request):
     context.update(create_library_context(fcl))
     t = get_template('samples/library_index.html')
     c = RequestContext(request, context)
+    return HttpResponse( t.render(c) )
     
-    app_context = {
-        'page_name': 'Library Index',
-        'body': t.render(c)
-    }
-    app_context.update(SAMPLES_CONTEXT_DEFAULTS)
-    
-    app_t = get_template('flowcell_libraries_app.html')
-    app_c = RequestContext(request, app_context)
-    return HttpResponse( app_t.render(app_c) )
 
 def library_to_flowcells(request, lib_id):
     """
index 95db12b702923ceb11426419b3cf1a64ebfa3440..ff88816d2bf4983eb961ac32f7d6f8be3c550f30 100644 (file)
@@ -200,6 +200,7 @@ options_to_dict(ALLOWED_ANALYS_IPS, 'allowed_analysis_hosts')
 #UPLOADTO_CONFIG_FILE = os.path.join(UPLOADTO_HOME, 'eland_config')
 #UPLOADTO_ELAND_RESULT_PACKS = os.path.join(UPLOADTO_HOME, 'eland_results')
 #UPLOADTO_BED_PACKS = os.path.join(UPLOADTO_HOME, 'bed_packs')
+# Where "results_dir" means directory with all the flowcells
 if options.has_option('frontend', 'results_dir'):
     RESULT_HOME_DIR=os.path.expanduser(options.get('frontend', 'results_dir'))
 else:
diff --git a/htsworkflow/frontend/templates/admin/pagination.html b/htsworkflow/frontend/templates/admin/pagination.html
new file mode 100644 (file)
index 0000000..f7de053
--- /dev/null
@@ -0,0 +1,13 @@
+<!--overrride pagination-->
+{% load admin_list %}
+{% load i18n %}
+<p class="paginator">
+{% if pagination_required %}
+{% for i in page_range %}
+    {% paginator_number cl i %}
+{% endfor %}
+{% endif %}
+{{ cl.result_count }} {% ifequal cl.result_count 1 %}{{ cl.opts.verbose_name }}{% else %}{{ cl.opts.verbose_name_plural }}{% endifequal %}
+{% if show_all_url %}&#160;&#160;<a href="{{ show_all_url }}" class="showall">{% trans 'Show all' %}</a>{% endif %}
+{% if cl.formset and cl.result_count %}<input type="submit" name="_save" class="default" value="{% trans 'Save' %}"/>{% endif %}
+</p>
diff --git a/htsworkflow/frontend/templates/app_base.html b/htsworkflow/frontend/templates/app_base.html
deleted file mode 100644 (file)
index 1babcf6..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
-<html lang="en">
-<head>
-    <title>{% block title %}{{ app_name }} - {{ page_name }}{% endblock %}</title>
-    
-    <!-- ADMIN STYLE INTERFACE STUFF -->
-    {% block additional_css %}
-    {% endblock %}
-    
-    <!-- App Stuff -->
-    <link type="text/css" rel="stylesheet" href="/static/css/app.css" />
-    <script type="text/javascript" src="/static/js/jquery.min.js"></script>
-    
-    {% block additional_javascript %}
-    {% endblock %}
-    
-    <script type="text/javascript" src="/static/js/htsw.js"></script>
-</head>
-<body class="{% block bodyclass %}{% endblock %}">
-    <!-- Content -->
-    <div id="content" class="{% block coltype %}colM{% endblock %}">
-        {% block pretitle %}{% endblock %}
-        {% block content_title %}{% if title %}<h1>{{ title }}</h1>{% endif %}{% endblock %}
-        {% block content %}
-        {% block object-tools %}{% endblock %}
-        {{ body }}
-        {% endblock %}
-        {% block sidebar %}{% endblock %}
-        <br class="clear" />
-    </div>
-    <!-- END Content -->
-
-    {% block footer %}<div id="footer"></div>{% endblock %}
-</body>
-</html>
index b5e1c39c5a80cab995e0bc2f6d505b3f86a260f8..ba17cbda121d2c2bf6dd646df4c85450d01f77e9 100644 (file)
@@ -1,6 +1,15 @@
-{% load i18n %}
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
-<html lang="en">
+{% load i18n %}<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
+    "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+      version="XHTML+RDFa 1.0"
+      xmlns:xml="http://www.w3.org/1999/xhtml"
+      xmlns:dc="http://purl.org/dc/elements/1.1/"
+      xmlns:xmls="http://www.w3.org/2001/XMLSchema#"
+      xmlns:libns="http://jumpgate.caltech.edu/wiki/LibraryOntology#"
+      xml:lang="en"
+>
+<!--base.html-->
 <head>
     <title>{% block title %}{{ app_name }} - {{ page_name }}{% endblock %}</title>
 
         {% block branding %}{% endblock %}
         </div>
         {% if user.is_authenticated and user.is_staff %}
-        <div id="user-tools">{% trans 'Welcome,' %} <strong>{% firstof user.first_name user.username %}</strong>. {% block userlinks %}{% url django-admindocs-docroot as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / {% endif %}<a href="{{ root_path }}password_change/">{% trans 'Change password' %}</a> / <a href="{{ root_path }}logout/">{% trans 'Log out' %}</a>{% endblock %} 
+        <div id="user-tools">{% trans 'Welcome,' %} <strong>{% firstof user.first_name user.username %}</strong>. {% block userlinks %}{% url django-admindocs-docroot as docsroot %}{% if docsroot %}<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> / {% endif %}<a href="/admin/password_change/">{% trans 'Change password' %}</a> / <a href="/admin/logout/">{% trans 'Log out' %}</a>{% endblock %} 
         </div>
         {% endif %}
         {% block nav-global %}{% endblock %}
     </div>
-    
-    {% block breadcrumbs %}<div class="breadcrumbs"><a href="/">{% trans 'Home' %}</a>{% if title %} &rsaquo; {{ title }}{% endif %}</div>{% endblock %}
     {% endif %}
        {% if messages %}
         <ul class="messagelist">{% for message in messages %}<li>{{ message }}</li>{% endfor %}</ul>
diff --git a/htsworkflow/frontend/templates/flowcell_libraries_app.html b/htsworkflow/frontend/templates/flowcell_libraries_app.html
deleted file mode 100644 (file)
index 6e31b59..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-{% extends "app_base.html" %}
-
-{% block additional_css %}
-    {% load adminmedia %}
-    {% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% admin_media_prefix %}css/rtl.css{% endblock %}" />{% endif %}
-    {% block extrastyle %}{% endblock %}
-    {% block extrahead %}{% endblock %}
-    {% block blockbots %}<meta name="robots" content="NONE,NOARCHIVE" />{% endblock %}
-    <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/data-browse-index.css" />
-{% endblock %}
-
-{% block dynamic_panels %}
-    <ul id="Libraries" class="x-hidden">
-            <li>
-                <img src="/static/img/s.gif" class="icon-show-all" />
-                <a href="{% url htsworkflow.frontend.samples.views.library %}">Index</a><br />
-            </li>
-    </ul>
-    <ul id="Flowcells" class="x-hidden">
-            <li>
-                <img src="/static/img/s.gif" class="icon-show-all" />
-                <a href="/runfolders/">Run Folders</a><br />
-            </li>
-    </ul>
-{% endblock %}
-
-{% block app_toolbar_west %}
-    <div id="Library Index" href="{% url htsworkflow.frontend.samples.views.library %}"></div>
-    <div id="Run Folders" href="/runfolders/"></div>
-{% endblock %}
-
-{% block app_toolbar_east %}
-    <!--<div id="Admin" href="/admin/"></div>-->
-{% endblock %}
diff --git a/htsworkflow/frontend/templates/inventory/inventory_app.html b/htsworkflow/frontend/templates/inventory/inventory_app.html
deleted file mode 100644 (file)
index b5271c6..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-{% extends "app_base.html" %}
-
-{% block additional_css %}
-{% endblock %}
-
-{% block dynamic_panels %}
-    <ul id="Libraries" class="x-hidden">
-            <li>
-                <img src="/static/img/s.gif" class="icon-show-all" />
-                <a href="{% url htsworkflow.frontend.samples.views.library %}">Index</a><br />
-            </li>
-    </ul>
-{% endblock %}
-
-{% block app_toolbar_west %}
-    <div id="Inventory Index" href="{% url htsworkflow.frontend.inventory.views.index %}"></div>
-{% endblock %}
-
-{% block app_toolbar_east %}
-    <!--<div id="Admin" href="/admin/"></div>-->
-{% endblock %}
index cd28d5997ee32092f85fc4b8cdecac82f08bcde0..1f053df6e6538c96311fb1afb11b8be56b6e109b 100644 (file)
@@ -1,10 +1,11 @@
-{% extends "app_base.html" %}
+{% extends "base_site.html" %}
 {% load i18n %}
 
 {% block additional_css %}{% load adminmedia %}{{ block.super }}
 <link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/base.css" />
 <link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/login.css" />
 {% endblock %}
+
 {% block title %}Login{% endblock %}
 {% block bodyclass %}login{% endblock %}
 
@@ -13,9 +14,7 @@
 <p class="errornote">{{ error_message }}</p>
 {% endif %}
 <div id="container">
-  <div id="header">
     <h1>Login</h1>
-  </div>
 <form action="{{ app_path }}" method="post" id="login-form">
   <div class="form-row">
     <label for="id_username">{% trans 'Username:' %}</label> <input type="text" name="username" id="id_username" />
index c53c4deea708a1dc3728962a8c383e3e5fb13531..fec48b0447583157f93691c7e2732c2296325455 100644 (file)
@@ -1,4 +1,4 @@
-{% extends "flowcell_libraries_app.html" %}
+{% extends "base_site.html" %}
 
 {% block content %}
 <table>
index 90bce6a4cc13a2eab9e40d71ea591fc68bb7e308..152f322300a40e0724892de777ac0faafb82ad83 100644 (file)
@@ -1,5 +1,4 @@
 {% extends "base_site.html" %}
-{# extends "app_base.html" #}
 {% load adminmedia admin_list i18n %}
 
 {% block bodyclass %}change-list{% endblock %}
index 6c6fa8d93a79015a4e3daf22941ea3cdc1a8d3da..1bbd65b2986caf766d832ac8fd86b294d992b8a5 100644 (file)
@@ -1,7 +1,13 @@
-{% extends "flowcell_libraries_app.html" %}
-{% load humanize %}
+{% extends "base_site.html" %}
+{% load adminmedia humanize i18n %}
+{% block extrahead %}
+    <!-- App Stuff -->
+    <link type="text/css" rel="stylesheet" href="/static/css/app.css" />
+    <script type="text/javascript" src="/static/js/jquery.min.js"></script>
+    
+    {% block additional_javascript %}
+    {% endblock %}
 
-{% block additional_css %}
 <style type="text/css">
   /* <![CDATA[ */
   div#librarydetail {
 <div id="librarydetail">
   <h2>About this library</h2>
   <b>Library ID</b>: {{ lib.id }}<br/>
-  <b>Name</b>: {{ lib.library_name }}<br/>
-  <b>Species</b>: {{ lib.library_species.scientific_name }}<br/>
-  <b>Concentration</b>: {{ lib.undiluted_concentration }} ng/µl<br/>
-  <b>Gel Cut Size</b>: {{ lib.gel_cut_size }}<br/>
-  <b>Insert Size</b>: {{ lib.insert_size }}<br/>
-  <b>Replicate</b>: {{ lib.replicate }}<br/>
-  <b>Made By</b>: {{ lib.made_by }} <br/>
+  <b>Name</b>: 
+    <span property="libns:name">{{ lib.library_name }}</span>
+  <br/>
+  <b>Species</b>: 
+    <span property="libns:species">{{ lib.library_species.scientific_name }}</span>
+  <br/>
+  <b>Concentration</b>: 
+    <span property="libns:concentration">{{ lib.undiluted_concentration }} ng/µl</span>
+  <br/>
+  <b>Gel Cut Size</b>: 
+    <span property="libns:gel_cut">{{ lib.gel_cut_size }}</span>
+  <br/>
+  <b>Insert Size</b>: 
+    <span property="libns:insert_size">{{ lib.insert_size }}</span>
+  <br/>
+  <b>Background or Cell Line</b>:
+     <span property="libns:cell_line">{{ lib.cell_line }}</span>
+  <br/>
+  <b>Replicate</b>: 
+     <span property="libns:replicate">{{ lib.replicate }}</span>
+  <br/>
+  <b>Library Type</b>:
+     <span property="libns:library_type">{{ lib.library_type }}</span>
+  <br/>
+  <b>Experiment Type</b>:
+     <span property="libns:experiment_type">{{ lib.experiment_type }}</span>
+  <br/>
+  <b>Made By</b>: 
+    <span property="libns:made_by">{{ lib.made_by }}</span>
+  <br/>
+  <b>Creation Date</b>
+    <span property="libns:creation_date">{{ lib.creation_date }}</span>
+  <br/> 
+  <b>Protocol Stopping Point</b>
+    <span property="libns:stopping_point">{{ lib.stopping_point_name }}</span>
+  <br/> 
   <b>Affiliations</b>:
   <ul>
     {% for individual in lib.affiliations.all %}
-      <li>{{ individual.name }} ( {{ individual.contact }} )</li>
+      <li property="libns:affliation" content="{{individual.name}}">
+        {{ individual.name }} ( {{ individual.contact }} )
+      </li>
     {% endfor %}
   </ul>
   
       <td>Bed</td>
       <td>Archived</td>
     </tr>
-  {% for result in eland_results %}
-  <tr>
-    <td>{{ result.run_date|date }}</td>
-    <td>{{ result.cycle }}</td>
-    <td>{{ result.flowcell_id }}</td>
-    <td>{{ result.lane }}</td>
-    <td><a href="{{ result.summary_url }}">Summary</a></td>
-    <td><a href="{{ result.result_url }}">{{ result.result_label }}</a></td>
-    <td>
-    {% if result.bed_url %}
-      <a href="{{ result.bed_url }}">Bed</a>
-    {% endif %}
-    </td>
-    <td>
-      {% if result.storage_ids %}
-        {{ result.storage_ids|safe }}
+  </thead>
+  <tbody>
+    {% for result in eland_results %}
+    <tr about="/flowcell/{{result.flowcell_id}}/lane/{{result.lane}}">
+      <td property="libns:run_date" contents="{{result.run_date}}" datatype="xmls:datetime">{{ result.run_date|date}}</td>
+      <td>{{ result.cycle }}</td>
+      <td property="libns:flowcell_id">{{ result.flowcell_id }}</td>
+      <td property="libns:lane">{{ result.lane }}</td>
+      <td><a href="{{ result.summary_url }}">Summary</a></td>
+      <td><a href="{{ result.result_url }}">{{ result.result_label }}</a></td>
+      <td>
+      {% if result.bed_url %}
+        <a href="{{ result.bed_url }}">Bed</a>
       {% endif %}
-    </td>
-  </tr>
-  {% endfor %}
+      </td>
+      <td>
+        {% if result.storage_ids %}
+          {{ result.storage_ids|safe }}
+        {% endif %}
+      </td>
+    </tr>
+    {% endfor %}
+  </tbody>
   </table>
   
   <h2>Lane Summary Statistics</h2>
     <tbody>
   
       {% for lane in lane_summary_list %}
-      <tr>
+      <tr about="/flowcell/{{lane.flowcell_id}}/lane/{{lane.lane_id}}/end/{% if lane.end %}{{ lane.end }}{% endif %}">
         <td>{{ lane.cycle_width }}</td>
         <td>{{ lane.flowcell_id }}</td>
         <td>{{ lane.lane_id }}</td>
         <td>{{ lane.match_codes.U0|intcomma }}</td>
         <td>{{ lane.match_codes.U1|intcomma }}</td>
         <td>{{ lane.match_codes.U2|intcomma }}</td>
-        <td>{{ lane.unique_reads|intcomma }}</td>
+        <td property="libns:sequence_unique_location" contents="{{lane.unique_reads}}" datatype="xmls:decimal">{{ lane.unique_reads|intcomma }}</td>
         <td>{{ lane.match_codes.R0|intcomma }}</td>
         <td>{{ lane.match_codes.R1|intcomma }}</td>
         <td>{{ lane.match_codes.R2|intcomma }}</td>
   <table>
     <thead>
       <tr>
-       <td>Flowcell ID</td>
-       <td>Lane</td>
-       <td>Comment</td>
+       <td>Flowcell ID</td>
+       <td>Lane</td>
+       <td>Comment</td>
+      </tr>
     </thead>
     <tbody>
       {% for lane in lib.lane_set.all %}
       <tr>
-       <td>{{ lane.flowcell.flowcell_id }}</td>
-       <td>{{ lane.lane_number }}</td>
-       <td>{{ lane.comment }}</td>
-       {% endfor %}
+        <td>{{ lane.flowcell.flowcell_id }}</td>
+        <td>{{ lane.lane_number }}</td>
+        <td>{{ lane.comment }}</td>
+      </tr>
+         {% endfor %}
     </tbody>
   </table>
   <br/>
index 1a53ac2a6f3aad48f77024ee1d18e6d0cceed69d..16cd9a32121106d7584fa151e78388bc274f3584 100644 (file)
@@ -1,6 +1,12 @@
 {% extends "base_site.html" %}
 {% load adminmedia admin_list i18n %}
 {% block extrahead %}
+    <!-- App Stuff -->
+    <link type="text/css" rel="stylesheet" href="/static/css/app.css" />
+    
+    {% block additional_javascript %}    
+    <script type="text/javascript" src="/static/js/jquery.min.js"></script>
+    <script type="text/javascript" src="/static/js/htsw.js"></script>
     <script type="text/javascript">
       $(document).ready(function() {
         $(window).resize(function() {
         $(window).resize();
       });
     </script>
+    {% endblock %}
 {% endblock %}
 {% block bodyclass %}change-list{% endblock %}
 {% block coltype %}flex{% endblock %}
+
 {% block content %}
 <div id="library-index-div" >
   <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
@@ -30,7 +38,7 @@
       {% for spec in cl.filter_specs %}
          {% admin_list_filter cl spec %}
          {% endfor %}
-       </div>
+    </div>
     {% endif %}
     {% endblock %}
   {% block summary_stats %}
     </thead>
     <tbody >
       {% for lib in library_list %}
-      <tr >
+      <tr about="/library/{{lib.library_id}}">
         <td ><a href="/library/{{ lib.library_id }}">{{ lib.amplified_from }}</a></td>
-        <td ><a href="/library/{{ lib.library_id }}">{{ lib.library_id }}</a></td>
-        <td ><a href="/library/{{ lib.library_id }}">{{ lib.species_name }}</a></td>
-        <td ><a href="/library/{{ lib.library_id }}">{{ lib.library_name }}</a></td>
+        <td ><a href="/library/{{ lib.library_id }}" property="libns:library_id">{{ lib.library_id }}</a></td>
+        <td ><a href="/library/{{ lib.library_id }}" property="libns:species_name">{{ lib.species_name }}</a></td>
+        <td ><a href="/library/{{ lib.library_id }}" property="libns:library_name">{{ lib.library_name }}</a></td>
         <td  bgcolor="#00BFFF">{{ lib.lanes_run.0.0 }}</td>      
         <td  bgcolor="#00BFFF">{{ lib.lanes_run.0.1 }}</td>      
         <td  bgcolor="#00BFFF">{{ lib.lanes_run.0.2 }}</td>      
@@ -78,6 +86,7 @@
       {% endfor %}
     </tbody>
   </table>
+  </div>
   {% endblock %}
 </div>
 {% endblock %}
diff --git a/htsworkflow/pipelines/test/test_qseq2fastq.py b/htsworkflow/pipelines/test/test_qseq2fastq.py
new file mode 100644 (file)
index 0000000..1c32924
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+import unittest
+
+import htsworkflow.pipelines.qseq2fastq as qseq2fastq
+
+class TestQseq2Fastq(unittest.TestCase):
+    def test_parse_slice(self):
+        s = qseq2fastq.parse_slice("1:")
+        self.failUnlessEqual(s.start, 1)
+        self.failUnlessEqual(s.stop, None)
+
+        s = qseq2fastq.parse_slice("0:2")
+        self.failUnlessEqual(s.start, 0)
+        self.failUnlessEqual(s.stop, 2)
+
+def suite():
+    return unittest.makeSuite(TestQseq2Fastq, 'test')
+
+if __name__ == "__main__":
+    unittest.main(defaultTest="suite")
+