This is a read-only mirror of pymolwiki.org

Difference between revisions of "Fetch"

From PyMOL Wiki
Jump to navigation Jump to search
(proxy)
m (1 revision)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''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.
+
'''Fetch''' retrieves a protein structure from the PDB and loads it into PyMOL.
 +
The PDB file is saved in [[Fetch_Path|fetch_path]], which defaults to the current working directory for PyMOL.
  
You can now fetch electron density maps using ''type=fofc'' or ''type=2fofc''.  The map will be loaded if the electron density map exists on the [http://eds.bmc.uu.se/eds/ EDS] server.
+
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.  
You can also fetch the so-called [http://www.rcsb.org/pdb/101/static101.do?p=education_discussion/Looking-at-Structures/bioassembly_tutorial.html biological assembly or biological unit] files from PDB using ''type=pdb1'', ''type=pdb2'' and so on.  
 
  
=== Syntax ===
+
== ChangeLog ==
<source lang="python">
+
 
fetch PDB_ID [ ID2 ... IDN ] [,type=[fofc,2fofc,pdb1]] [,multiplex= [0,1]] [,async = [0,1]]
+
''Changed in PyMOL 2.3.0: Default async=0''
</source>
+
 
 +
''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}
  
To specify more than one PDB, just add its ID to the command line (separated by spaces).
+
''Other arguments: See [[load]] command.''
  
=== Proxy Setting ===
+
== 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:
 
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:
Line 20: Line 46:
 
os.environ["ftp_proxy"] = os.environ["http_proxy"]
 
os.environ["ftp_proxy"] = os.environ["http_proxy"]
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
== Examples ==
  
 
=== Example ===
 
=== Example ===
Line 75: Line 103:
 
</source>
 
</source>
  
= See Also =
+
== See Also ==
[[Fetch_Path]], [[Fetch_Host]], [[FetchLocal]]
+
 
 +
* [[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