def parse_panel(csv_stream):
reader = csv.DictReader(csv_stream, delimiter='<STR_LIT:;>', quoting=csv.QUOTE_NONE)<EOL>genes = []<EOL>for gene_row in reader:<EOL><INDENT>if not gene_row['<STR_LIT>'].strip().isdigit():<EOL><INDENT>continue<EOL><DEDENT>transcripts_raw = gene_row.get('<STR_LIT>')<EOL>if transcripts_raw:<EOL><INDENT>transcripts_list = [tx.split('<STR_LIT::>', <NUM_LIT:1>)[-<NUM_LIT:1>].strip() for tx in transcripts_raw.split('<STR_LIT:U+002C>')]<EOL><DEDENT>else:<EOL><INDENT>transcripts_list = []<EOL><DEDENT>models_raw = gene_row.get('<STR_LIT>')<EOL>models_list = [model.strip() for model in models_raw.split('<STR_LIT:U+002C>')] if models_raw else []<EOL>panel_gene = dict(<EOL>symbol=gene_row['<STR_LIT>'].strip() if gene_row.get('<STR_LIT>') else None,<EOL>hgnc_id=int(gene_row['<STR_LIT>'].strip()),<EOL>disease_associated_transcripts=transcripts_list,<EOL>reduced_penetrance=True if gene_row.get('<STR_LIT>') else None,<EOL>mosaicism=True if gene_row.get('<STR_LIT>') else None,<EOL>inheritance_models=models_list,<EOL>database_entry_version=gene_row.get('<STR_LIT>'),<EOL>)<EOL>genes.append(panel_gene)<EOL><DEDENT>return genes<EOL>
Parse user submitted panel.