Skip to main content
`Ctrl`+`K`

# Select n sequences from a collection

Let’s load an alignment of primates to use in examples.

## Select the first n sequences from an alignment

Initialising `take_n_seqs` with the argument `number=3` creates an app that returns the first 3 sequences from an alignment

Note

“first n” refers to the ordering in the fasta file.

## Randomly selecting n sequences from an alignment

Using `random=True` and `number=3` returns 3 random sequences. An optional argument for a `seed` can be provided to ensure the same sequences are returned each time the app is called.

## Selecting the same sequences from multiple alignments

Providing the argument `fixed_choice=True` ensures the same sequences are returned when (randomly) sampling sequences across several alignments.