Sequence Data QC Pipeline
0 of 5 stages done
  1. 1 Read the file
  2. 2 Clean and validate
  3. 3 Filter by length
  4. 4 Trim adapters
  5. 5 Quality check a FASTQ file
STAGE 3 OF 5

Filter by length

Code not passed yet Explanation needed Self-check
You are browsing as a guest: read the stage and run code freely. To be graded and save your progress, sign in or create an account →

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

.ipynb
Shift + Enter runs a cell. Your notebook runs and is saved in this browser only; nothing is sent to us until you submit in step 3.

Check your understanding

A quick self-check, marked right here in your browser. It is not graded or saved.

1.

Why do pipelines usually discard very short sequences?

2.

A record's sequence is exactly the minimum length. With the rule "at least", is it kept?

Explain and submit

Explain how you compute each record's length and how you handled the case where no record qualifies.

Submitting sends the code in your solution cell and this explanation. The code is checked on our server against the given input and hidden tests. The stage is complete when the code passes and the explanation has at least 20 words.

You can look ahead; come back to finish this stage.