Menu Desplegable

chuletas para computar... cuando la memoria falla!


En el yasara.ini ===> Memory 10000

y 8 CPUs,

y el sbatch con 8 CPUs y 16G de memoria

select selcenter, (byres (obj01 around 20)) # selecciona aa a menos de 20 A del obj01

Sección de una proteína en PyMol en color gris

fetch 4ZYO, async=0
set ray_opaque_background, 0
as surface,
clip near , -50
set ray_interior_color, gray
set ray_shadows,0
png D:\encinar\tempjant\86d-SDC5_Agustin-Lahoz_2024\02-images\4ZYO-structure.png, width=1200, height=1200, dpi=600, ray=1

select selcenter, (byres ligand-Xtal///STI/* around 5)
select selcenter, (byres obj-name///res-name/* around 5)

Código para insertar un página en otra con html5.

How to install Python 2.7 as an additional kernel next to the default Python 3.X one?

# install everything (except JupyterHub itself) with Python 2 and 3. Jupyter is included in Anaconda.
conda create -n py3 python=3 anaconda
conda create -n py2 python=2 anaconda
# register py2 kernel
source activate py2
ipython kernel install
# same for py3, and install juptyerhub in the py3 env
source activate py3
ipython kernel install
pip install jupyterhub

PyMol --> Cambiar nombre de una cadena/residuo de una proteína

select the chain for which you wish to add/alter the chain id
# make sure that the selecting state (on the bottom right side) is on chains

type the command: alter (chain A),chain='B'
# This will alter the chain id to B, if you want another id change the command accordingly

type the command: alter (sele),resn='INH'
# This will alter the residue id to INH, if you want another id change the command accordingly

type the command: sort

PyMol --> Seleccionar el atom ID 4557 del obj01

select 4557, obj01 and id 4557

PyMol --> ball and stick, "ball" or obj01

preset.ball_and_stick(selection='all', mode=1)

PyMol --> Renumber the amino acids in a protein, so that it starts from 0 instead of its offset as defined in the structure file

alter (all),resi=str(int(resi)+100) # it starts from 100
alter (all),resi=str(int(resi)-7) # it starts from -7

# refresh (turn on seq_view to see what this command does).

PyMol --> Color of background for YASARA



To start the workflow, submit Job A first:

[jant.encinar@castleblack ~]$ sbatch _957.sbatch
Submitted batch job 69023

Now submit _788 and _605, using the job id from Job _957 to indicate the dependency:

[jant.encinar@castleblack ~]$ sbatch -d after:69023 _788.sbatch
Submitted batch job 69024
[jant.encinar@castleblack ~]$ sbatch -d after:69023 _605.sbatch
Submitted batch job 69025

#SBATCH --dependency=after:69023
#SBATCH --job-name={{variable1}}
#SBATCH --mem=2GB
#SBATCH --cpus-per-task=56
#SBATCH --partition=albaicin
#SBATCH --error=/LUSTRE/home/CTS164/{{variable2}}/err%j.err
#SBATCH --output=/LUSTRE/home/CTS164/{{variable2}}/out%j.out

/LUSTRE/home/CTS164/ -txt /LUSTRE/home/CTS164/ "MacroTarget='/LUSTRE/home/CTS164/{{variable2}}/{{variable3}}'"
cd /LUSTRE/home/CTS164/{{variable2}}/
cp {{variable2}}.log /LUSTRE/home/CTS164/
Recuerda los símboloes de una y tres letras de los aa proteinógenos

SLURN --> squeue jobs

squeue -u nrf24ad3 -ao "%.14i %.10u %.8j %.3C %.5m %.6b %.6Q %.5q %.10M %.7T %.15R %E" $*
squeue -u jant.encinar --sort=+j  #sort by the job-name (given by #SBATCH --job-name XXX)
rm *.err *.out *.adr *clean.sce *_bestposes.pdb *_bestposes.sdf *_checkpoint.sce

Listar , desde la linea de comandos, los archivos *.out con el comando find y después borrarlos.

find . -name "*.out" -type f
find . -name "*.out" -type f -delete

YASARA files --> delete useless YASARA's docking files

rm *.adr *clean.sce *_checkpoint.sce *_bestposes.pdb *_bestposes.sdf *_ligands.sdf

ls Linux Display or list all directories in Unix

ls -d */

YASARA files --> delete all selected files

rm *.mcr *.tab *.yob *.png *.txt *.html *last.pdb *last.sce *average.pdb *min.pdb *min.sce *_dccm.sce *.job *.sbatch

Nombre de hoja Excel --> función para incluir en una celda (en el ejemplo la celda A1 y poder operar de forma lógica con ella) el nombre de cada hoja de un libro Excel.


Pymol --> calcula una orientación determinada,

### cut below here and paste into script ###
set_view (\
     0.387747556,   -0.530695796,   -0.753665924,\
    -0.785253763,    0.238018751,   -0.571598351,\
     0.482731193,    0.813453972,   -0.324439615,\
     0.000000000,    0.000000000, -285.253662109,\
    41.038238525,  -12.994083405,   29.010128021,\
   224.896163940,  345.611175537,  -20.000000000 )
### cut above here and paste into script ###

Pymol --> repite una orientación determinada,

PyMOL>set_view (\
     0.387747556,   -0.530695796,   -0.753665924,\
    -0.785253763,    0.238018751,   -0.571598351,\
     0.482731193,    0.813453972,   -0.324439615,\
     0.000000000,    0.000000000, -285.253662109,\
    41.038238525,  -12.994083405,   29.010128021,\
   224.896163940,  345.611175537,  -20.000000000 )

Pymol --> selecciona los aminoácidos 15, 356, 398, 425, 430, 447, 448, 450, 451, 480, 481, 490

sele resi 15+356+398+425+430+447+448+450+451+480+481+490

Pymol --> Corte plano de una estructura y color gris del plano de corte

fraction = 0.42
view = cmd.get_view()
near_dist = fraction*(view[16]-view[15])
far_dist = (view[16]-view[15]) - near_dist
cmd.clip("near", -near_dist)

# render opaque background image
as surface
set ray_interior_color, grey60
set opaque_background
set surface_color, white

Pymol --> selecciona todas las prolinas,

sel arginines, resn arg
select resi 91 and resn Met and chain K

Pymol --> combina los PR01 y obj01 en un nuevo objeto llamado Pro1-B03-RS:

create Pro1-B03-RS, PR01 + obj01

Pymol --> selecciona los aa a menos de 5 A del aa 142,

select near142, resi 142 around 5

Pymol --> selecciona todos los átomos de fosforo

select fosforo, name p

Pymol --> tamaño de la leyenda,

set label_size, 22
set label_position,(-2,2,1)
set label_color, black, object

Pymol --> localización de la leyenda,

set label_position,(3,2,1)
Offsets the labels 3 Å in X, 2 in Y and 1 in Z, relative to the Viewport.

INTRANET --> localización de unidades de red


Pymol --> transparencia al 50% del objeto "obj01",

set transparency:0.5, obj01

Pymol --> Pair fit.

# superimpose protA residues 10-25 and 33-46 to protB residues 22-37 and 41-54:
pair_fit protA///10-25+33-46/CA, protB///22-37+41-54/CA
# superimpose ligA atoms C1, C2, and C4 to ligB atoms C8, C4, and C10, respectively:
pair_fit ligA////C1, ligB////C8, ligA////C2, ligB////C4, ligA////C3, ligB////C10

Pymol --> Run

1.- Open PDB file
2.- File -> Run ->
3.- Enter the comman line:

interfaceResidue MD2020-2059-MERS-compl-mod1, chain G, chain F

MD2020-2059-MERS-compl-mod1 -> name of object
chain G, chain F -> chain ID of two chain

Some examples for downloading PDBs from RCBS

Once downloaded, make sure the script has execution permission: chmod +x

Obtain full help on the batch download shell script at the command line with: ./ -h

In the examples below it is assumed that the file list_file.txt is a plain text file that contains a comma separated list of PDB ids.

  • Download pdb.gz files:
    ./ -f list_file.txt -p
  • Download cif.gz files:
    ./ -f list_file.txt -c
  • Download pdb.gz, cif.gz and sf.cif.gz files:
    ./ -f list_file.txt -c -p -s

Download PDBs from RCBS --> list_file.txt


# Script to download files from RCSB http file download services.
# 1LD2,2W96,2W99,2W9F,2W9Z,3G33,5FWK,5FWL,5FWM,5FWP,6P8E,6P8F,6P8G,6P8H
# Use the -h switch to get help on usage.

if ! command -v curl &> /dev/null
    echo "'curl' could not be found. You need to install 'curl' for this script to work."
    exit 1


usage() {
  cat << EOF >&2
Usage: $PROGNAME -f  [-o ] [-c] [-p]

 -f : the input file containing a comma-separated list of PDB ids
 -o  : the output dir, default: current dir
 -c       : download a cif.gz file for each PDB id
 -p       : download a pdb.gz file for each PDB id
 -x       : download a xml.gz file for each PDB id
 -s       : download a sf.cif.gz file for each PDB id (diffraction only)
 -m       : download a mr.gz file for each PDB id (NMR only)
 -r       : download a mr.str.gz for each PDB id (NMR only)
  exit 1

download() {
  echo "Downloading $url to $out"
  curl -s -f $url -o $out || echo "Failed to download $url"

while getopts f:o:cpxsmr o
  case $o in
    (f) listfile=$OPTARG;;
    (o) outdir=$OPTARG;;
    (c) cif=true;;
    (p) pdb=true;;
    (x) xml=true;;
    (s) sf=true;;
    (m) mr=true;;
    (r) mrstr=true;;
    (*) usage
shift "$((OPTIND - 1))"

if [ "$listfile" == "" ]
  echo "Parameter -f must be provided"
  exit 1
contents=$(cat $listfile)

# see
IFS=',' read -ra tokens <<< "$contents"

for token in "${tokens[@]}"
  if [ "$cif" == true ]
    download ${token}.cif.gz $outdir
  if [ "$pdb" == true ]
    download ${token}.pdb.gz $outdir
  if [ "$xml" == true ]
    download ${token}.xml.gz $outdir
  if [ "$sf" == true ]
    download ${token}-sf.cif.gz $outdir
  if [ "$mr" == true ]
    download ${token}.mr.gz $outdir
  if [ "$mrstr" == true ]
    download ${token}_mr.str.gz $outdir


Registro del sistema: HKEY _ LOCAL _ MACHINE / SOFTWARE / Microsoft / Windows NT / CurrentVersion / SoftwareProtectionPlatform y en lista de variables buscamos "BackupProductKeyDefault". Clave de instalación de Windows 10.

1.- crontab permite lanzar trabajos en diferido.

crontab -e: editar. ctrl+i: insertar contenido, ":wq"; escribir/guardar y salir (write & quit).

crontab -r: borrar.

crontab -l: comprobar un crontab programado.

I ran crontab -e and made some changes, now how do I save it?. That depends on the editor you run. contab -e uses the editor specified in the environment variable $EDITOR. Most probably it's vi or nano.

  • In vi, to enter the text you have to put vi in insert by pressing "i" or "a" after which you can add the text and whatever is being type will be seen on the screen, and press esc to switch to the command mode, then type :wq to write (w) and quit (q).
  • In nano press ctrl+x, then press y for yes and provide a filename before pressing Enter.
40       20       25       09       *   /usr/bin/python /home/jant/2vbc/
min      hor      dia      mes     año  /path/program /path/script 

2.- Syntax to rename a directory on Unix.
mv old-folder-name new-folder-name
mv /path/to/old /path/to/new

3.- Contar un gran número de ficheros.

Ejecuta el siguiente comando desde la consola y dentro del directorio en el que quieras contar esos ficheros. En el ejemplo contarás los ficheros *.sim

find -type f -name '*.sim' | wc -l

Memoria libre en cada nodo, para SGE.

qstat -f -u '*' -F mem_free

Cuando quieres listar el contenido de un directorio donde existen muchos ficheros y con ls aparece el argumento "Argument list too long". La solución está en el siguiente comando que has de modificar en función del /directorio y el tipo de archivo a buscar, en mi caso ".docked.pdbqt". Generará el fichero lista-hechos.txt... ¡mano de santo!

find /directorio -name "*.docked.pdbqt" >/directorio/lista-hechos.txt
find -type f -name '*.docked.pdbqt' >lista-hechos.txt

Jobs en array que deben usar 2 CPUs.

#$ -cwd
#$ -N crp1b09
#$ -o o.1b09
#$ -e e.1b09
#$ -pe 2 <-------
#$ -S /bin/bash
#$ -t 1-16482

cd /home/jant/CRP/1b09/
IDLIG=`python /home/jant/CRP/1b09/_lista.16482.txt $SGE_TASK_ID`
/home/jant/autodock_vina_1_1_2_linux_x86/bin/vina --config /home/jant/CRP/1b09/vina_config_files/$IDLIGAND.vina_config.txt --log /home/jant/CRP/1b09/docked-log/$IDLIGAND.log --cpu 2

4.- Borrar un gran número de ficheros.

Ejecuta el siguiente comando desde la consola y dentro del directorio en el que quieras borrar esos ficheros. En el ejemplo contarás los ficheros *.docked.pdbqt

find . -name "*.docked.pdbqt" -print0 | xargs -0 rm

5.- Para conocer los N directorios de nuestro /home organizados de mayor a menor:

Tamaño en Megas

du -sm * | sort -nr | head -N

Tamaño en Gigas

du -hs * | sort -nr | head -N

The output of the "ls" command depends on the version of "ls", the options used, the platform used, etc. It appears from your example that you're using it from a typical un*x (such as Linux), and probably using a typical modern "ls" version. In which case:

-rwxrw-r--    10    root   root 2048    Jan 13 07:11 afile.exe
?UUUGGGOOOS   00  UUUUUU GGGGGG ####    ^-- date stamp and file name are obvious ;-)
^ ^  ^  ^ ^    ^      ^      ^    ^
| |  |  | |    |      |      |    \--- File Size
| |  |  | |    |      |      \-------- Group Name (for example, Users, Administrators, etc)
| |  |  | |    |      \--------------- Owner Acct
| |  |  | |    \---------------------- Link count (what constitutes a "link" here varies)
| |  |  | \--------------------------- Alternative Access (blank means none defined, anything else varies)
| \--\--\----------------------------- Read, Write and Special access modes for [U]ser, [G]roup, and [O]thers (everyone else)
\------------------------------------- File type flag

6.- Copiar una lista ficheros de una carpeta a otra:

Generamos la lista con el nombre de los ficheros a copiar dispuestos en columna.

import sys
import fileinput
import os ,shutil
file = open(namelista, 'r')
print  len(vecfile)
for fileele in vecfile:
    if os.path.exists(diroutsh+'folder_origen/'+fileele+'.log'):
        shutil.copy(diroutsh+'folder_origen/'+fileele+'.log', diroutsh+'folder_destino/'+fileele+'.log')
#print "copied:",fileele+'.log'

EJECUCIÓN: python list.txt

7.- Convertir ficheros mol2 a pdbqt usando OpenBabel:
"C:\Program Files (x86)\ChemAxon\MarvinBeans\bin\molconvert" mol2 
-o D:\encinar\chemical-libraries\19-2_drug_bank\drug.mol2 -m -g -F
ren drug1.mol2 DB00114-1051.mol2
D:\encinar\chemical-libraries\19-2_drug_bank\mol2\DB00114-1051.mol2 -O 
 -xh --gen3d -p 7.4
find -type f -name '*.pdbqt' >/SCRATCH/CTS164/