def step_impl(context): mapper = LeaderMapper() match = HlaBGenotypeMatch(context.genotype_patient, context.genotypes_donors) match_status_info = mapper.get_match_status_info(match) context.match_statuses = ",".join( [subj["leader_match_status"] for subj in match_status_info])
def step_impl(context): mapper = LeaderMapper() match = HlaBGenotypeMatch(context.genotype_patient, context.genotypes_donors) match_status_info = mapper.get_match_status_info(match) context.rank_list = ",".join( [str(subj["rank"]) for subj in match_status_info])
def get(self, hla_genotype_input): """ returns leader-peptide allotype(s) of HLA-B allele(s) """ try: hla_genotypes = [geno.strip() for geno in list(set(hla_genotype_input.split(',')))] results = [] mapper = LeaderMapper() for hla_genotype in hla_genotypes: results.append(mapper.get_leader_genotype_info(hla_genotype)) return jsonify(results) except Exception as e: return e.__dict__, 500
def post(self): """ returns leader-peptide allotype(s) of HLA-B allele(s)log fie """ try: hla_allotype_input = request.json['allele'] hla_allotypes = [allo.strip() for allo in list(set(hla_allotype_input.split(',')))] results = [] mapper = LeaderMapper() for hla_allotype in hla_allotypes: results.append(mapper.get_leader_allotype_info(hla_allotype)) return jsonify(results) except Exception as e: return e.__dict__, 500
def step_impl(context): mapper = LeaderMapper() leader_info = mapper.get_leader_allotype_info(context.allotype) context.leader_allotype = leader_info['common_leader'] known = leader_info['known'] or [] context.known = (", ".join(known[0:3]) or "None") context.exceptions = (leader_info['exceptions'] and ", ".join( [str(allotype) for allotype in leader_info['exceptions']]) or "None") context.unknowns = (leader_info['unknowns'] and ", ".join( [str(allotype) for allotype in leader_info['unknowns'][:3]]) or "None")
def step_impl(context): mapper = LeaderMapper() leader_info = mapper.get_leader_allotype_info(context.allotype) context.leader_allotype = leader_info["common_leader"] known = leader_info["known"] or [] context.known = ", ".join(known[0:3]) or "None" context.exceptions = ( leader_info["exceptions"] and ", ".join([str(allotype) for allotype in leader_info["exceptions"]]) or "None" ) context.unknowns = ( leader_info["unknowns"] and ", ".join([str(allotype) for allotype in leader_info["unknowns"][:3]]) or "None" )
def post(self): """ returns leader match status of single HLA-B-mismatched transplants sorted via a three-letter nomenclature: (1) non-shared patient's mismatch, (2) non-shared donor's mismatch, (3) shared allotype. """ try: patient = request.json['hla-b_genotype_patient'] donors = request.json['hla-b_genotype_donors'] match = HlaBGenotypeMatch(HlaBGenotype(patient['genotype'], id=patient['id']), [HlaBGenotype(donor['genotype'], id=donor['id']) for donor in donors]) results = LeaderMapper().get_match_status_info(match) return jsonify(results) except Exception as e: return e.__dict__, 500
def step_impl(context): mapper = LeaderMapper() leader_info = mapper.get_leader_genotype_info(context.genotype) context.leader_genotype = str( leader_info["hla-b_allotype_one"]["common_leader"]) + str( leader_info["hla-b_allotype_two"]["common_leader"])
def get(self): """ returns dictionary of HLA-B allotypes and corresponding leader types. """ return jsonify(LeaderMapper().get_map())
def step_impl(context): mapper = LeaderMapper() match_status_info = mapper.get_match_status_info(context.genotype_match)[0] context.match_status = match_status_info["leader_match_status"] or "invalid"