**0**wrote:

Let's consider these values

```
T/U=1, C=2, A=3, G=4
```

And that order: enter image description here

The input is a file.fasta that has the following data:

```
>id
atgatg
```

I will open and read the file and I will analyze it every three characters First analysis starts with atg ...

Then I apply it to an equation that will tell you where in the order previously established the result of the count will be:

```
((P1 - 1)*16) + P2 + ((P3-1)*4)
```

P1 = position 1 of atg Who is in position 1 of atg is A so P1 has a value of 3 (since A = 3, G - 4 ..)

Soon the equation becomes:

```
((3 - 1)*16) + P2 + ((P3-1)*4)
```

P2 = position 2 of atg which is equal to t T has a value of 1

Soon the equation becomes:

```
((3 - 1) * 16) + 1 + ((P3-1) * 4)
```

P3 = position 3 of atg which is equal to g

Soon the equation becomes:

```
((3 - 1) * 16) + 1 + ((4-1) * 4)
```

Soon the equation becomes:

```
((3 - 1) * 16) + 1 + ((4-1) * 4) = 45
```

So by counting we put 1 in position 45 which is AUG and I will write this data in a table

```
AUG 1
```

When we read the second atg it will be

```
AUG : 2
```

With this example the output would look like this:

```
ATG: 0 TAT: 0 TAA: 0 AUG : 2...
```

what I already managed to do was

```
with open('file.fasta') as fasta:
conteudo = fasta.read()
coteudo = str.maketrans({'A':'1', 'G':'2', 'C':'3', 'U':'4'})
```

If you want to understand better you can access this link: http://codonw.sourceforge.net/DataRecoding.html

how can I solve this problem?

**12k**• written 8 weeks ago by projetoic •

**0**