def to_match_representation(match, full=False): output = { "accession": match.protein_id, "coordinates": match.coordinates, "length": match.protein.length, "source_database": match.protein.source_database, "name": match.protein.name, } if full: output["protein"] = ProteinSerializer.to_metadata_representation(match.protein) return output
def to_chain_representation(instance, full=False): chain = { "chain": instance.chain, "accession": instance.protein.accession, "source_database": instance.protein.source_database, "length": instance.length, "organism": instance.organism, "coordinates": instance.coordinates, } if full: chain["protein"] = ProteinSerializer.to_metadata_representation(instance.protein) return chain