Question

There is a file lets call it the.faa. It contains all of the polypeptide coding sequences...

There is a file lets call it the.faa.

It contains all of the polypeptide coding sequences in the E. coli K12 genome in FASTA format.

Your task for this exercise is to generate an amino acid usage report with counts only, and in no particular order. Your output should look like this:

T: 69645

G: 95475

V: 91683

Y: 36836

H: 29255

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

*** Source Code ***

with open("the.faa") as ecoli: # will close your file automatically

                from collections import defaultdict

                counts = defaultdict(int)

                for line in ecoli: # iterate over file object, no need to read all contents into memory

                                if line.startswith(">"): # skip lines that start with >

                                                continue

                                for char in line: # just iterate over the characters in the line

                                                if char in {"A", "C", "D", "E", "F", "G", "H", "I", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "Y"}:

                                                                counts[char] += 1

                total = float(sum(counts.values()))      

                for key,val in counts.items():

                                print("{}: {}".format(key,val))    

*** Output ***              

(Note : Test it with yout the.faa file. Mine is for testing)

L: 2540 Y: 657 T 1222 K: 1048 : 1295 : 881 I: 1447 E: 1443 H 568 P: 1084 P:1001 W: 386 M: 722 S: 1248 G: 1904 A: 2424 V: 1686

Add a comment
Know the answer?
Add Answer to:
There is a file lets call it the.faa. It contains all of the polypeptide coding sequences...
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
  • The following should be done in a python code editor and should run on your computer's...

    The following should be done in a python code editor and should run on your computer's terminal. 1. Your task for this exercise is to generate an amino acid usage report with counts only, and in no particular order. Do this by opening the file below, stripping the lines without amino acid text, and using a dictionary to store each of the 21 amino acids used along with their count as the value. Your output should look like this: T:...

  • In python Attached is a file called sequences.txt, it contains 3 sequences (one sequence per line)....

    In python Attached is a file called sequences.txt, it contains 3 sequences (one sequence per line). Also attached is a file called AccessionNumbers.txt. Write a program that reads in those files and produces 3 separate FATSA files. Each accession number in the AccessionNumbers.txt file corresponds to a sequence in the sequences.txt file. Remember a FASTA formatted sequence looks like this: >ABCD1234 ATGCTTTACGTCTACTGTCGTATGCTTTACGTCTACTGACTGTCGTATGCTTACGTCTACTGTCG The file name should match the accession numbers, so for 1st one it should be called ABCD1234.txt. Note:...

  • Please answer all.... Thank you! 81)If a polypeptide chain contains 600 amino acids, then the gene...

    Please answer all.... Thank you! 81)If a polypeptide chain contains 600 amino acids, then the gene coding for this polypeptide must contain _____. 600 nucleotides 1200 nucleotides 1800 nucleotides 1800 codons 1800 anticodons More than one of the above are correct. 82) When we altered gene triplet in the DNA produces a chain-terminating codon in the mRNA, the (1pts) result is called a reverse mutation nonsense mutation missense mutation spontaneous mutation frameshift mutation 83) A single base substitution changes the...

  • in Python Objective: Practice Displaying Output with print Function, Comments, Variable, Reading Input from the Keyboard,...

    in Python Objective: Practice Displaying Output with print Function, Comments, Variable, Reading Input from the Keyboard, format output, if statement, if-else statement, loop structure. import, functions, file handling. and string methods. Lab Description: You are given a file containing protein sequences with the task of finding motifs. Motifs are certain patterns of amino acids that appear many times in protein sequences that act as indictors or markers for special regions, genes, mutations, etc. An example of what this file will...

  • Using c++ Write a function named coinToss that simulates tossing a coin. When you call the...

    Using c++ Write a function named coinToss that simulates tossing a coin. When you call the function it should generate and return a random number in the range 1 through 2. 1 represents heads and 2 represents tails. Exercise 1 (40 points) Write a function named coinToss that simulates tossing a coin. When you call the function it should generate and return a random number in the range 1 through 2.1 represents heads and 2 represents tails Use the function...

  • Write a program that will first receive as input the name of an input file and an output file. It will then read in a list of names, id #s, and balances from the input file specified (call it InFile.t...

    Write a program that will first receive as input the name of an input file and an output file. It will then read in a list of names, id #s, and balances from the input file specified (call it InFile.txt) which you will create from the data provided below. The program will then prompt the user for a name to search for, when it finds the name it will output to a file (call it OFile.txt) the person’s id#, name,...

  • C language huffman This exercise will familiarize you with linked lists, which you will need for...

    C language huffman This exercise will familiarize you with linked lists, which you will need for a subsequent programming Getting Started assignment Overview Requirements Getting Started Submit Start by getting the files. Type 264get hw13 and then cd hw13 from bash. Pre-tester You will get the following files: Q&A Updates 1. huffman.h: An empty header file, you have to define your own functions in this homework. 2. huffman.c: An empty c file, you have to define your own functions in...

  • C++ code The assignment has two input files: • LSStandard.txt • LSTest.txt The LSStandard.txt file contains...

    C++ code The assignment has two input files: • LSStandard.txt • LSTest.txt The LSStandard.txt file contains integer values against which we are searching. There will be no more than 100 of these. The LSTest.txt file contains a set of numbers that we are trying to locate within the standard data set. There will be no more than 50 of these. Read both files into two separate arrays. Your program should then close both input files. All subsequent processing will be...

  • Objective: Text File I/0 and Regular Expressions Note that both classes below should handle all exceptions...

    Objective: Text File I/0 and Regular Expressions Note that both classes below should handle all exceptions that might be thrown within them. 1. Create a class that does the following: a. Reads the name of a file to create as the first command line argument. (Overwrite any file with the same name). b. Reads an integer value as the second command line argument. C. The program should generate as many random numbers as are specified in the second command line...

  • The following code uses a Scanner object to read a text file called dogYears.txt. Notice that...

    The following code uses a Scanner object to read a text file called dogYears.txt. Notice that each line of this file contains a dog's name followed by an age. The program then outputs this data to the console. The output looks like this: Tippy 2 Rex 7 Desdemona 5 1. Your task is to use the Scanner methods that will initialize the variables name1, name2, name3, age1, age2, age3 so that the execution of the three println statements below will...

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