Skip to content

Topic 4 assignment

davidaray edited this page Oct 20, 2024 · 2 revisions

Update the gc_content.py script to include the following functionalities:

  1. Use argparse to take in three values:
    • --gc_threshold: A GC content threshold.
    • --length_threshold: A length threshold.
    • --input_fasta: The name of the input FASTA file.
    • Do this using a function. Return the input values.
  2. Incorporate a GC_content function to calculate the GC content of sequences. Return the GC content.
  3. Incorporate a new function that calculates the length of each sequence. Return the length.
  4. Evaluate the GC content and length of each sequence.
  5. Sort sequences into three new files:
    • A file containing sequences with GC content and length lower than your GC and length thresholds.
    • A file containing sequences with GC content and length higher than your GC and length thresholds.
    • A file that contains sequences that do not match either of the two categories above.

Hints:

Be careful in your use of float, int, and str.

Consider using elif. https://www.w3schools.com/python/gloss_python_elif.asp

Clone this wiki locally