Make antibody & condition visible. add-condition
authorDiane Trout <diane@caltech.edu>
Wed, 25 May 2011 00:00:02 +0000 (17:00 -0700)
committerDiane Trout <diane@caltech.edu>
Wed, 25 May 2011 00:00:02 +0000 (17:00 -0700)
Also change replicate number to allow null and not autodefault to 1.
Lastly reorganize the fields on the library page to be a bit less confusing.

htsworkflow/frontend/samples/admin.py
htsworkflow/frontend/samples/models.py
htsworkflow/frontend/templates/samples/library_detail.html

index 6db3ba831e59cb88d0fe397ae470e7e802156892..4247c88b68d7998771a1adad4c04d28d24587d28 100644 (file)
@@ -47,11 +47,11 @@ class AntibodyOptions(admin.ModelAdmin):
      )
 
 class CelllineOptions(admin.ModelAdmin):
-    list_display = ('cellline_name', 'nickname', 'notes')
+    list_display = ('cellline_name', 'notes')
     search_fields = ('cellline_name', 'nickname', 'notes')
     fieldsets = (
       (None, {
-          'fields': (('cellline_name'),('notes'),)
+          'fields': (('cellline_name','nickname',),('notes'),)
       }),
      )
 
@@ -129,9 +129,16 @@ class LibraryOptions(admin.ModelAdmin):
       (None, {
         'fields': (
           ('id','library_name','hidden'),
-          ('library_species', 'cell_line', 'replicate'),
-          ('library_type', 'experiment_type'))
+          ('library_species', 'library_type', 'experiment_type'),
+          )
          }),
+         ('Experiment Detail:', {
+            'fields': (('cell_line', 'replicate',),
+                       ('condition',),
+                       ('antibody', ),
+                       ),
+            'classes': ('collapse',),
+            }),
          ('Creation Information:', {
              'fields' : (('made_by', 'creation_date', 'stopping_point'), 
                          ('amplified_from_sample'), 
@@ -221,9 +228,9 @@ class TagOptions(admin.ModelAdmin):
 
 admin.site.register(Library, LibraryOptions)
 admin.site.register(Affiliation, AffiliationOptions)
-#admin.site.register(Antibody, AntibodyOptions)
+admin.site.register(Antibody, AntibodyOptions)
 admin.site.register(Cellline, CelllineOptions)
-#admin.site.register(Condition, ConditionOptions)
+admin.site.register(Condition, ConditionOptions)
 admin.site.register(ExperimentType, ExperimentTypeOptions)
 #admin.site.register(HTSUser, HTSUserOptions)
 admin.site.register(LibraryType, LibraryTypeOptions)
index 8314c71f5e685f2cd44d28805959ddafeb3e5adf..7584cfe94ed7ddd74f45320def558c4aab14152d 100644 (file)
@@ -20,8 +20,7 @@ class Antibody(models.Model):
         max_length=20,
         blank=True,
         null=True, 
-        db_index=True,
-        verbose_name = 'Short Name'
+        db_index=True
     )
     catalog = models.CharField(max_length=50, unique=True, db_index=True)
     antibodies = models.CharField(max_length=500, db_index=True)
@@ -39,8 +38,8 @@ class Cellline(models.Model):
     nickname = models.CharField(max_length=20,
         blank=True,
         null=True, 
-        db_index=True,
-        verbose_name = 'Short Name')
+        db_index=True)
+    
     notes = models.TextField(blank=True)
     def __unicode__(self):
         return unicode(self.cellline_name)
@@ -149,7 +148,7 @@ class Library(models.Model):
   # New field Aug/19/08
   # SQL to add column: alter table fctracker_library add column "replicate" smallint unsigned NULL;
   REPLICATE_NUM = ((1,1),(2,2),(3,3),(4,4))
-  replicate =  models.PositiveSmallIntegerField(choices=REPLICATE_NUM,default=1
+  replicate =  models.PositiveSmallIntegerField(choices=REPLICATE_NUM,blank=True,null=True
   experiment_type = models.ForeignKey(ExperimentType)
   library_type = models.ForeignKey(LibraryType, blank=True, null=True)
   creation_date = models.DateField(blank=True, null=True)
@@ -199,7 +198,7 @@ class Library(models.Model):
       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>' 
+    str ='<a target=_self href="/admin/samples/antibody/'+self.antibody.id.__str__()+'/" title="'+self.antibody.__str__()+'">'+self.antibody.label+'</a>' 
     return str
   antibody_name.allow_tags = True
 
index 0aa83d07528f2f7ea82a9499a8b1c28bf4b74011..412f201c0b26d5e1bafcca0e8637743122939c98 100644 (file)
   {
     margin-bottom: .5em;
   }
+
+  div.library_identity { 
+    float: left; margin: 5px; }
+  div.library_sample_detail { float: left; margin: 5px; }
+  div.library_library_detail { float: left; margin: 5px; }
+  div.library_statistics { clear: both; border: 1px; }
  /* ]]> */
 </style>
 {% endblock %}
 
 {% block content %}
 <div id="librarydetail">
-  <h2>About this library</h2>
-  <b>Library ID</b>: {{ lib.id }}<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:date" content="{{lib.creation_date|date:'Y-m-d'}}T00:00:00" datatype="xsd:dateTime">{{ 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 property="libns:affliation" content="{{individual.name}}">
-        {{ individual.name }} ( {{ individual.contact }} )
-      </li>
-    {% endfor %}
-  </ul>
-  
+  <div class="library_identity">
+    <h2>Library Name</h2>  
+    <b>Library ID</b>: {{ lib.id }}<br/>
+    <b>Name</b>: 
+      <span property="libns:name">{{ lib.library_name }}</span>
+    <br/>
+    <b>Affiliations</b>:
+    <ul>
+      {% for individual in lib.affiliations.all %}
+        <li property="libns:affliation" content="{{individual.name}}">
+          {{ individual.name }} ( {{ individual.contact }} )
+        </li>
+      {% endfor %}
+    </ul>
+  </div>
+  <div class="library_sample_detail">
+    <h2>Sample Details</h2>
+    <b>Species</b>: 
+      <span property="libns:species">{{ lib.library_species.scientific_name }}</span>
+    <br/>
+    <b>Experiment Type</b>:
+       <span property="libns:experiment_type">{{ lib.experiment_type }}</span>
+    <br/>
+    {% if lib.antibody %}
+    <b>Antibody</b>:
+       <span property="libns:antibody">{{ lib.antibody.antibodies }}</span>
+       {% if lib.antibody.antibodies.nuckname %}
+       (<span property="libns:antibody_term">{{ lib.antibody.nickname }}</span>)
+       {% endif %}
+    <br/>
+    {% endif %}
+    {% if lib.cell_line %}
+    <b>Background or Cell Line</b>:
+       <span property="libns:cell_line">{{ lib.cell_line }}</span>
+    <br/>
+    {% endif %}
+    {% if lib.condition %}
+    <b>Condition</b>:
+       <span property="libns:condition">{{ lib.condition.condition_name }}</span>
+       {% if lib.condition.nickname %}
+       (<span property="libns:condition_term">{{ lib.condition.nickname }}</span>)
+       {% endif %}
+    <br/>
+    {% endif %}
+    {% if lib.replicate %}
+    <b>Replicate</b>: 
+       <span property="libns:replicate">{{ lib.replicate }}</span>
+    <br/>
+    {% endif %}
+  </div>
+  <div class="library_library_detail">
+    <h2>Library Details</h2>
+    <b>Library Type</b>:
+       <span property="libns:library_type">{{ lib.library_type }}</span>
+    <br/>
+    <b>Creation Date</b>
+      <span property="libns:date" content="{{lib.creation_date|date:'Y-m-d'}}T00:00:00" datatype="xsd:dateTime">{{ lib.creation_date }}</span>
+    <br/> 
+    <b>Made By</b>: 
+      <span property="libns:made_by">{{ lib.made_by }}</span>
+    <br/>
+    {% if lib.gel_cut_size %}
+    <b>Gel Cut Size</b>: 
+      <span property="libns:gel_cut">{{ lib.gel_cut_size }}</span>
+    <br/>
+    {% endif %}
+    {% if lib.insert_size %}
+    <b>Insert Size</b>: 
+      <span property="libns:insert_size">{{ lib.insert_size }}</span>
+    <br/>
+    {% endif %}
+    {% if lib.undiluted_concentration %}
+    <b>Concentration</b>: 
+      <span property="libns:concentration">{{ lib.undiluted_concentration }} ng/µl</span>
+    <br/>
+    {% endif %}
+    {% if lib.stopping_point_name %}
+    <b>Protocol Stopping Point</b>
+      <span property="libns:stopping_point">{{ lib.stopping_point_name }}</span>
+    <br/>
+    {% endif %}
+  </div>
+  <div class="library_statistics">
   <h2>Raw Result Files</h2>
   <table>
   <thead>
     {% endif %}
   {% endfor %}
   {% endblock %}
+  </div>
 </div>
 {% endblock %}