-from htsworkflow.frontend.experiments.models import FlowCell, DataRun, ClusterStation, Sequencer
+from htsworkflow.frontend.experiments.models import FlowCell, DataRun, ClusterStation, Sequencer, Lane
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
+class LaneInline(admin.StackedInline):
+ model = Lane
+ max_num = 8
+ extra = 8
+
class DataRunOptions(admin.ModelAdmin):
search_fields = [
'run_folder',
}),
('Notes:', { 'fields': ('notes',),}),
)
+ inlines = [
+ LaneInline,
+ ]
class ClusterStationOptions(admin.ModelAdmin):
list_display = ('name', )
class SequencerOptions(admin.ModelAdmin):
list_display = ('name', )
fieldsets = ( ( None, { 'fields': ( 'name', ) } ), )
+
+class LaneOptions(admin.ModelAdmin):
+ list_display = ('flowcell', 'lane_number', 'library', 'comment')
+
admin.site.register(DataRun, DataRunOptions)
admin.site.register(FlowCell, FlowCellOptions)
admin.site.register(ClusterStation, ClusterStationOptions)
admin.site.register(Sequencer, SequencerOptions)
+admin.site.register(Lane, LaneOptions)
except ValueError,e:
logging.error("invalid value for frontend.default_pm")
+
+
+
class FlowCell(models.Model):
flowcell_id = models.CharField(max_length=20, unique=True, db_index=True)
str += '</div>'
return str
Flowcell_Info.allow_tags = True
+
+
+class Lane(models.Model):
+ flowcell = models.ForeignKey(FlowCell)
+ lane_number = models.IntegerField(choices=[(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8)])
+ library = models.ForeignKey(Library)
+ pm = models.DecimalField(max_digits=5, decimal_places=2,blank=False, null=False,default=default_pM)
+ cluster_estimate = models.IntegerField(blank=True, null=True)
+ comment = models.TextField(null=True, blank=True)
from django.utils.translation import ugettext_lazy as _
from htsworkflow.frontend.samples.models import Antibody, Cellline, Condition, ExperimentType, LibraryType, Species, Affiliation, Library, Tag
+from htsworkflow.frontend.experiments.models import Lane
+
+class LaneLibraryInline(admin.StackedInline):
+ model = Lane
+ extra = 0
class Library_Inline(admin.TabularInline):
model = Library
'fields' : (('affiliations'), ('tags'),)
}),
)
+ inlines = [
+ LaneLibraryInline,
+ ]
# some post 1.0.2 version of django has formfield_overrides
# which would replace this code with:
REPLICATE_NUM = ((1,1),(2,2),(3,3),(4,4))
replicate = models.PositiveSmallIntegerField(choices=REPLICATE_NUM,default=1)
experiment_type = models.ForeignKey(ExperimentType)
- library_type = models.ForeignKey(LibraryType, null=True)
+ library_type = models.ForeignKey(LibraryType, blank=True, null=True)
creation_date = models.DateField(blank=True, null=True)
made_for = models.CharField(max_length=50, blank=True,
verbose_name='ChIP/DNA/RNA Made By')
--- /dev/null
+#!/usr/bin/env python
+
+from htsworkflow.frontend.experiments.models import FlowCell, Lane
+
+
+if __name__ == '__main__':
+
+ print "Migration starting..."
+
+ #Get all flowcells
+ for flowcell in FlowCell.objects.all():
+
+ ##################
+ # Lane 1
+ lane1 = Lane()
+
+ # ForeignKey Links
+ lane1.flowcell = flowcell
+ lane1.library = flowcell.lane_1_library
+
+ # Meta Data
+ lane1.lane_number = 1
+ lane1.pm = flowcell.lane_1_pM
+ lane1.cluster_estimate = flowcell.lane_1_cluster_estimate
+
+ # Save
+ lane1.save()
+
+ ##################
+ # Lane 2
+ lane2 = Lane()
+
+ # ForeignKey Links
+ lane2.flowcell = flowcell
+ lane2.library = flowcell.lane_2_library
+
+ # Meta Data
+ lane2.lane_number = 2
+ lane2.pm = flowcell.lane_2_pM
+ lane2.cluster_estimate = flowcell.lane_2_cluster_estimate
+
+ # Save
+ lane2.save()
+
+ ##################
+ # Lane 3
+ lane3 = Lane()
+
+ # ForeignKey Links
+ lane3.flowcell = flowcell
+ lane3.library = flowcell.lane_3_library
+
+ # Meta Data
+ lane3.lane_number = 3
+ lane3.pm = flowcell.lane_3_pM
+ lane3.cluster_estimate = flowcell.lane_3_cluster_estimate
+
+ # Save
+ lane3.save()
+
+ ##################
+ # Lane 4
+ lane4 = Lane()
+
+ # ForeignKey Links
+ lane4.flowcell = flowcell
+ lane4.library = flowcell.lane_4_library
+
+ # Meta Data
+ lane4.lane_number = 4
+ lane4.pm = flowcell.lane_4_pM
+ lane4.cluster_estimate = flowcell.lane_4_cluster_estimate
+
+ # Save
+ lane4.save()
+
+ ##################
+ # Lane 5
+ lane5 = Lane()
+
+ # ForeignKey Links
+ lane5.flowcell = flowcell
+ lane5.library = flowcell.lane_5_library
+
+ # Meta Data
+ lane5.lane_number = 5
+ lane5.pm = flowcell.lane_5_pM
+ lane5.cluster_estimate = flowcell.lane_5_cluster_estimate
+
+ # Save
+ lane5.save()
+
+ ##################
+ # Lane 6
+ lane6 = Lane()
+
+ # ForeignKey Links
+ lane6.flowcell = flowcell
+ lane6.library = flowcell.lane_6_library
+
+ # Meta Data
+ lane6.lane_number = 6
+ lane6.pm = flowcell.lane_6_pM
+ lane6.cluster_estimate = flowcell.lane_6_cluster_estimate
+
+ # Save
+ lane6.save()
+
+ ##################
+ # Lane 7
+ lane7 = Lane()
+
+ # ForeignKey Links
+ lane7.flowcell = flowcell
+ lane7.library = flowcell.lane_7_library
+
+ # Meta Data
+ lane7.lane_number = 7
+ lane7.pm = flowcell.lane_7_pM
+ lane7.cluster_estimate = flowcell.lane_7_cluster_estimate
+
+ # Save
+ lane7.save()
+
+ ##################
+ # Lane 8
+ lane8 = Lane()
+
+ # ForeignKey Links
+ lane8.flowcell = flowcell
+ lane8.library = flowcell.lane_8_library
+
+ # Meta Data
+ lane8.lane_number = 8
+ lane8.pm = flowcell.lane_1_pM
+ lane8.cluster_estimate = flowcell.lane_8_cluster_estimate
+
+ # Save
+ lane8.save()
+
+ print "Migration Complete."
\ No newline at end of file
--- /dev/null
+#!/bin/bash
+export DJANGO_SETTINGS_MODULE=htsworkflow.frontend.settings
+scp king@jumpgate.caltech.edu:/home/www/gaworkflow/fctracker.db /home/king/proj/htsworkflow/trunk/fctracker.db
+cd htsworkflow/frontend/
+python manage.py syncdb
+cd ../..
+./scripts/migrate_to_lane_table.py
+