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...

  • 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...

  • 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...

  • Write a python program and pseudocode The Program Using Windows Notepad (or similar program), create a...

    Write a python program and pseudocode The Program Using Windows Notepad (or similar program), create a file called Numbers.txt in your the same folder as your Python program. This file should contain a list on floating point numbers, one on each line. The number should be greater than zero but less than one million. Your program should read the following and display: The number of numbers in the file (i.e. count them) (counter) The maximum number in the file (maximum)...

  • Write a python program that prompts the user for the names of two text files and...

    Write a python program that prompts the user for the names of two text files and compare the contents of the two files to see if they are the same. If they are, the scripts should simply output “Yes”. If they are not, the program should output “No”, followed by the first lines of each file that differ from each other. The input loop should read and compare lines from each file. The loop should break as soon as a...

  • Write a C++ program that creates a ragged table (i.e. a table with rows of different...

    Write a C++ program that creates a ragged table (i.e. a table with rows of different length) using a vector of vector of integers. Your program should prompt the user for a file name, open the file, read the content of the file and store it in a vector or vectors, and finally print the content of the vector of vectors. Sample Input: Enter the file name: data.dat A sample file might contain: 6 5 2 4 5 3 2...

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
ADVERTISEMENT