コード例 #1
0
ファイル: views.py プロジェクト: vasiliosz/puzzle
def phenotypes():
    """Add phenotype(s) to the case model."""
    ind_id = request.form['ind_id']
    phenotype_id = request.form['phenotype_id']

    if not phenotype_id:
        return abort(500, 'no phenotype_id submitted')

    ind_obj = app.db.individual(ind_id)
    terms_added = app.db.add_phenotype(ind_obj, phenotype_id)

    if len(terms_added) > 0:
        # update the HPO gene list for the case
        hpo_list = app.db.case_genelist(ind_obj.case)
        hpo_results = hpo_genes(ind_obj.case.phenotype_ids())

        if hpo_results is None:
            return abort(500, "couldn't link to genes, try again"
                              .format(phenotype_id))

        gene_ids = [result['gene_id'] for result in hpo_results
                    if result['gene_id']]
        hpo_list.gene_ids = gene_ids
        app.db.save()

    return redirect(request.referrer)
コード例 #2
0
ファイル: phenotype.py プロジェクト: robinandeer/puzzle
    def update_hpolist(self, case_obj):
        """Update the HPO gene list for a case based on current terms."""
        hpo_list = self.case_genelist(case_obj)
        hpo_results = hpo_genes(case_obj.phenotype_ids(),
                                *self.phenomizer_auth)

        if hpo_results is None:
            pass
            # Why raise here?
            # raise RuntimeError("couldn't link to genes, try again")
        else:
            gene_ids = [result['gene_id'] for result in hpo_results
                        if result['gene_id']]
            hpo_list.gene_ids = gene_ids
            self.save()
コード例 #3
0
ファイル: store.py プロジェクト: J35P312/PuzzleWin
    def update_hpolist(self, ind_id):
        """Update the HPO gene list for a case based on current terms."""
        ind_obj = self.individual(ind_id)
        # update the HPO gene list for the case
        hpo_list = self.case_genelist(ind_obj.case)
        hpo_results = hpo_genes(ind_obj.case.phenotype_ids())

        if hpo_results is None:
            pass
            #Why raise here?
            # raise RuntimeError("couldn't link to genes, try again")
        else:
            gene_ids = [result['gene_id'] for result in hpo_results
                        if result['gene_id']]
            hpo_list.gene_ids = gene_ids
            self.save()
コード例 #4
0
    def update_hpolist(self, case_obj):
        """Update the HPO gene list for a case based on current terms."""
        hpo_list = self.case_genelist(case_obj)
        hpo_results = hpo_genes(case_obj.phenotype_ids(),
                                *self.phenomizer_auth)

        if hpo_results is None:
            pass
            # Why raise here?
            # raise RuntimeError("couldn't link to genes, try again")
        else:
            gene_ids = [
                result['gene_id'] for result in hpo_results
                if result['gene_id']
            ]
            hpo_list.gene_ids = gene_ids
            self.save()