- 1 Read the file
- 2 Clean and validate
- 3 Filter by length
- 4 Trim adapters
- 5 Quality check a FASTQ file
Filter by length
THE BRIEF
Very short sequences rarely carry enough information to be useful, and many analyses set a minimum length.
Your task. The first line of the input is a whole number, the minimum length. The rest of the input is a FASTA file. Clean each sequence as in the previous stage (uppercase, whitespace removed), then print the ids of the records whose sequence length is at least the minimum, one per line, in their original order. If no record qualifies, print NONE.
Input. A minimum length, then a FASTA file.
Output. The qualifying ids, one per line, or NONE.
GIVEN INPUT
Your code reads this from standard input (input() or sys.stdin), both here and when it is graded.
8 >short ACGT >exact ACGTACGT >long ACGTACGTACGTACGT >spaced ACG TAC GT
EXPECTED OUTPUT FOR THIS INPUT
exact long spaced
SKILLS YOU'LL USE
Stuck? These bank problems practise the same techniques.
Write your code
Check your understanding
A quick self-check, marked right here in your browser. It is not graded or saved.
Why do pipelines usually discard very short sequences?
A minimum length keeps the data meaningful and the analysis reliable.
A record's sequence is exactly the minimum length. With the rule "at least", is it kept?
"At least n" includes n itself, so boundary values matter when you write the comparison.
Explain and submit
Explain how you compute each record's length and how you handled the case where no record qualifies.
Your submissions (0)
You can look ahead; come back to finish this stage.