1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
| #! python3
# coding: utf-8
from itertools import combinations
""" Combinaisons 2 lettres """
list_comb = list(combinations('ACCTAGCCCTA', 2))
list_mots = []
for t in list_comb:
list_mots.append(t[0] + t[1])
dict_mots = {}
for mot in list_mots:
if mot not in dict_mots:
dict_mots[mot] = list_mots.count(mot)
print(dict_mots)
"""
{
'AC': 8,
'AT': 3,
'AA': 3,
'AG': 2,
'CC': 10,
'CT': 7,
'CA': 7,
'CG': 2,
'TA': 3,
'TG': 1,
'TC': 3,
'TT': 1,
'GC': 3,
'GT': 1,
'GA': 1
}
"""
""" Combinaisons 3 lettres """
list_comb = list(combinations('ACCTAGCCCTA', 3))
list_mots = []
for t in list_comb:
list_mots.append(t[0] + t[1] + t[2])
dict_mots = {}
for mot in list_mots:
if mot not in dict_mots:
dict_mots[mot] = list_mots.count(mot)
print(dict_mots)
"""
{
'ACC': 13,
'ACT': 10,
'ACA': 10,
'ACG': 2,
'ATA': 4,
'ATG': 1,
'ATC': 3,
'ATT': 1,
'AAG': 1,
'AAC': 3,
'AAT': 1,
'AAA': 1,
'AGC': 6,
'AGT': 2,
'AGA': 2,
'CCT': 11,
'CCA': 11,
'CCG': 1,
'CCC': 10,
'CTA': 9,
'CTG': 2,
'CTC': 6,
'CTT': 2,
'CAG': 2,
'CAC': 6,
'CAT': 2,
'CAA': 2,
'CGC': 6,
'CGT': 2,
'CGA': 2,
'TAG': 1,
'TAC': 3,
'TAT': 1,
'TAA': 1,
'TGC': 3,
'TGT': 1,
'TGA': 1,
'TCC': 3,
'TCT': 3,
'TCA': 3,
'TTA': 1,
'GCC': 3,
'GCT': 3,
'GCA': 3,
'GTA': 1
}
""" |
Partager