Question

python Write a program that calculates the AT and GC content (i.e. the percentage of G...

python Write a program that calculates the AT and GC content (i.e. the percentage of G and C, and the percentage of A and T) in a given sequence. You can make up your own dummy sequence and store it in text file (use something like Notepad, not word!). Your program should read in the sequence from the file and calculate the GC and AT content. Print out the results to a file called DNA_Statistics.txt, the result should look something like this: The GC content of the DNA sequence given is: 48.5% The AT content of the DNA sequence given is: 51.5%

0 0
Add a comment Improve this question Transcribed image text
Answer #1

DNA has 2 base pairs they are:

1)AT-Adenine-Thymine

2)GC-Guanine-Cytosine

Adenine percentage is equal to Thymine percentage

if AT is 30 percent.15 percent is Adenine and 15 percent is Thymine is found

likethat

if GC is 70 percent.35 percent Guanine and 35 percent is Cytosine is found.

so based on this logic code will be written.

#source code:

menu py dummy bxt DNA Statics bxt newk py f-open (dummy.txt,r) sequence_string-f.read () f.close ( AT_count-sequence_stri#source code in plain text:

f=open("dummy.txt","r")
sequence_string=f.read()
f.close()
AT_count=sequence_string.count("AT")
GC_count=sequence_string.count("GC")
Total=AT_count+GC_count
GC=round(GC_count/Total*100,2)
AT=round(AT_count/Total*100,2)
f1=open("DNA_Statics.txt","w")
f1.write("The GC content of the DNA sequence given is:"+str(GC)+"%"+"\nThe AT content of the DNA sequence given is:"+str(AT)+"%")
f1.close()

#dummy.txt file

menu py dummy txt newk.py DNA Statics.bdx ATGCATATGCATGCATGCATATGCATATGCATGCATATGCATATGCATGCATGCATGCATGCATATGCATGCATGCATATGCA

#dummy.txt file in plain text

ATGCATATGCATGCATGCATATGCATATGCATGCATATGCATATGCATGCATGCATGCATGCATATGCATGCATGCATATGCATATGCATGCATATGCATGCATGCATATGCATGCATATATGCAT

#output:

DNA Statics txt menu.py dummy txt newk.pyX 1 The GC content of the DNA sequence given is:39.68% The AT content of the DNA seq

#output DNA_Statics.txt:

The GC content of the DNA sequence given is:39.68%
The AT content of the DNA sequence given is:60.32%

#if you have any doubt comment below...

Add a comment
Know the answer?
Add Answer to:
python Write a program that calculates the AT and GC content (i.e. the percentage of G...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a Python program to read lines of text from a file. For each word (i.e,...

    Write a Python program to read lines of text from a file. For each word (i.e, a group of characters separated by one or more whitespace characters), keep track of how many times that word appears in the file. In the end, print out the top twenty counts and the corresponding words for each count. Print each value and the corresponding words, in alphabetical order, on one line. Print this in reverse sorted order by word count. You can assume...

  • IN PYTHON 3: Write a Python program to read the attached text file containing words, count...

    IN PYTHON 3: Write a Python program to read the attached text file containing words, count the occurrence of each unique word and store the words in alphabetical order in a text file listing the word and the total count of that word. You cannot use any advanced features such as dictionaries. The program requires user input to determine the name of the file. (example of the text file that needs to be read = for a brief moment I...

  • Write a simple python program to crawl 10 pages from the web and store the text...

    Write a simple python program to crawl 10 pages from the web and store the text content in the pages into csv file. You code, the 10 html pages, and the csv file which store the content in the pages should be submitted. Tips: you can write your own program by referencing this tutorial: https://codeburst.io/scraper-b82146396249 Tips2: (1) If you use python2 on your computer, you can use the following code to get web pages: import urllib2 page = urllib2.urlopen('https://www.pythonforbeginners.com/') print...

  • Write a python program: using class named Example. it will accept a name, the content of...

    Write a python program: using class named Example. it will accept a name, the content of the file. we will use few functions to return the name of the file, owner, set date (time it was created the file), we can also add a line and delete a line from the file. another function that returns all the data in the file. and one that deletes any previous and sets any new data user enters. we can do like Test="a","this...

  • Part 1. Write a program that takes a string as input, strips whitespace and punctuation from...

    Part 1. Write a program that takes a string as input, strips whitespace and punctuation from the words, and converts them to lowercase. Hint: The string module provides strings named whitespace, which contains space, tab, newline, etc., and punctuation which contains the punctuation characters. Let’s see if we can make Python swear: >>> import string >>> print string.punctuation !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ Also, you might consider using the string methods strip, replace and translate (Chapter 2 of "Introducing Python" is a great reference...

  • USING PYTHON PLEASE Write a program that calculates the factorial value of a number entered by...

    USING PYTHON PLEASE Write a program that calculates the factorial value of a number entered by the user. Remember that x! =x* (x-1)* (x-2)*... *3+ 2* 1. Your program should check the value input by the user to ensure it is valid (i.e., that it is a number > =1). To do this, consider looking at the is digit() function available in Python. If the user enters an incorrect input, your program should continue to ask them to enter a...

  • Python Simple Programming Write a program in Python that calculates the tip and total for a...

    Python Simple Programming Write a program in Python that calculates the tip and total for a meal at a restaurant. When your program is run it should ... Calculate the tip and total for a meal for a restaurant Print the name of the application "Tip Calculator" Get input from the user for cost of meal and tip percent Print the tip and total amounts. The formula for calculating the tip amount is: tip = cost of meal * (tip...

  • Python Programming 4th Edition Write a program that calculates the length of a right triangle's hypotenuse....

    Python Programming 4th Edition Write a program that calculates the length of a right triangle's hypotenuse. Hints: Define main() program Get the length of the triangle’s two sides (user input) Call math function to calculate the length of the hypotenuse. The output should look like as follows: The length of the hypotenuse is 12.041594578792296

  • In a sensible language ( any of C#/Java/Python) write a program which correctly calculates add, subtract,...

    In a sensible language ( any of C#/Java/Python) write a program which correctly calculates add, subtract, multiply and divide using our ‘minifloat’ binary format using an algorithm you code yourself.  Some details: Your program only needs to work on two ‘numbers’ at a time, read those in from a text file – failure to read those values from a text file will result in a grade of 0.   For each ‘number’ store the sign, exponent and mantissa separately.   You can hard code your...

  • Write a program IN PYTHON that checks the spelling of all words in a file. It...

    Write a program IN PYTHON that checks the spelling of all words in a file. It should read each word of a file and check whether it is contained in a word list. A word list available below, called words.txt. The program should print out all words that it cannot find in the word list. Requirements Your program should implement the follow functions: main() The main function should prompt the user for a path to the dictionary file and a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT