Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

BIOL4292: Assignment 1

Specifcation for Assignment 1

his, the second task in a portfolio of three assesses the following programming fundamentals:

●  String comparisons

●  Flow control

  Simple and Nested Looping

  File I/O

●  Complex objects besides lists

  Functions

  Exceptions

  Object-based Programming

When implementing this specifcation, make sure that the only output generated by your program is the output you have been asked to generate. When completing this assignment, you cannot use any libraries to complete the task, other than the standard libraries included with Python itself. Your attention is drawn to the University regulations on plagiarism. In particular, you cannot use any code written by anybody else, or any code you have submitted yourself for an assignment. Your code will be checked against everyone else’s code and other code sources.

Your task is to write a Python program that implements a FASTQ parser that does the following:

Open a series of FASTQ fles given on the command line. here should be an option called --quality_filter that takes a number, whose usage will be explained later. he format of the command line should be like this exactly note that there may be many FASTQ fles, indicated by ...:

python  <program> .py  file1 .fastq file2 .fastq  . . .  --quality_filter=45

he option –quality_filter may be anywhere afer <program .py>, and the number does not have to be 45; it may be any number.

Make sure <program> is given as your GUID. Make sure your command line is as specifed you will lose marks if it is not. For each FASTQ fle:

  Create an object from a class representing that fle

  For each FASTQ sequence in the fle

  Create an object from a class representing that sequence. he object should store all the important information from the FASTQ entry. Store the sequence object in the fle object.

  Print out the following information on a single line, separated by spaces:

*  he name of fle

*  he FASTQ identifer

*  he number of missing bases

*  he percentage GC content (without the % sign)

●  Output a FASTA fle corresponding to the FASTQ fle. he name of the FASTA fle should be the same as the FASTQ fle, except the extension should be .fasta. he sequences in the FASTA fle should be those sequences in the FASTQ fle that have an average (arithmetic mean) quality that is greater than the number given by --quality_filter. he identifer of a FASTA sequence should be the identifer from the FASTQ sequence.

Make sure your code works correctly if bad input (e.g. bad FASTQ fles are used). If a single FASTQ entry is bad, instead of outputing the entry to the FASTA fle and instead of printing out the information above, the entry should be discarded and the following information should be printed on a single line, separated by spaces:

  he name of the fle

  he FASTQ identifer if available

  A message saying specifcally what is wrong

You should continue parsing the fle from the next entry (i.e. the next id line beginning with @).

Remember to write good code” in the sense of what was discussed in Lecture 3. he code should be correct, efcient and maintainable, with descriptive variables, consistent formatting, good spacing and useful comments. Because you are using object based programming, you should think about how you will implement your code in terms of the object i.e. you should let the object do computation on the data it is storing. Do not directly access attributes from outside the class. You should also break down your code into small self contained methods and functions and try not to put all you code into one block.

Addendum  FASTQ format

here are FASTQ fles that have slightly diferent formats. Here is the format of the fles that you will need to parse, taken from

Wikipedia.

A FASTQ fle uses four lines per sequence. A fle can have multiple sequences, each in a block of four lines. hese are the only lines in the fle.

Line 1  begins with a @’ character and is followed by a sequence identifer and an optional description (like a FASTA title line).

Line 2  is the raw sequence letters, A, G, C, T and N (for a missing call). he letters can be upper- or lowercase.

Line 3  begins with a +’ character and is optionally followed by the same sequence identifer (and any description) again.

Line 4  encodes the quality values for the sequence in Line 2, and must contain the same number of symbols as letters in the sequence.

he byte representing quality runs from 0x21 (lowest quality; ’!’ in ASCII) to 0x7e (highest quality; ’~’ in ASCII).

Here are the quality value characters in lef-to-right increasing order of quality (ASCII):                                                                   !"#$%&’()*+,- ./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ ‘abcdefghijklmnopqrstuvwxyz{|}~

Addendum  FASTA format

FASTA format is the basic format. A fle can have multiple sequences, each in a block of two lines. hese are the only lines in the fle.

Line 1  begins with a >’ character and is followed by a sequence identifer and an optional description.

Line 2  is the raw sequence letters.