cds2.genetics
DNA sequence analysis: alignment, ORFs, k-mers.
DNA sequence analysis: composition, k-mers, global alignment and ORF finding.
AlignmentResult
dataclass
Optimal global alignment of two sequences.
identity is the fraction of aligned columns whose residues match;
gap characters '-' always count as mismatches.
Source code in src/cds2/genetics.py
136 137 138 139 140 141 142 143 144 145 146 147 | |
gc_content(seq)
Fraction of G/C bases among non-N bases; 0.0 when empty or all-N.
Source code in src/cds2/genetics.py
98 99 100 101 102 103 104 105 | |
hamming_distance(a, b)
Number of differing positions between two equal-length sequences.
Source code in src/cds2/genetics.py
108 109 110 111 112 113 114 115 | |
reverse_complement(seq)
Reverse complement of the sequence (A<->T, C<->G, N preserved).
Source code in src/cds2/genetics.py
118 119 120 | |
kmer_counts(seq, k)
Histogram of all length-k sliding-window substrings.
Source code in src/cds2/genetics.py
123 124 125 126 127 128 129 130 131 132 133 | |
global_align(a, b, match_score=1, mismatch_score=-1, gap_penalty=-1)
Needleman-Wunsch global alignment with full dynamic-programming traceback.
Traceback ties prefer the diagonal (substitution) move; gaps are rendered
as '-' and count as mismatches toward identity.
Source code in src/cds2/genetics.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
find_orfs(seq, min_length=6)
Forward-strand open reading frames from ATG to the first in-frame stop.
Returns (start_zero_based, end_excluding_stop, protein) tuples where
protein translates the codons in [start, end) via the standard
table (unknown/N-containing codons become X). min_length compares
the coding nucleotide length excluding the stop codon.
Source code in src/cds2/genetics.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |