NameError name genomic dna 4 is not defined

0 votes

I use python for biology and I got an error and I'm not sure why, even though I have the (genomic_dna_4.txt) file in the directory, also in cell2, the function "genom_coding" isn't in blue like it should be, can someone check on the code?

Cell1 :

def genom_coding(seq_filename, coding_seq_filename):
    with open(seq_filename, 'r') as file:
        sequence = ''
        for sequence in file:
            exon1 = sequence[4:58]
            exon2 = sequence[71:133]
            exon3 = sequence[189:276]
            exon4 = sequence[339:398]
    with open(coding_seq_filename, 'w') as out_file:
                print(exon1 + exon2 + exon3 + exon4 , file=file) 

Cell2 :

genom_coding(genomic_dna_4.txt, genomic_dna_4_coding.txt)

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-53-be2ad7077d60> in <module>
----> 1 genom_coding (genomic_dna_4.txt, genomic_dna_4_coding.txt)

NameError: name 'genomic_dna_4' is not defined






Nov 10, 2020 in Python by skylar
• 120 points
1,263 views

Hey, @Skylar,

Which python version are you working with?

I work with Python 3.8

I suggest you should try to execute the code with python version 3, as generally, we get this error because of version based.

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
2 answers

NameError: name 'raw_input' is not defined

Hi, There may a problem with your python ...READ MORE

answered Jun 25, 2020 in Python by MD
• 95,460 points
32,670 views
0 votes
1 answer

Python argparse error "NameError: name 'file' is not defined"

The right datatype for destination in argpasrse module ...READ MORE

answered Nov 28, 2018 in Python by Omkar
• 69,220 points
13,707 views
0 votes
3 answers

Python error "NameError: name 'sr' is not defined"

NameError: name 'xx' is not defined Python knows ...READ MORE

answered Mar 19, 2020 in Python by rahul
• 360 points
42,578 views
0 votes
1 answer

Python error "Python NameError: global name 'Thread' is not defined"

There is a built-in function with the ...READ MORE

answered May 31, 2019 in Python by Riya
7,301 views
–1 vote
1 answer

Python error saying "NameError: name 'email' is not defined"

you need to define the variable email READ MORE

answered Nov 29, 2019 in Python by Casper
• 160 points
6,836 views
0 votes
1 answer

Python Error saying "NameError: global name 'true' is not defined"

It's a very small mistake. Change true ...READ MORE

answered Jun 17, 2019 in Python by Vinayak

edited Oct 7, 2021 by Sarfaraz 16,195 views
0 votes
1 answer

i write this python to read dataset into panda data frame but im getting NameError: name 'true' is not defined. Below is the code:

change  def parse(path):   g = gz ...READ MORE

answered Mar 15, 2020 in Python by Abhishek Shingadiya
3,661 views
0 votes
1 answer

Input() error - NameError: name '…' is not defined

Hello @kartik, You should use raw_input if you are ...READ MORE

answered May 5, 2020 in Python by Niroj
• 82,840 points
23,153 views
0 votes
0 answers

What does NameError: name 'withdrawal' is not defined mean ?

READ MORE

Jun 6, 2020 in Python by Shanice
• 120 points

recategorized Jun 8, 2020 by Gitika 891 views
0 votes
1 answer

Error:Python NameError: name 'include' is not defined

Hello @kartik, On the basis of your information provided ...READ MORE

answered Jul 1, 2020 in Python by Niroj
• 82,840 points
9,524 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP