6 x {min=2367, median=2401.5, max=2445} dna sequence collection
Remove sequences shorter than a minimum length
Creating the min_length app and providing a positional argument specifying the minimum length allows us to filter an alignment, removing sequences which do not satisfy our threshold.
For instance, we can remove sequences from the globin alignment which are shorter than 240 amino acids long.
from cogent3 import get_appover_240s = get_app("min_length", 240)aln_fltrd = over_240s(aln)aln_fltrd
6 x {min=2367, median=2401.5, max=2445} dna sequence collection
Using the min_length app to filter multiple alignments
min_length is a useful app to use in data processing pipelines where downstream analysis requires sequences that exceed a given length.
In the following example, we compose a process that loads alignments and removes aligments less than 300 nucleotides in length, before writing them to a data store. We apply this process to a data store of the fasta files in the data directory. We restrict this data store to two members as a minimum example.