Code implemented in python:
Note: Comments are written, minimal tests are performed to check if code is working
Code:
def read_one_seq_fasta(fasta_file):
seq=''
with open(fasta_file,'r') as f:
f.readline()
for line in f.readlines():
seq = seq + line[:-1]
return seq
def get_orf(seq):
'''this func finds orf when seq starts with ATG and ends in but
doesnt include stop codon'''
cod = -3 #started with - 3 to account for the early counter
change
while cod < len(seq):
cod +=3
codon = seq[cod:cod+3]
if codon in ['TGA','TAG','TAA']: #cuts off the stop codon from
final seq
return seq[:cod]
return(seq)
def one_frame(seq):
'''This func outputs a list of the orfs in inputted
sequence'''
nuc = -3 #started with -3 to account for early counter change
orf_list = [] #template for final list
while nuc < len(seq):
nuc += 3
if seq[nuc:nuc+3] == 'ATG':
orf_list.append(get_orf(seq[nuc:])) #calls get_orf when finds
'ATG'
nuc = nuc+len(get_orf(seq[nuc:])) #this length accounts for the
length of the orf and adds to origanl
return orf_list
def forward_frames(seq):
'''This func finds all the possible orfs in a sequence places them
all in one list'''
total_list = [] #created to be used as template for final
list
slic = 0
while slic < 3:
total_list.extend(one_frame(seq[slic:])) #used extend to have only
one list of all the orfs
slic += 1
return total_list
# copy and pasted this function from lab#5
def gc_content(seq):
'''This func returns the fraction of G and C in DNA'''
num_g = seq.count('G')
num_c = seq.count('C')
tot_gc = num_c + num_g
fract_gc = tot_gc / len(seq)
return fract_gc
def gene_finder(file_name, min_len, minGC):
'''this func takes all the orfs in a given file with the given
requirements'''
final_list = []
sal = open(file_name, 'r')
contents = sal.read()
orf = find_all_orfs(contents)
index = 0
for seq in orf: #for each sequence in that list
if (len(orf[index]) >= min_len) and (gc_content(orf[index])
>= minGC): #parameter requirments
one_list = [] #created to be added in the final list
one_list.append(seq)
one_list.append(len(seq))
one_list.append(gc_content(seq))
final_list.append(one_list)
#print(index)
index += 1
sal.close()
print(final_list)
print(gc_content('ATGTGAA'))
print(get_orf('ATGTGAA'))
print(forward_frames('ATGATGAGATGAACCATGGGGTAA'))
Code Screenshots:

![UIT 115L.dppenugel Ullsey UL. #DIIS gel UIT Wien TITUS AIG nuc = nuc+len(get_orf(seq[nuc:])) #this length accounts for the le](http://img.homeworklib.com/questions/2be10090-972f-11ea-bea7-b9ec4354e45e.png?x-oss-process=image/resize,w_560)
Code Output (Few tests):
0.2857142857142857
ATG
['ATGATGAGA', 'ATGGGG', 'ATGAACCATGGGGTAA']
Working code output screenshot:
![0.2857142857142857 ATG [ATGATGAGA, ATGGGG, ATGAACCATGGGGTAA ]](http://img.homeworklib.com/questions/2c4ec3e0-972f-11ea-a765-e909ab08b096.png?x-oss-process=image/resize,w_560)
If you like my answer, hit thumbs up . Thank you.
Roadmap To start, use the provided template file (on Blackboard): project_01_template.py. Replace the pass statements with...
Please develop a Java program to read in a piece of DNA sequence from a FASTA format sequence file (alternatively you can use the getRandomSeq(long) method of the RandomSeq class to generate a piece of DNA sequence), and then print out all the codons in three forward reading frames. Design a method called codon() that can be used to find all the codons from three reading frames. The method will take in an argument, the reading frame (1, 2, or...
python 2..fundamentals of python 1.Package Newton’s method for approximating square roots (Case Study 3.6) in a function named newton. This function expects the input number as an argument and returns the estimate of its square root. The script should also include a main function that allows the user to compute square roots of inputs until she presses the enter/return key. 2.Convert Newton’s method for approximating square roots in Project 1 to a recursive function named newton. (Hint: The estimate of...
Please Complete the following C Code with Comments explaining your solution and post a screenshot of it working. Summary: This project explores pattern matching techniques to find a pattern in a DNA sequence containing letters in the DNA alphabet {A, C, G, T}. For example, suppose we have a DNA sequence as follows: ATGACGATCTACGTATGGCAGCCACGCTTTTGATGTTAAGTCACACAGCCAAGTCA ACAAGGGCGACTTCATGATCTTTCCGCTCCGTTGGTGTAGGCCCGTGTTCAAATTC AATGGCTGATTGGAATTACCTTTGAAATACTCCAACCGACCGCCACGGCCAGGGT CCCGCTCGCTCTCTGTGGCCCTCCCACAAAACTCCGGTGAAAGTTGATTTGGACAC GGACCCAAAGCAGCGTAGATTATTCGAGCGTATTCGGTAGTCATTGAGGCCCCAA The pattern “AATGG” can be found at the beginning of the third line. Note that overlapping matches are counted individually. For example,...
In this problem, you should write one function named copy and increment. This function will have one parameter, which you can assume will be a list of integers. This function should return a copy of the parameter list, in which each number from the parameter list has been increased by 1. The function should not modify the values in the parameter list. For example, the code: values - 20, 40, 10, 60, 77, 2) other copy and incrementales) print values...
# DISCUSSION SECTION WORK: # # 1. STUDENTS: download this file, ds4.py, and wordsMany.txt, from # http://www.cs.uiowa.edu/~cremer/courses/cs1210/etc/ds4/ # Save both in the same folder. # # 2. TA (aloud) and STUDENTS: Read the comments from START HERE! (just after these instructions) # to definition of anagramInfo function. Discuss any questions about what the functions should do. # # 3. TA demonstrate running anagramInfo("wordsMany.txt") on this unchanged file, to # see that it behaves reasonably despite having incomplete anagram-testing functions. #...
I'm a bit confused on how to get this program to run right. Here are the directions: Part 1: Write a Python function called reduceWhitespace that is given a string line and returns the line with all extra whitespace characters between the words removed. For example, ‘This line has extra space characters ‘ ‘This line has extra space characters’ Function name: reduceWhitespace Number of parameters: one string line Return value: one string line The main file should handle the...
Copy the following Python fuction discussed in class into your file: from random import * def makeRandomList(size, bound): a = [] for i in range(size): a.append(randint(0, bound)) return a a. Rename the function sumList as meanList and modify it so that it finds the average of the list. The average is the sum divided by the size (len) of the list. Make sure that the function doesn't give you an error when it is called on an empty list. The...
+ Run C Code IMPORTANT: • Run the following code cell to create the input file, biostats.csv, which you will be using later. 74, In [ ]: N %%file biostats.csv Name, Sex, Age, Alex, M, 41, Bert, M, 42, Dave, M, 39, Elly, F, 30, Fran, F, 33, Jake, M, F, Luke, M, 34, F Myra, M, M, 38, Ruth, F, 28, 22 22 323 47 47, Height, Weight 170 200 167 70 115 143 139 280 98 75, 350...
C++: Translating mRNA sequence help
Homework Description Codon 1 You are working in a bioinformatics lab studying messenger RNA (mRNA) sequences. mRNA is a sequence of the nucleotide bases (Adenine, Cytosine, Guanine, and Uracil) that conveys information stored in DNA to Ribosomes for translation into proteins. The bases in the sequences are denoted by the first letters of the nucleotide bases (e.g. A, C, G, and U). A sequence of mRNA is made up of hundres to thousands of nucleotide...
2D Lists + File I/O In a comma-separated input file named results.txt, you have been given the following information that records the weekly (movie) box office sales for 5 movies. A sample input file will include the following. The movie’s title is listed first, then its sales (in million dollars) for 7 days are listed. Avengers,169.1,125.8,101.7,40.5,38.2,24.2,55.7 Shazam!,8.6,14.1,8.2,7.3,31.4,44.2,26.8 Breakthrough,14.8,16.1,18.0,18.9,19.8,21.8,24.6 The Best of Enemies,4.7,5.4,5.8,6.1,6.7,7.6,8.1 Dumbo,9.9,14.8,9.0,7.9,40.6,52.5,36.3 Write a complete Python program that includes code to do the following: read in the data from...