def get(self,request, format=None): channels=[] for channel in P.Channel().load(): channels.append(str(channel.name())) channelname = self.request.query_params.get('channelname', None) if channelname==None: Channels=[] else: if channelname in channels: channel = P.Channel(channelname) serializer = ChannelDetailSerializer(ChannelDetail(channel)) print serializer.data return Response(serializer.data)
def get(self, request, format=None): IonChannels = [] try: for channel in P.Channel().load(): IonChannels.append(IonChannel(name=str(channel.name()))) finally: print "done" serializer = IonChannelSerializer(IonChannels, many=True) return Response(serializer.data)
def Channels(request): P.connect() try: CHANNEL_DICT = {} for channel in P.Channel().load(): CHANNEL_DICT[str(channel)] = { 'name': str(channel), 'completeness': '#2B7558' } finally: P.disconnect() return render_to_response('pyopenworm/channels.html', {'channels': CHANNEL_DICT})
def Channel(request, channel_id): P.connect() try: channel_dict = {} for channel in P.Channel().load(): channel_dict[str(channel)] = { 'name': str(channel), 'completeness': '#2B7558' } finally: P.disconnect() return render_to_response('pyopenworm/channel.html', {'channel': channel_dict[channel_id]})
def scoring_ionchannels(self): print 'calculating ion channel completion scores' for ch in P.Channel().load(): channel = IonChannel(name=ch.name(), completion=randint(0, 5)) channel.save() print 'done'