Esempio n. 1
0
def isotype_page(isotype_name):
    page_title = isotype_name
    page_type = "isotype"
    obj = isotype_name
    rec = list(strain.filter(strain.isotype == isotype_name)
                .order_by(strain.latitude).dicts().execute())
    ref_strain = [x for x in rec if x["reference_strain"] == True][0]
    strain_json_output = json.dumps([x for x in rec if x["latitude"] != None],  default=json_serial)
    return render_template('strain.html', **locals())
Esempio n. 2
0
def resolve_strain_isotype(q):
    try:
        return strain.get(strain.strain == q)
    except:
        try:
            return strain.get(strain.isotype == q)
        except:
            strain_name = list(
                strain.filter(
                    (strain.previous_names.regexp("^(" + q + ")\|"))
                    | (strain.previous_names.regexp("\|(" + q + ")$"))
                    | (strain.previous_names.regexp("\|(" + q + ")\|"))
                    | (strain.previous_names == q)
                ).execute()
            )
            if len(strain_name) > 0:
                return strain_name[0]
            else:
                return None