This is an old revision of the document!
Due date: 10/30/18 by 10 am
Write a function,
fasta_to_csv(input_file, output_file), that converts a fasta file, such as c_elegans_mirnas.fa to a comma separated file (csv) using regular expressions.
The function should accept the two arguments, input_file and output_file, from the command line and exit gracefully if the files can't be opened.
Input File >cel-let-7 TGAGGTAGTAGGTTGTATAGTT >cel-lin-4 TCCCTGAGACCTCAAGTGTGA >cel-miR-1 TGGAATGTAAAGAAGTATGTA
Output File cel-let-7,TGAGGTAGTAGGTTGTATAGTT cel-lin-4,TCCCTGAGACCTCAAGTGTGA cel-miR-1,TGGAATGTAAAGAAGTATGTA
Write a function
motif_finder(input_file, motif), that returns the number of times a sequence motif occurs in a sequence file, such as c_elegans_chrI.fa (note that the sequence is lowercase).
The function should allow for any number of Ns specified by the user to be present in the motif (e.g. TGANNNTCA) and should require the user to pass the input file name and motif to the function from the command line and exit gracefully if the file can't be opened.
The function should count motifs that span multiple lines.
Submit your assignment as a file upload on canvas.