Skip to content

'dict_ref_structure' is not defined #63

@ScatF

Description

@ScatF

Hi,

I'm using human transcriptome ONT data and want to simulate reads. I first had the error message 'DivisionByZero' so I'm actually running with the 2.3-beta version of NanoSim. I reached the simulation stage and I ran into this error :

  File "/NanoSim/src/simulator.py", line 1198, in <module>
    main()
  File "/NanoSim/src/simulator.py", line 1192, in main
    simulation(args.mode, out, dna_type, perfect, kmer_bias, max_len, min_len, None, None, model_ir)
  File "/NanoSim/src/simulator.py", line 722, in simulation
    new_read, new_read_name = extract_read(dna_type, middle_ref)
  File "/NanoSim/src/simulator.py", line 772, in extract_read
    key = random.choice(seq_len.keys())
  File "/miniconda3/lib/python3.7/random.py", line 262, in choice
    return seq[i]
TypeError: 'dict_keys' object is not subscriptable 

I identify the problem : with Python 3.7, seq_len.keys() is an object and not a list. We can easily fix the problem by changing
key = random.choice(seq_len.keys())
into
key = random.choice(list(seq_len.keys()))

And now I get this error :

  File "./simulator.py", line 1198, in <module>
    main()
  File "./simulator.py", line 1192, in main
    simulation(args.mode, out, dna_type, perfect, kmer_bias, max_len, min_len, None, None, model_ir)
  File "./simulator.py", line 754, in simulation
    simulation_aligned_transcriptome(model_ir, out_reads, out_error, kmer_bias, per)
  File "./simulator.py", line 499, in simulation_aligned_transcriptome
    if ref_trx in dict_ref_structure:
NameError: name 'dict_ref_structure' is not defined

And I don't understand why. 'dict_ref_structure' is well defined before, in global and line 321.
Can you help me ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions