Difference between revisions of "Pymol-script-repo"

From PyMOLWiki
Jump to navigation Jump to search
(clean up some misleading statements)
(3 intermediate revisions by 2 users not shown)
Line 10: Line 10:
 
# The possibility to let script authors push changes to their script out to PyMOL users.
 
# The possibility to let script authors push changes to their script out to PyMOL users.
 
# Easier requiring assistance from the PyMOL [http://sourceforge.net/mail/?group_id=4546 mailing list].
 
# Easier requiring assistance from the PyMOL [http://sourceforge.net/mail/?group_id=4546 mailing list].
# Script will be tested for malicious code before added to the official repository.
 
 
Read here to install: http://www.pymolwiki.org/index.php/git_install
 
  
 
== Official repository ==
 
== Official repository ==
The official repository is located at:
+
The repository is located at:
https://github.com/Pymol-Scripts/Pymol-script-repo
+
: https://github.com/Pymol-Scripts/Pymol-script-repo
 
 
And the Git Read-Only access is:
 
git://github.com/Pymol-Scripts/Pymol-script-repo.git
 
 
 
== Same namespace ==
 
As a part of this project, we recommend that the name for script filename and pagename at the PyMOL wiki are the same.
 
All letters should also be small for both. <br>
 
This will ease the use of the script
 
 
 
Example: colorbydisplacement
 
 
 
=== Example of namespace ===
 
For a description of use
 
http://www.pymolwiki.org/index.php/colorbydisplacement
 
For a color coded view
 
https://github.com/Pymol-Scripts/Pymol-script-repo/blob/master/colorbydisplacement.py
 
See the raw code or download manually, by right clicking the following link here -> Save as: colorbydisplacement.py
 
https://raw.github.com/Pymol-Scripts/Pymol-script-repo/master/colorbydisplacement.py
 
In the users local script library
 
/home/tlinnet/Software/pymol/Pymol-script-repo/colorbydisplacement.py
 
To import in PyMOL
 
import colorbydisplacement
 
To print the available functions in PyMOL
 
help(colorbydisplacement)
 
 
 
This means, that if a PyMOL user look in their local repo directory, and wonder what '''colorbydisplacement.py''' does.
 
Then user can write:
 
http://www.pymolwiki.org/index.php/colorbydisplacement
 
 
 
Here a description of the of script is presented, with example of use and images.
 
When the user then wants to use the script, one can simply write: '''import colorbydisplacement'''
 
 
 
To find out the defined functions, one can then either look at the wiki page, OR write in PyMOL.
 
'''help(colorbydisplacement)''' which automatically returns the functions.
 
 
 
= Read more here =
 
 
 
# Simple install instructions for all PyMOL users.
 
#:http://www.pymolwiki.org/index.php/git_install
 
# Information how to contribute scripts to the repository. It's easy!
 
#:http://www.pymolwiki.org/index.php/git_authors
 
# Guidelines how to make a good PyMOL wiki script page.
 
#:http://www.pymolwiki.org/index.php/git_script_guidelines
 
# Information how Repository admins handle the contributions
 
#:http://www.pymolwiki.org/index.php/git_admin
 
 
 
= Know problems =
 
  
== The slash "\" and "/" problem ==
+
== Naming convention ==
Windows uses backslash '''\''', and Linux uses forwardslash '''/''' in folder and path definitions. <br>
+
We recommend that the name for script filename and pagename at the PyMOLWiki are the same.
This give sometimes problems, when joining paths in script and plugins, if the author has not foreseen this. <br>
+
All letters should also be lower case.
We hope windows users can help report this suggest a solution, so scripts can be used on both systems.
 
  
It could get solved, by implementing something like this
+
Example: '''colorbydisplacement'''
<syntaxhighlight lang="python">
 
import sys,os,platform
 
print sys.path
 
for path in sys.path:
 
    if platform.system() == 'Windows':
 
        path_desc = "\\"
 
    if platform.system() == 'Linux':
 
        path_desc = "/"
 
    else:
 
        pass
 
sys.path.append(os.getcwd()+path_desc+"Pymol-script-repo")
 
print sys.path
 
  
def add_to_path():
+
{| class="wikitable"
    for path in sys.path:
+
| For a description of use
        if 'Pymol-script-repo' in path:
+
| http://pymolwiki.org/index.php/colorbydisplacement
            if platform.system() == 'Windows':
+
|-
                modules_path = path + "\\modules"
+
| For a color coded view
                path_desc = "\\"
+
| https://github.com/Pymol-Scripts/Pymol-script-repo/blob/master/colorbydisplacement.py
            if platform.system() == 'Linux':
+
|-
                modules_path = path + "/modules"
+
| Raw download
                path_desc = "/"
+
| https://raw.github.com/Pymol-Scripts/Pymol-script-repo/master/colorbydisplacement.py
            break
+
|-
        else:
+
| In the users local script library
            pass
+
| /home/tlinnet/Software/pymol/Pymol-script-repo/colorbydisplacement.py
    return(modules_path,path_desc)
+
|-
 +
| To import in PyMOL
 +
| <code>import colorbydisplacement</code>
 +
|-
 +
| To print the available functions in PyMOL
 +
| <code>help(colorbydisplacement)</code>
 +
|}
  
print "\n", add_to_path()
+
== Read more here ==
</syntaxhighlight>
 
  
== External modules - numeric ==
+
* [[git install|Git install instructions]]
Numeric is sometimes used in scripts. This module is
+
* [[git authors|Information how to contribute scripts to the repository]].
 +
* [[git script guidelines|Guidelines how to make a good PyMOL wiki script page]]
 +
* [[git admin|Information how Repository admins handle the contributions]]

Revision as of 07:20, 13 January 2012

Introduction

In November 2011, a group of PyMOL users initiated together with Jason Vertrees, a project to let PyMOL scripts be under version control system (VCS) called Git.

We hope that script authors and PyMOL users would be interested in this option.

Benefits

The benefits from this project, is

  1. A convenient way, to let PyMOL users download all scripts at the PyMOL wiki, with a minimum of effort.
  2. The possibility to let script authors push changes to their script out to PyMOL users.
  3. Easier requiring assistance from the PyMOL mailing list.

Official repository

The repository is located at:

https://github.com/Pymol-Scripts/Pymol-script-repo

Naming convention

We recommend that the name for script filename and pagename at the PyMOLWiki are the same. All letters should also be lower case.

Example: colorbydisplacement

For a description of use http://pymolwiki.org/index.php/colorbydisplacement
For a color coded view https://github.com/Pymol-Scripts/Pymol-script-repo/blob/master/colorbydisplacement.py
Raw download https://raw.github.com/Pymol-Scripts/Pymol-script-repo/master/colorbydisplacement.py
In the users local script library /home/tlinnet/Software/pymol/Pymol-script-repo/colorbydisplacement.py
To import in PyMOL import colorbydisplacement
To print the available functions in PyMOL help(colorbydisplacement)

Read more here