The output now computes molecular weight, as ChatGPT changed the nature of the dictionary. However, the code is useful in illustrating all the steps necessary to create a functional GUI, including selecting and writing output. The code makes use of user-defined functions.
The aa composition from version 2 is in the form *e.g.* 1L: 0.18` and we can verify that the numbers sum to ` 1 ` (*i.e.* 100%) with a shell (`bash` or `zsh`) script. Assuming that the output file name is `output.txt`:
The aa composition from version 2 is in the form *e.g.*for Leucine: `1L: 0.18`, and we can verify that the numbers sum to ` 1 ` (*i.e.* 100%) with a shell (`bash` or `zsh`) script. Assuming that the output file name is `output.txt`:
```
egrep "^[A-Z]:" < output.txt |awk 'END { print s } { s += $2 }'
```
The output would be `1.01` due to rounding.
(Credit to `awk` command to [sum-a-column-of-numbers](https://stackoverflow.com/questions/3096259/bash-command-to-sum-a-column-of-numbers).)