Next: , Previous: parse-pisa-xml, Up: Scheme Scripting Functions


13.34 coot-utils

— procedure: *annotations*

3D annotations - a bit of a hack currently

— procedure: *default-ball-and-stick-selection*

used in Extensions -> Representation -> Ball & Stick

— procedure: drag-intermediate-atom

scm aliases. Don't forget to add them to snarf-coot-docs too.

— procedure: set-find-hydrogen-torsion

fix typo of set-find-hydrogen-torsions (backward compatibility in case anyone was using that)

— procedure: rigid-body-refine-by-residue-ranges

rigid body refine using residue ranges. Takes 2 arguments, the first is the molecule number, the second is a list of residue-ranges. A residue range is (list chain-id resno-start resno-end).

— procedure: find-aligned-residue-type

add terminal residue is the normal thing we do with an aligned sequence, but also we can try ton find the residue type of a residue in the middle of the chain that is modelled as an ALA, say.

— procedure: molecule-has-hydrogens? imol

schemify function

— procedure: post-manipulation-hook
— procedure: pre-release?

Return a boolean

— procedure: molecule-number-list

Return a list of molecule numbers (closed and open) The elements of the returned list need to be tested against is-valid-model-molecule?

— procedure: first-n n ls

first n fields of ls. if length ls is less than n, return ls. if ls is not a list, return ls. If n is negative, return ls.

— procedure: directory-is-modifiable? prefix-dir

Test for prefix-dir (1) being a string (2) existing (3) being a directory (4) modifiable by user (ie. u+rwx). prefix-dir must be a string.

Return #t or #f.

— procedure: absolutify file-name

return an absolute file-name for file-name or #f

— procedure: file-name-directory file-name

return the directory component of file-name, leave "/" on, if it's there. Note "x", "", "/" -> ""

— procedure: most-recently-created-file

return #f on no-such-file

— procedure: residue-spec->atom-selection-string centre-residue-spec

Convert a residue-spec to an mmdb atom selection string.

— procedure: map-molecule-list

Return a list of molecules that are maps

— procedure: model-molecule-list

Return a list of molecules that are maps

— procedure: shelx-molecule? imol

Return #t (#f) if imol is (isn't) a shelx molecule.

— procedure: set-virtual-trackball-type type

Set the virtual trackball behaviour.

trackball type is a symbol: either 'flat or 'spherical-surface.

— procedure: list-of-strings? ls

Is ls a list of strings? Return #t or #f

— procedure: string-append-with-spaces ls

string concat with spaces, ls must be a list of strings.

— procedure: rotation-centre

The screen centre.

return the rotation centre as a 3 membered list of numbers

— procedure: number-list a b

Make list of integers, a to b: eg (number-list 2 5) -> (2 3 4 5)

— procedure: string-member? atom ls

ls must be a list of strings, atom must be a string.

return either #t or #f.

— procedure: member? atom ls
— procedure: range first . second

range: works like the eponymous python function e.g. (range 3) -> '(0, 1, 2) e.g. (range 1 3) -> '(1, 2)

— procedure: shell-command-to-string cmd

code from thi <ttn at mingle.glug.org>

run command and put the output into a string and return it. (c.f. run-command/strings)

— procedure: shell-command-to-file-with-data cmd file-name data-list

run cmd putting output to file-name and reading commands data from the list of strings data-list.

— procedure: command-in-path? f

Is the command f in the path? return #t or #f.

Thank you for this, rixed at happyleptic.org

— procedure: command-in-path-or-absolute? cmd

Return #t or #f

— procedure: goosh-command cmd args data-list log-file-name screen-output-also?

Where cmd is e.g. "refmac" args is (list "HKLIN" "thing.mtz") log-file-name is "refmac.log" data-list is (list "HEAD" "END")

Return the exist status e.g. 0 or 1.

— procedure: goosh-command-with-file-input cmd args input-file log-file-name

run commands from an input file.

— procedure: run-command/strings cmd args data-list

Return the strings screen output of cmd or #f if command was not found

— procedure: close-float? x1 x2

Crude test to see of 2 floats are the same (more or less). Used in a greg test after setting the atom position.

— procedure: strip-spaces str

if passed a string, return a string with no spaces, else return #f.

— procedure: strip-leading-spaces str

" 53" -> "53", " " -> ""

— procedure: string-append-with-string str-ls tag-str

Append strings with tag-str between them

— procedure: strip-extension s

"a.b.res" -> "a.b" file-name-sans-extension

— procedure: file-name-extension

What is the extension of file-name?

"a.pdb" -> "pdb" "" -> ""

— procedure: add-tmp-extension-to

e.g. "a.pdb" -> "a-tmp.pdb"

— procedure: file-name-sans-extension

Same function as strip-extension, different name, as per scsh, in fact.

— procedure: strip-path s

/a/b.t -> b.t d/e.ext -> e.ext file-name-sans-path

— procedure: slash-start? s

does s start with a "/" ? return #t or #f

— procedure: string-concatenate ls

simple scheme functions to concat the strings in ls (ls must contain only strings)

— procedure: unique-date/time-str

return a string that contains the date/time e.g. "2006-01-02_2216.03"

— procedure: every-nth ls n

return a list that has only every-nth members; e.g. (every-nth '(0 1 2 3 4 5 6 7 8) 2) -> '(0 2 3 6 8) (every-nth '(0 1 2 3 4 5 6 7 8) 3) -> '(0 3 6)

n must be positive

— procedure: get-atom imol chain-id resno ins-code atom-name . alt-conf

Return an atom info or #f (if atom not found).

— procedure: multi-read-pdb glob-pattern dir

multi-read-pdb reads all the files matching glob-pattern in directory dir. Typical usage of this might be: (multi-read-pdb "a*.pdb" ".")

— procedure: read-pdb-all

read-pdb-all reads all the "*.pdb" files in the current directory.

— procedure: string->list-of-strings str

Return a list if str is a string, else return '()

— procedure: append-dir-file dir-name file-name

In a laughable attempt to minimise system dependence.

— procedure: append-dir-dir dir-name sub-dir-name

Similarly attempting to minimise system dependence.

— procedure: directory-as-file-name dir

remove any trailing /s

— procedure: is-directory? file-name

return #t or #f depending on if file-name (which must be a string) is a directory.

— procedure: coot-mkdir dir-name

return #f if dir-name is a file or we can't do the mkdir

— procedure: directory-files dir

The following functions from PLEAC (guile version thereof of course).

Return: a list of files in the given directory

— procedure: glob pat dir

return a list of file names that match pattern pat in directory dir.

— procedure: view-matrix

return the view matrix (useful for molscript, perhaps).

— procedure: view-quaternion

return the view quaternion

— procedure: add-view position quaternion zoom view-name

Return the view number

— procedure: matrix->quaternion

Convert a view matrix to a view quaternion to set Coot view internals.

— procedure: set-view-matrix m00 m10 m20 m01 m11 m21 m02 m12 m22

Set the view matrix using matrix->quaternion.

Useful for using a view matrix from another program, perhaps.

— procedure: molecule-centre imol

Return the molecule centre as a list of 3 numbers.

Note: mol-cen could contain values less than -9999.

— procedure: move-molecule-to-screen-centre imol

Move the centre of molecule number imol to the current screen centre

— procedure: move-molecule-here

This is a short name for the above.

— procedure: move-molecule-to-screen-center

this is an americanism

— procedure: identity-matrix

Return a nine-membered list of numbers.

— procedure: translation axis length

e.g. (translation 'x 2) -> '(2 0 0) Return: "scheme false" on error

— procedure: rotate-about-screen-axis axis degrees

Rotate degrees about screen axis, where axis is either 'x, 'y or 'z.

— procedure: toggle-display-map imol idummy

Support for old toggle functions. (consider instead the raw functions use the direct set_displayed functions).

— procedure: toggle-display-mol imol

toggle the display of imol

— procedure: toggle-active-mol imol

toggle the active state (clickability) of imol

— procedure: scheme-representation imol

return a scheme representation of molecule imol, or #f if we can't do it (imol is a map, say).

— procedure: reorder-chains imol

reorder chains

— procedure: transform-coords-molecule imol rtop

transform a coordinates molecule by a coot-rtop (which is a SCM expression of a clipper::RTop), i.e. a list of a 9-element list and a 3 element list. e.g. (list (list 1 0 0 0 1 0 0 0 1) (list 4.5 0.4 1.2)).

— procedure: transform-map

(transform-map imol mat trans about-pt radius space-group cell)

where space-group is a HM-symbol and cell is a list of 6 parameters, where the cell angles are in degrees.

or (transform-map imol trans about-pt radius) for a simple translation

or (transform-map imol trans radius) when using the default rotation-centre as the about-pt

— procedure: get-first-ncs-master-chain

return then NCS master of the first molecule that has ncs.

return "" on fail to find an ncs chain

— procedure: transform-map-using-lsq-matrix imol-ref ref-chain ref-resno-start ref-resno-end imol-mov mov-chain mov-resno-start mov-resno-end imol-map about-pt radius

Remember, that now the about-pt is the "to" point, i.e. the maps are brought from somewhere else and generated about the about-pt.

— procedure: brighten-map imol scale-factor

Make the imol-th map brighter.

— procedure: brighten-maps

Make all maps brighter

— procedure: darken-maps

Make all maps darker.

— procedure: chain-ids imol

Return a list of chain ids for given molecule number imol. return empty list on error

— procedure: is-solvent-chain? imol chain-id

convert from interface name to schemish name

Return #t or #f.

— procedure: valid-model-molecule? imol

schemey interface to eponymous scripting interface function. Return scheme true or false

— procedure: valid-map-molecule? imol

schemey interface to eponymous scripting interface function. Return scheme true or false.

— procedure: valid-refinement-map?

Return #t or #f

— procedure: shelx-molecule? imol

schemey interface to shelx molecule test

Return #t or #f.

— procedure: is-difference-map? imol-map

Return #t or #f.

— procedure: residue-exists? imol chain-id resno ins-code

Does residue resno with insertion code ins-code of chain chain-id and in molecule number imol exist?

Return #t or #f.

— procedure: residue-has-hetatms? imol chain-id res-no ins-code

Does the residue contain hetatoms? Return #t or #f.

— procedure: centre-of-mass imol

Return a list of 3 float for the centre of mas of molecule number imol.

on faiure return #f.

— procedure: atom-specs imol chain-id resno ins-code atom-name alt-conf

Return as a list the occupancy temperature-factor element x y z coordinates of the given atom. (the x,y,z are in Cartesian Angstroms).

on error (e.g. atom not found) return #f

— procedure: guess-refinement-map

return a guess at the map to be refined (usually called after imol-refinement-map returns -1)

— procedure: target-auto-weighting-value

Ian Tickle says (as far as I can understand) that the target rmsd should be 0.25 or thereabouts. You can over-ride it now.

— procedure: auto-weight-for-refinement

Set the refinement weight (matrix) by iterating the refinement and varying the weight until the chi squares (not including the non-bonded terms) reach 1.0 =/- 10%. It uses sphere refinement. The refinement map must be set. At the end show the new weight in the status bar. Seems to take about 5 rounds.

— procedure: print-sequence imol

Print the sequence of molecule number imol

This is not really a util, perhaps it should be somewhere else?

— procedure: pir-file-name->pir-sequence pir-file-name

simple utility function to return the contents of a file as a string.

— procedure: associate-pir-file imol chain-id pir-file-name

Associate the contents of a PIR file with a molecule.

— procedure: graphics-comma-key-pressed-hook

comma key hook

— procedure: graphics-dot-key-pressed-hook

dot key hook

— procedure: *key-bindings*

a list of (code key name thunk) e.g. '(103 "g" "Goto Blob" (blob-under-pointer-to-screen-centre))

— procedure: add-key-binding name key thunk

Add a key binding

with a given name, key (e.g. "x" or "S") and the function to run (a thunk) when that key is pressed.

— procedure: graphics-general-key-press-hook key

general key press hook, not for public use.

— procedure: read-vu-file

Function requested by Mark White.

read XtalView (and maybe other) .vu files and convert them into generic objects.

Pass the filename and an object name e.g. (read-vu-file "axes.vu" "axes")

Returns: nothing interesting.

— procedure: residues-matching-criteria imol residue-test-func

Return a list of residues, each of which has a return value at the start, ie. (list return-value chain-id res-no ins-code)

— procedure: all-residues imol

Return residue specs for all residues in imol (each spec is preceeded by #t)

— procedure: residues-with-alt-confs imol

Return a list of all residues that have alt confs: where a residue is specified thusly: (list chain-id resno ins-code)

— procedure: residue-alt-confs imol chain-id res-no ins-code

Return a list of all the altconfs in the residue. Typically this will return (list "") or (list "A" "B")

— procedure: res-spec->chain-id res-spec

simple extraction function

— procedure: res-spec->res-no res-spec

simple extraction function

— procedure: res-spec->ins-code res-spec

simple extraction function

— procedure: residue-spec->atom-for-centre imol chain-id res-no ins-code

Return #f if no atom can be found given the spec else return a list consisting of the atom name and alt-conf specifier.

Choose an atom that is called " CA ". Failing that choose the first atom.

— procedure: update-go-to-atom-from-current-atom
— procedure: flip-active-ligand
— procedure: delete-atom-by-active-residue

Typically one might want to use this on a water, but it deletes the nearest CA currently... Needs a re-think. Should active-atom just return the nearest atom and not be clever about returning a CA.

— procedure: merge-solvent-chains imol
— procedure: mutate-by-overlap imol chain-id-in resno tlc

change chain ids with residue range for the PTY

— procedure: phosphorylate-active-residue

A bit of fun

— procedure: overlay-my-ligands imol-mov chain-id-mov resno-mov imol-ref chain-id-ref resno-ref

A function for Overlaying ligands. The transformation is applied to all the atoms of the molecule that contains the moving ligand.

— procedure: label-all-CAs imol
— procedure: label-all-atoms-in-residue imol chain-id resno inscode
— procedure: label-all-active-residue-atoms
— procedure: sanitise-alt-confs atom-info atom-ls

Resets alt confs and occupancies of atoms in residue that have orphan alt-loc attributes.

— procedure: sanitise-alt-confs-in-residue imol chain-id resno inscode
— procedure: sanitise-alt-confs-active-residue

Resets alt confs and occupancies of atoms in residue that have orphan alt-loc attributes. Use the active-residue.

— procedure: print-molecule-names
— procedure: save-dialog-positions-to-init-file
— procedure: multi-chicken imol . n-colours

multiple maps of varying colour from a given map.

— procedure: BALL_AND_STICK

simple enumeration

— procedure: hilight-binding-site imol centre-residue-spec hilight-colour radius

hilight-colour is specified in degrees (round the colour wheel - starting at yellow (e.g. 230 is purple))

— procedure: pukka-puckers? imol

To paraphrase: The distance of the plane of the base to the following phosphate is highly correlated to the pucker of the ribose.

An analysis of the structures in RNADB2005 shows that a critical distance of 3.3A provides a partition function to separate C2' from C3' endo puckering. Not all ribose follow this rule. There may be some errors in the models comprising RNADB2005. So we check the distance of the following phosphate to the plane of the ribose and record the riboses that are inconsitent. We also report puckers that are not C2' or C3'. The puckers are determined by the most out-of-plane atom of the ribose (the rms deviation of the 4 atoms in the plane is calculated, but not used to determine the puckering atom).

— procedure: new-molecule-by-smiles-string tlc-text smiles-text

Run libcheck to convert from SMILES string

— procedure: prodrg-ify imol chain-id res-no ins-code

Generate restraints from the residue at the centre of the screen using PRODRG. Delete hydrogens from the residue because PRODRG has anomalous hydrogens.

— procedure: add-annotation-here text
— procedure: save-annotations file-name
— procedure: load-annotations file-name
— procedure: make-latest-version-url

Here we construct the url that contains the latest (pre) release info adding in "pre-release" if this binary is a pre-release. args ends up as something like: ("-s" "xxx/phone-home.scm" "pre-release" "binary" "Linux-1386-fedora-10-python-gtk2" "command-line" "/home/xx/coot/bin/coot")

— procedure: run-download-binary-curl revision version-string pending-install-in-place-func set-file-name-func

Get the binary (i.e. the action that happens when the download button is pressed). This is run in a thread, so it can't do any graphics stuff.

return #t if tar file was successfully downloaded and untared and #f if not.

— procedure: get-revision-from-string str

(used in downloading new version)

— procedure: coot-split-version-string str

e.g. input: "coot-0.6.2-pre-1-revision-2765\n" output: "coot-0.6.2-pre-1-revision-2765"

— procedure: load-default-sequence

In the first case the sequence is assigned to the closest match (model sequence to target sequence), subsequently only chains without a sequence associated with them are candidates for matching. The protein sequence has to have at least 95% sequence identity with the target sequence in "default.seq"

— procedure: coot-updates-error-handler key . args

not really for public manipulation.

— procedure: update-self

keep a copy of the old directories around in a directory named after expiration time.

— procedure: chiral-centre-inverter

This should almost all be c++ code so that Bernie doesn't have to redo it. This is temporary then.

— procedure: chiral-center-inverter

Americans...

— procedure: coot-has-pygtk?

to determine if we have pygtk