<p>At the command, change the current directory to your target directory:</p>
<pre><code>cd my-directory-path-containing-my-files
</code></pre>
<p>Load the file:</p>
<pre><code>load 1a62.pdb
</code></pre>
<p>Then you can either print to screen or save to a file:</p>
<pre><code>print(cmd.get_fastastr('all'))

save 1a62.fasta
</code></pre>

CC BY-SA 4.0
2022-02-28T14:46:59.883Z
A small caveat for `get_fastastr` is that the fasta sequence returned does not include gaps in the numbering, therefore, a multiline command using `[int(atom.resi) for atom in cmd.get_model('name CA').atom]` may be required in some cases.
Matteo Ferla
CC BY-SA 4.0
2022-02-26T13:24:04.450Z
2022-02-28T01:40:05.180Z
2022-02-28T01:40:05.180Z
Supertech
<p>What is the command in PyMOL for listing all the amino acids in a specific protein, say, 1a62.pdb?</p>

<pdb><pymol>
How can I list all amino acids in a protein using PyMOL?
# How can I list all amino acids in a protein using PyMOL?

(Asked by: username_0 on 2022-02-26)

What is the command in PyMOL for listing all the amino acids in a specific protein, say, 1a62.pdb?

**Tags:** pdb, pymol

---

## 1 answers

### Answer by username_1 on 2022-02-26. Score: 2

At the command, change the current directory to your target directory:
cd my-directory-path-containing-my-files

Load the file:
load 1a62.pdb

Then you can either print to screen or save to a file:
print(cmd.get_fastastr('all'))

save 1a62.fasta

> **Comments:**
> **username_2**: A small caveat for `get_fastastr` is that the fasta sequence returned does not include gaps in the numbering, therefore, a multiline command using `[int(atom.resi) for atom in cmd.get_model('name CA').atom]` may be required in some cases.  

---

