This is a read-only mirror of pymolwiki.org

Difference between revisions of "Fetch"

From PyMOL Wiki
Jump to navigation Jump to search
m
 
m (1 revision)
 
(19 intermediate revisions by 7 users not shown)
Line 1: Line 1:
=== Overview ===
+
'''Fetch''' retrieves a protein structure from the PDB and loads it into PyMOL.
'''Fetch''' retrieves a protein structure from the PDB and loads it into PyMOL. The PDB file is saved in the current working directory for PyMOL.
+
The PDB file is saved in [[Fetch_Path|fetch_path]], which defaults to the current working directory for PyMOL.
  
=== Syntax ===
+
To download a so-called [https://pdb101.rcsb.org/learn/guide-to-understanding-pdb-data/biological-assemblies biological assembly or biological unit], use the [[assembly]] setting or use ''type=pdb1'', ''type=pdb2'' and so on.
<source lang="python">
+
 
fetch PDB_ID [ ID2...IDN ] [, async = [0,1] ]
+
== ChangeLog ==
</source>
+
 
 +
''Changed in PyMOL 2.3.0: Default async=0''
 +
 
 +
''New in PyMOL 1.8.6: Support type=mmtf and [[fetch_type_default]] setting''
 +
 
 +
''Changed in PyMOL 1.8.0: Default type=cif''
 +
 
 +
''New in PyMOL 1.8.0: Support type=cc to download a chemical component by 3-letter code''
 +
 
 +
''New in PyMOL 1.7.4: Support type=cif''
 +
 
 +
''New in PyMOL 1.7.2: Support type=emd to download maps from [http://www.emdatabank.org/ EMDataBank]''
 +
 
 +
''New in PyMOL 1.7.0: Support type=cid and type=sid to download from [https://pubchem.ncbi.nlm.nih.gov/ PubChem]''
 +
 
 +
''New in PyMOL 1.6.0: Support 5 letter codes to download a single chain (4-letter pdb + 1-letter chain)''
 +
 
 +
''New in PyMOL 1.3: Support type=2fofc and type=fofc to download electron density maps''
 +
 
 +
== Usage ==
 +
 
 +
fetch codes [, name [, state [, finish [, discrete [, multiplex [, zoom [, type [, async ]]]]]]]]
 +
 
 +
== Arguments ==
 +
 
 +
* '''codes''' = str: one or more accession codes, separated by spaces
 +
* '''name''' = str: new object name {default: accession code}
 +
* '''type''' = cif|mmtf|pdb|pdb1|2fofc|fofc|emd|cid|sid|cc: file type and/or accession code type {default: negotiated by code or use [[fetch_type_default]]}
 +
* '''async''' = 0/1: Download structures in the background and do not block the PyMOL command line. '''For scripting, you typically need async=0.''' {default: 0 since PyMOL 2.3, before that: !quiet, which means 1 for the PyMOL command language, and 0 for the Python API}
 +
 
 +
''Other arguments: See [[load]] command.''
 +
 
 +
== Proxy Setting ==
 +
 
 +
If your network requires a proxy server, you can specify it by 'http_proxy' and 'ftp_proxy' environmental variables. At least in Mac OS X, these values are setup automatically. Otherwise, add to your [[pymolrc]] script:
 +
 
 +
<syntaxhighlight lang="python">
 +
import os
 +
os.environ["http_proxy"] = "http://username:password@proxy.server.name:port/"
 +
os.environ["ftp_proxy"] = os.environ["http_proxy"]
 +
</syntaxhighlight>
  
To specify more than one PDB, just add its ID to the command line (without adding spaces).
+
== Examples ==
  
 
=== Example ===
 
=== Example ===
 
<source lang="python">
 
<source lang="python">
 
 
# fetch them singly
 
# fetch them singly
 
fetch 1kao
 
fetch 1kao
Line 22: Line 61:
 
fetch 1kao 1ctq, async=0
 
fetch 1kao 1ctq, async=0
  
 +
# multiple commands in one line is accepted
 +
fetch 1kao, async=0; as cartoon
 +
 +
# Example loading a protein and its electron density map
 +
fetch 1cll
 +
fetch 1cll, type=2fofc
 +
# focus on residues 30-40
 +
map_trim *, i. 30-40, 4
 +
zoom i. 30-40
 +
</source>
 +
 +
=== Example 2 ===
 +
<source lang="python">
 +
# fetch PDB files and process each of them
 +
# using async=0, PyMOL will wait for fetch to finish before executing the next command
 +
fetch 1kao, async=0
 +
remove not (alt ''+A)
 +
alter all, alt=''
 +
save 1koa_clean.pdb,1koa
 +
delete 1koa
 +
fetch 1ctq, async=0
 +
remove not (alt ''+A)
 +
alter all, alt=''
 +
save 1ctq_clean.pdb,1ctq
 +
</source>
 +
 +
=== Example 3 - pdb1===
 +
<source lang="python">
 +
# fetch the biological assembly of 1avd
 +
# the assembly is composed of asymmetric units (ASUs) stored in different MODELs
 +
# split the biological assembly using split_state
 +
fetch 1avd, type=pdb1
 +
split_state 1avd
 +
</source>
 +
 +
=== Example 4 - multistate===
 +
This will fetch the biological assembly (type=pdb1) from the pdb, split the 60 states into separate objects (multiplex=1), and tell PyMOL to wait for all this to be completed before moving to the next command in a .pml script (async=0).
 +
<source lang="python">
 +
# fetch the biological assembly of 2buk
 +
fetch 2buk, type=pdb1, multiplex=1, async=0
 
</source>
 
</source>
 +
 +
== See Also ==
 +
 +
* [[Fetch_Path|fetch_path]]
 +
* [[fetch_type_default]]
 +
* [[Fetch_Host|fetch_host]]
 +
* [[FetchLocal]]
  
 
[[Category:Commands|Fetch]]
 
[[Category:Commands|Fetch]]

Latest revision as of 03:58, 4 March 2019

Fetch retrieves a protein structure from the PDB and loads it into PyMOL. The PDB file is saved in fetch_path, which defaults to the current working directory for PyMOL.

To download a so-called biological assembly or biological unit, use the assembly setting or use type=pdb1, type=pdb2 and so on.

ChangeLog

Changed in PyMOL 2.3.0: Default async=0

New in PyMOL 1.8.6: Support type=mmtf and fetch_type_default setting

Changed in PyMOL 1.8.0: Default type=cif

New in PyMOL 1.8.0: Support type=cc to download a chemical component by 3-letter code

New in PyMOL 1.7.4: Support type=cif

New in PyMOL 1.7.2: Support type=emd to download maps from EMDataBank

New in PyMOL 1.7.0: Support type=cid and type=sid to download from PubChem

New in PyMOL 1.6.0: Support 5 letter codes to download a single chain (4-letter pdb + 1-letter chain)

New in PyMOL 1.3: Support type=2fofc and type=fofc to download electron density maps

Usage

fetch codes [, name [, state [, finish [, discrete [, multiplex [, zoom [, type [, async ]]]]]]]]

Arguments

  • codes = str: one or more accession codes, separated by spaces
  • name = str: new object name {default: accession code}
  • type = cif|mmtf|pdb|pdb1|2fofc|fofc|emd|cid|sid|cc: file type and/or accession code type {default: negotiated by code or use fetch_type_default}
  • async = 0/1: Download structures in the background and do not block the PyMOL command line. For scripting, you typically need async=0. {default: 0 since PyMOL 2.3, before that: !quiet, which means 1 for the PyMOL command language, and 0 for the Python API}

Other arguments: See load command.

Proxy Setting

If your network requires a proxy server, you can specify it by 'http_proxy' and 'ftp_proxy' environmental variables. At least in Mac OS X, these values are setup automatically. Otherwise, add to your pymolrc script:

import os
os.environ["http_proxy"] = "http://username:password@proxy.server.name:port/"
os.environ["ftp_proxy"] = os.environ["http_proxy"]

Examples

Example

# fetch them singly
fetch 1kao
fetch 1ctq

# fetch them at once
fetch 1kao 1ctq

# fetch them at once, load them into PyMOL all at once (synchronously)
fetch 1kao 1ctq, async=0

# multiple commands in one line is accepted
fetch 1kao, async=0; as cartoon

# Example loading a protein and its electron density map
fetch 1cll
fetch 1cll, type=2fofc
# focus on residues 30-40
map_trim *, i. 30-40, 4
zoom i. 30-40

Example 2

# fetch PDB files and process each of them
# using async=0, PyMOL will wait for fetch to finish before executing the next command
fetch 1kao, async=0
remove not (alt ''+A)
alter all, alt=''
save 1koa_clean.pdb,1koa
delete 1koa
fetch 1ctq, async=0
remove not (alt ''+A)
alter all, alt=''
save 1ctq_clean.pdb,1ctq

Example 3 - pdb1

# fetch the biological assembly of 1avd
# the assembly is composed of asymmetric units (ASUs) stored in different MODELs
# split the biological assembly using split_state
fetch 1avd, type=pdb1
split_state 1avd

Example 4 - multistate

This will fetch the biological assembly (type=pdb1) from the pdb, split the 60 states into separate objects (multiplex=1), and tell PyMOL to wait for all this to be completed before moving to the next command in a .pml script (async=0).

# fetch the biological assembly of 2buk
fetch 2buk, type=pdb1, multiplex=1, async=0

See Also