def get_protein_and_manager(self, refseq, **kwargs): protein = Protein.query.filter_by(refseq=refseq).first_or_404() if kwargs: user_datasets = current_user.datasets_names_by_uri() filter_manager = self.filter_class( protein, custom_datasets_ids=user_datasets.keys(), **kwargs) else: filter_manager = self.filter_manager return protein, filter_manager
def before_request(self, name, *args, **kwargs): user_datasets = current_user.datasets_names_by_uri() refseq = kwargs.get('refseq', None) protein = (Protein.query.filter_by( refseq=refseq).first_or_404() if refseq else None) filter_manager = self.filter_class( protein, custom_datasets_ids=user_datasets.keys()) flask.g.filter_manager = filter_manager endpoint = self.build_route_name(name) return filter_manager.reformat_request_url(request, endpoint, *args, **kwargs)
def show(self, refseq, predicted_interactions=False): """Show a protein network visualisation""" protein, filter_manager = self.get_protein_and_manager(refseq) user_datasets = current_user.datasets_names_by_uri() return template( 'network/show.html', protein=protein, filters=filter_manager, option_widgets=self._create_option_widgets(filter_manager), widgets=create_widgets( protein, filter_manager.filters, custom_datasets_names=user_datasets.values()), mutation_types=Mutation.types, predicted_interactions=predicted_interactions)
def show(self, refseq): """Show a protein by: + needleplot + tracks (sequence + data tracks) """ protein, filter_manager = self.get_protein_and_manager(refseq) user_datasets = current_user.datasets_names_by_uri() return template( 'protein/show.html', protein=protein, filters=filter_manager, widgets=create_widgets( protein, filter_manager.filters, custom_datasets_names=user_datasets.values()), site_types=['multi_ptm'] + SiteType.available_types(), mutation_types=Mutation.types, )