Skip to content
This repository has been archived by the owner on Aug 24, 2022. It is now read-only.

Commit

Permalink
load flowcells issues
Browse files Browse the repository at this point in the history
  • Loading branch information
risufaj committed Jan 24, 2019
1 parent 3c5a710 commit 80b0304
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 21 deletions.
96 changes: 85 additions & 11 deletions flowcell/serializers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import itertools

from pprint import pprint
from django.apps import apps
from django.db.models import Q

Expand Down Expand Up @@ -52,35 +52,108 @@ class LaneSerializer(ModelSerializer):
index_i5_show = SerializerMethodField()
equal_representation = SerializerMethodField()
quality_check = CharField(required=False)
request = SerializerMethodField()
protocol = SerializerMethodField()

class Meta:
list_serializer_class = LaneListSerializer
model = Lane
fields = ('pk', 'name', 'pool', 'pool_name', 'read_length_name',
'index_i7_show', 'index_i5_show', 'equal_representation',
'loading_concentration', 'phix', 'quality_check',)
'loading_concentration', 'phix', 'quality_check','request','protocol')
extra_kwargs = {
'name': {'required': False},
'pool': {'required': False},
}

def get_request(self,obj):

requests = []
records = obj.pool.libraries.all() or obj.pool.samples.all()

for record in records:
for req in record.request.all():
requests.append(req.name)
if len(requests) == 1 or len(set(requests)) == 1:
return requests[0]
else:
return ";".join(requests)

def get_protocol(self,obj):

protocols = []

records = obj.pool.libraries.all() or obj.pool.samples.all()

for record in records:
protocols.append(record.library_protocol.name)

if len(protocols) == 1 or len(set(protocols)) == 1:
return protocols[0]
else:
return ";".join(protocols)

def get_pool_name(self, obj):

return obj.pool.name

def get_read_length_name(self, obj):
return str(obj.pool.size)
read_lengths = []
i = 0
records = obj.pool.libraries.all() or obj.pool.samples.all()
for record in records:
print(record.library_protocol.name)
read_lengths.append(str(record.read_length.name))

if len(read_lengths) == 1 or len(set(read_lengths)) == 1:
return read_lengths[0]
else:
return ";".join(read_lengths)



def get_index_i7_show(self, obj):
# records = obj.pool.libraries.all() or obj.pool.samples.all()
# return records[0].index_type.is_index_i7
# TODO: rethink this
return None
'''we show the actual index instead of a yes/no entry'''
records = obj.pool.libraries.all() or obj.pool.samples.all()
idx = []
contains_i7 = False
for record in records:
if str(record.index_i7) != "":
contains_i7 = True
break
#idx.append(str(record.index_i7))

#if len(idx) == 1 or len(set(idx)) == 1:
# return idx[0]
#else:
# return ";".join(idx)
if contains_i7:
return "Yes"
else:
return ""


def get_index_i5_show(self, obj):
# records = obj.pool.libraries.all() or obj.pool.samples.all()
# return records[0].index_type.is_index_i5
# TODO: rethink this
return None
'''we show the actual index instead of a yes/no entry'''

records = obj.pool.libraries.all() or obj.pool.samples.all()
idx = []
contains_i5 = False
for record in records:
if str(record.index_i5) != "":
contains_i5 = True
break
#idx.append(str(record.index_i5))

#if len(idx) == 1 or len(set(idx)) == 1:
# return idx[0]
#else:
# return ";".join(idx)
if contains_i5:
return "Yes"
else:
return ""
#return None

def get_equal_representation(self, obj):
records = list(itertools.chain(
Expand All @@ -100,6 +173,7 @@ class Meta:
'create_time', 'lanes',)

def get_flowcell(self, obj):
pprint(vars(obj))
return obj.pk

def get_sequencer_name(self, obj):
Expand Down
8 changes: 6 additions & 2 deletions flowcell/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,11 @@ def download_benchtop_protocol(self, request):
'Flowcell ID',
'Sequencer',
'Lane',
'Request',
'I7 present',
'I5 present',
'Equal Representation of Nucleotides',
#'Equal Representation of Nucleotides',
'Library protocol',
'Read Length',
'Loading Concentration',
'PhiX %',
Expand All @@ -238,9 +240,11 @@ def download_benchtop_protocol(self, request):
item['flowcell_id'],
item['sequencer_name'],
item['name'],
item['request'],
item['index_i7_show'],
item['index_i5_show'],
item['equal_representation'],
#item['equal_representation'],
item['protocol'],
item['read_length_name'],
item['loading_concentration'],
item['phix'],
Expand Down
12 changes: 10 additions & 2 deletions static/main-hub/app/model/flowcell/Flowcell.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ Ext.define('MainHub.model.flowcell.Flowcell', {
},
{
name: 'index_i7_show',
type: 'bool'
type: 'string'
},
{
name: 'index_i5_show',
type: 'bool'
type: 'string'
},
{
name: 'equal_representation',
Expand All @@ -63,6 +63,14 @@ Ext.define('MainHub.model.flowcell.Flowcell', {
name: 'phix',
type: 'float',
allowNull: true
},
{
name: 'request',
type: 'string'
},
{
name: 'protocol',
type: 'string'
}
]
});
26 changes: 20 additions & 6 deletions static/main-hub/app/view/flowcell/Flowcells.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,17 @@ Ext.define('MainHub.view.flowcell.Flowcells', {
},

customConfig: {
qualityCheckMenuOptions: ['completed']
qualityCheckMenuOptions: ['completed'],
listeners:{
refresh:function(d){Ext.each(d.panel.columns,function(col){col.autoSize()})}
}
},

columns: {
defaults: {
minWidth: 150,
flex: 1

},
items: [
{
Expand Down Expand Up @@ -80,6 +84,11 @@ Ext.define('MainHub.view.flowcell.Flowcells', {
renderer: Ext.util.Format.dateRenderer(),
filter: { type: 'date' }
},
{
text: 'Request',
dataIndex: 'request',
filter: {type: 'string'}
},
{
text: 'Length',
tooltip: 'Read Length',
Expand All @@ -89,26 +98,31 @@ Ext.define('MainHub.view.flowcell.Flowcells', {
{
text: 'Index I7',
dataIndex: 'index_i7_show',
renderer: 'yesNoRenderer',
filter: { type: 'boolean' }
//renderer: 'yesNoRenderer',
filter: { type: 'string' }
},
{
text: 'Index I5',
dataIndex: 'index_i5_show',
renderer: 'yesNoRenderer',
filter: { type: 'boolean' }
//renderer: 'yesNoRenderer',
filter: { type: 'string' }
},
{
text: 'Sequencer',
dataIndex: 'sequencer_name',
filter: { type: 'list' }
},
{
/* {
text: 'Equal nucl.',
tooltip: 'Equal Representation of Nucleotides',
dataIndex: 'equal_representation',
renderer: 'yesNoRenderer',
filter: { type: 'boolean' }
},*/
{
text: 'Library protocol',
dataIndex: 'protocol',
filter: {type: 'string'}
},
{
text: 'Loading Conc.',
Expand Down

0 comments on commit 80b0304

Please sign in to comment.