# Open the Motifs file - Give the correct file name for Motifs here.
motiffile=open("C:\Tmp\Motifs.txt","r")
#list to store the motifs file pointers
motiflist=[]
#list to store the motifs names
motifnames=[]
#list to store counts of each motif
motifcounts=[]
#read motifs file
for motif in motiffile:
motif=motif.rstrip("\n")
if (motif and motif.strip()):
## change path as you wish
fname="C:\Tmp\motif"+motif.rstrip("\n")+".txt"
motiflist.append(open(fname,"w+"))
motifnames.append(motif)
# close the motiflist file now
motiffile.close()
motifcounts=[0]*len(motifnames)
# Read the sequence file
seqfile = open("/nfshome/raltobasei/public_html/1170/public/human_aa_chr2_partial.txt","r")
# for each line check if the pattern matches the motif
for line in seqfile:
line=line.rstrip("\n")
if line.startswith(">"):
seqline=line
continue
else:
i=0
for motif in motifnames:
pos=line.find(motif)
# if motif is found then write sequences and the line
j=motifcounts[i]
if (pos!=-1):
nline = line[0:pos - 1] + " " + motif + " " + line[pos + len(motif):]
fname = motiflist[i];
fname.write(seqline + "\n")
fname.write(nline+"\n")
j=j+1
motifcounts[i] = j # update counts
i=i+1
## write counts to files
k=0
for motiffile in motiflist:
motiffile.write("# of motifs for " + motifnames[k] +" :" + str(motifcounts[k]))
k=k+1
motiffile.close()
## close the sequential file
seqfile.close()
in Python Objective: Practice Displaying Output with print Function, Comments, Variable, Reading Input from the Keyboard,...
Write a Python program that converts an input file in FASTA format, called "fasta.txt", to an output file in PHYLIP format called "phylip.txt". For example, if the input file contains: >human ACCGTTATAC CGATCTCGCA >chimp ACGGTTATAC CGTACGATCG >monkey ACCTCTATAC CGATCGATCC >gorilla ATCTATATAC CGATCGATCG Then the output file should be human ACCGTTATACCGATCTCGCA chimp ACGGTTATACCGTACGATCG monkey ACCTCTATACCGATCGATCC gorilla ATCTATATACCGATCGATCG FASTA format has a description (indicated with a '>') followed by 1 or more lines of a DNA sequence. PHYLIP format has a description...
USE Python 2.7(screen shot code with indentation and output exactly in the question) the task is: takes in a list of protein sequences as input and finds all the transmembrane domains and returns them in a list for each sequence in the list with given nonpolar regions and returns the lists for those. 1. This code should call two other functions that you write: regionProteinFind takes in a protein sequence and should return a list of 10 amino acid windows,...
C++ Programming help, please include comments to help me understand the code. Thank you for helping. Task C: Substitution and Hamming Distance For this task, we will explore mutations that occur by substitution. Your task is to write a program called hamming.cpp that calculates the Hamming distance between two strings. Given two strings of equal length, the Hamming distance is the number of positions at which the two strings differ. e. g.: Hamming("aactgc", "atcaga") would output 3. Notice that certain...
Write a function template that receives a priority queue and an
output stream as parameters.
Lab 48 Due Date: See Blackboard Source File: /2336/48/1ab48.cpp Input: Output:under control of main function Waol under control of main function Write a function template that receives a priority queue and an output stream as parameters. The function determines the distribution of the elements in the priority queue; that is, the function counts the number of occurrences of each element. The format of the output...
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...
C++ Write a function parseScores which takes a single input argument, a file name, as a string. Your function should read each line from the given filename, parse and process the data, and print the required information. Your function should return the number of student entries read from the file. Empty lines do not count as entries, and should be ignored. If the input file cannot be opened, return -1 and do not print anything. Your function should be named...
using c 3 File Input & Data Processing Reading data from a file is often done in order to process and aggregate it to get ad- ditional results. In this activity you will read in data from a file containing win/loss data from the 2011 Major League Baseball season. Specifically, the file data/mlb_nl_2011.txt contains data about each National League team. Each line contains a team name fol- lowed by the number of wins and number of losses during the 2011...
Write a program, called wordcount.c, that reads one word at a time from the standard input. It keeps track of the words read and the number of occurrences of each word. When it encounters the end of input, it prints the most frequently occurring word and its count. The following screenshot shows the program in action: adminuser@adminuser-VirtualBox~/Desktop/HW8 $ wordCount This is a sample. Is is most frequent, although punctuation and capitals are treated as part of the word. this is...
10. Write a one-page summary of the attached paper? INTRODUCTION Many problems can develop in activated sludge operation that adversely affect effluent quality with origins in the engineering, hydraulic and microbiological components of the process. The real "heart" of the activated sludge system is the development and maintenance of a mixed microbial culture (activated sludge) that treats wastewater and which can be managed. One definition of a wastewater treatment plant operator is a "bug farmer", one who controls the aeration...