from cogent3 import make_aligned_seqs
aln = make_aligned_seqs({"s1": "ACGA-GA-CG", "s2": "GATGATG-AT"}, moltype="dna")
aln| 0 | |
| s2 | GATGATG-AT |
| s1 | ACGA-GA.CG |
2 x 10 dna alignment
Using the omit_gap_pos app, we can remove position from an alignment which exceed a specified proportions of gaps.
Let’s create a sample alignment with gaps.
| 0 | |
| s2 | GATGATG-AT |
| s1 | ACGA-GA.CG |
2 x 10 dna alignment
Sites with over 99% gaps are excluded by default.
| 0 | |
| s2 | GATGATGAT |
| s1 | ACGA-GACG |
2 x 9 dna alignment
We can alter the threshold for the allowed fraction of gaps with the allowed_frac argument. Let’s create an app that excludes all aligned sites with over 49% gaps.
To eliminate any codon columns (where a column is a triple of nucleotides) that contain a gap character, we use the motif_length argument.