mhegde / base-editor-design-tool

This tool designs guides for use with the base editor technology.
10 stars 6 forks source link

'str' has no attribute 'iteritems' #3

Open gernophil opened 1 year ago

gernophil commented 1 year ago

For some ENST numbers and HGNC we run into the error AttributeError: 'str' object has no attribute 'iteritems' (whole error at the bottom). This happens because sometimes the edit_map becomes an empty string. I tried to follow the script, but I can't see where this happens, since the function get_edits always gets an empty dictfor edit_maps and just adds entries. I could dodge this error by adding the line if not isinstance(edit_map, str): between the lines 518 and 519. It works with this edit and get_snps should only return empty lists in this case, but I am not sure, if the results would still be correct. Do you see, why this happens and can you maybe evaluate, if my solution is reasonable?

Traceback (most recent call last):
  File "base_editing_guide_designs.py", line 1211, in <module>
    val = design_sgrnas(gene_name, assembly, chromosome, gene_id, w, tr_seq, abs_pos_map, fs, cds_map, utr, tr, pam, exons, gene_strand, edit_1, window, cds_sequence, len(pam), sg_len, cds_start_exon, w_error, w_clin, gene_variant_df, aa_map, input_type, intron_buffer, filter_gc)
  File "base_editing_guide_designs.py", line 1009, in design_sgrnas
    edit_map, window_silent, cds_error, num_stop, clinical_sig, snp_info, transcript_ref_allele, transcript_alt_allele, genome_ref_allele, genome_alt_allele = get_edit_info(context_for_trans, sgrna, sgrna_strand, edit, window, pam, sgrna_trans, codon_map, sg_gen_pos, gene_strand, gene_variant_df, aa_map, filter_gc, sgrna_context)
  File "base_editing_guide_designs.py", line 791, in get_edit_info
    snp_type_list, snp_info = get_snps(edit_map, edit, sg_gen_pos, gene_strand, sgrna_strand, gene_variant_df, aa_map)
  File "base_editing_guide_designs.py", line 519, in get_snps
    for k,v in edit_map.iteritems():
AttributeError: 'str' object has no attribute 'iteritems'
mhegde commented 1 year ago

That sounds like it could work.