Pesquisar este blog

sexta-feira, 1 de novembro de 2013

shell script

sed -n '/ 1 /p' FM_REF_FORCES > 1.dat


Get the lines starting with "i" and put in "i.dat" files

for ((  i = 1 ;  i <= 24;  i++  ))
do
echo "$i"
sed -n "/ $i /p" FM_REF_FORCES > $i.dat
done


SED

o Sed é orientado a linha, de cima para baixo, da esquerda para a direita.

A sintaxe genérica de um comando Sed é:

sed [opções] regras [arquivo]

Sendo que regras tem a forma genérica de:

[endereço1 [, endereço2]] comando [argumento]


Como dica geral SEMPRE coloque os comandos do Sed entre aspas simples

$ more exemplo
Folha de Sao Paulo
O estado de Sao Paulo
Noticias Populares
Gazeta do Povo
O Globo

$sed -n 'p' exemplo 
Folha de Sao Paulo
O estado de Sao Paulo
Noticias Populares
Gazeta do Povo

O Globo

$ sed -n '1p' exemplo 
Folha de Sao Paulo

$ sed -n '2p' exemplo 
O estado de Sao Paulo

$ sed -n '3p' exemplo 
Noticias Populares



ENDEREÇO

Deleta a 2° linha ou a linha que contenha a palavra estado

$ sed '2d' exemplo 
Folha de Sao Paulo
Noticias Populares
Gazeta do Povo
O Globo

sed '/estado/d' exemplo 
Folha de Sao Paulo
Noticias Populares
Gazeta do Povo
O Globo


Imprimi a 2° linha ou a que contenha a palavra estado

$ sed -n '2p' exemplo 
O estado de Sao Paulo

$ sed -n '/estado/p' exemplo 
O estado de Sao Paulo



Deleta e imprimi linhas dentro do range 2 a 4

$ sed '2,4d' exemplo
Folha de Sao Paulo
O Globo

$ sed -n '2,4p' exemplo
O estado de Sao Paulo
Noticias Populares
Gazeta do Povo

Deleta e imprimi entre a linha 2 e a palavra gazeta:

$sed '2,/Gazeta/d' exemplo
Folha de Sao Paulo
O Globo

$ sed -n '2,/Gazeta/p' exemplo
O estado de Sao Paulo
Noticias Populares
Gazeta do Povo



Deleta e imprimi entre duas palavras:

$ sed '/estado/,/Gazeta/d' exemplo
Folha de Sao Paulo
O Globo

$ sed -n '/estado/,/Gazeta/p' exemplo
O estado de Sao Paulo
Noticias Populares
Gazeta do Povo


No endereço, temos um caractere especial, o $ que referencia à última linha do texto. Assim sendo, para apagar da linha 2 até o final do texto:

$ sed '2,$d' exemplo
Folha de Sao Paulo

Imprimir a linha, a linha mais 1 linha, e mais 2 linhas.....

$ sed -n '/estado/p' exemplo
O estado de Sao Paulo

$ sed -n '/estado/,+p' exemplo
O estado de Sao Paulo

$ sed -n '/estado/,+1p' exemplo
O estado de Sao Paulo
Noticias Populares

$ sed -n '/estado/,+2p' exemplo
O estado de Sao Paulo
Noticias Populares
Gazeta do Povo

$ sed -n '/estado/,+3p' exemplo
O estado de Sao Paulo
Noticias Populares
Gazeta do Povo
O Globo


Interrompa o sed até a primeira linha em branco

$ sed '/^$/q' exemplo


Colocando na frente do d ou p o simbolo !, invertemos a lógica do comando

$ sed -n '/estado/p' exemplo
O estado de Sao Paulo

$ sed -n '/estado/!p' exemplo
Folha de Sao Paulo
Noticias Populares
Gazeta do Povo
O Globo



Este comando apaga as linhas 5, 10 e as que têm estorvo do arquivotexto.txt.
$ sed '1d;3d;/estado/d' exemplo

Substitui a 1° ocorrencia (por linha) da palavra Gazeta por bobao no arquivo exemplo
sed -e 's/Gazeta/bobao/' exemplo



sed -e 's/Gazeta/bobao/g' exemplo

substitui no arquivo todo!

___________________________________________
Programa para obter os resultados do 3DNA

#Para executar o programa digite: 
#sed -n -f programa.sed 3dna_output.out > opening.dat


# Obter o conteúdo entre a TAG < > </ >
//{:a;/<\/opening>/!{N;ba;};p;}


# Para obter o conteúdo entre a TAG < > </ > retirando a TAG:
#//{/{<\/opening>}/tc;:a;/<\/opening>/!{N;ba;};:c;s/.*//;s/<\/opening>.*$//;p;}



ou ....



#!/bin/sh
sed -n '//{:a;/<\/alpha1>/!{N;ba;};p;}' ensemble_example.out > alpha1.dat


#inserir uma linha em rbanco no inicio do arquivo
 sed '1i\ ' arq > arq2




Texto editado de: http://aurelio.net/sed/sed-HOWTO/

VMD label under construction....

proc label_atoms { top all } {
  set sel [atomselect top all]
  set atomlist [$sel list]
  foreach {atom} $atomlist {
    set atomlabel [format "%d/%d" top $atom]
    label add Atoms $atomlabel
  }
}


set sel1 [atomselect top all]
set atomlist [$sel1 list]
foreach {atom} $atomlist {
    set atomlabel [format 0/2 top $atom]
    label add Atoms $atomlabel
        show type
  }




set sel [atomselect top all]
set a [$sel get type]

ptraj

# ptraj example

trajin eq_density.rst                       coordinates file to read
trajout reimaged.rst restart          output file in the same format as the input
center :1                                                    center the box to the geometric center of residue 1
image center                                                    force all the molecules into the primary unit cell

#Run ptraj according this syntax:
ptraj dna_solv.top < test.ptraj



trajin md2.mdcrd 1 19000 5 [start stop offset]
strip :WAT,Na+                      #take care with blank spaces
center :1-20 mass origin 
image origin center familiar 
trajout output.pdb pdb append 

If you use cpptraj you can omit the 'append' keyword from the
'trajout' command since MODEL/ENDMDL keywords are added automatically
for multiple frame PDB output files.




trajin eq_density.rst
trajout reimaged.rst restart
center :1-12
image center

trajin cie_solv_md3.mdcrd
trajin cie_solv_md4.mdcrd
center :1-25 mass origin 
image origin center familiar 
trajout output.cdf netcdf


9.1 ptraj coordinate input/output commands

trajin filename [ start stop offset] [remdtraj remdtrajtemp reptemp] 

reference filename

trajout filename [ format ] [ nobox ] [ nowrap ] [ append ] [ remdtraj ] [ lessplitjaverage ] [ little j big ] \
[ dumpqj parse ] [ title title ] [ application application ] [ program program ]

filename [ format ]: Specify the name of a file for output coordinates (filename) written
in a specific format (format). Currently supported formats are:


trajectory – Amber ascii trajectory, the default

restart – Amber restart

binpos – Scripps binary format

pdb – PDB, the traditional format (not the newer CIF files); if molecule information is present, TER cards will be written between molecules.

cdf | netcdf – Amber NetCDF binary trajectory

charmm – CHARMM DCD binary trajectory


Note that the allowable formats include both trajectory files (i.e., a series of frames) and
files that traditionally include only a single coordinate set. In this latter case, the filename
will be appended with .N where N is the frame number (unless the optional keyword
append is specified).

media e desvio

awk '{ total += $2; count++ } END { print total/count }' test_opening.dat





#!/usr/bin/awk -f
#
#     Programa para calcular media e desvio padrao em awk
#----------------------------------------------------------

{
   soma+=$1
   somaquad+=$1*$1
}

END {
       media=soma/NR
       desvpad=sqrt((somaquad - NR*media**2)/(NR - 1))
       printf    "Media (Desvio): %.2f  %.2f\n" , media, desvpad
    }




From:
http://blog.eldermarco.com/2011/06/media-e-desvio-padrao-em-awk/

VMD scripts


# mostrar o complexo (resid 1) e as aguas a 3 angstrons do cobre (index 3)
(water or resid 1) and same residue as (within 3 of index 3)
(water or nucleic) and within 3.5 of name Cu
water and same residue as (within 2.5 of resid 1)
water within 2.5 of resid 1
resid 2 3 and within 20 of index 13
name OW and (within 2 of backbone)
resname CIE DA DT DC DG and (within 4 of resname CIE)
resname 'Na+'
all and not resname "Cl-"

# coloque 'update selection' na guia trajectory
nucleic and (within 7 of resname CIE)
# neste caso vai selecionar so os átomos do nucleic que estao perto do serial 4
nucleic and (within 3 of resname CIE and serial 4)

#Selecionar apenas o restante das moleculas sem incluir o CIE
not resname CIE and within 5 of resname CIE

index 10 11 12
index 10 to 12

resname QUA pro
residue cys ala
resid 1 2 3

type H HO
element H C N O (?)

protein not hydrogen

vmd –parm7 acetone_solv.top –rst7 acetone_solv.rst
vmd –parm7 acetone_solv.top –crdbox “outputfile”.crd
mol addfile equil-press/equil-$i.crd type crdbox waitfor all



# diferença entre resid e residue

residue 0 to 342 # mostra os resíduos de um único domínio
resid 1 to 343 # mostra os resíduos dos vários domínios enumerdos de 1 até n. Normalmente as moléculas de água e os aminoácidos iniciam por 1, desta forma quando o selecionamos os dois aparecem na tela.


#Habilitar o log para verificar a ação equivalente da linha de comando
# no terminal digite:
log nome.log

log off

#Load script files
vmd -e load.tcl
vmd -e vmd.vmd

cat load.tcl
#LOAD FILES
set mol [mol new cie_solv.top type parm7 waitfor all]
for {set i 3} {$i <= 7} {incr i} {
    mol addfile cie_solv_md$i.mdcrd type netcdf waitfor all
}

#gravar arquivo pqr
vmd -dispdev text
set mol [mol new prot_solv.top type parm7 waitfor all]
mol addfile reimaged14.rst.1 type rst7
animate write pqr test.pqr
#animate write pqr {/home/marcos/Desktop/rst/aaaaaaa.pqr} beg 0 end 0 skip 1 0

#gravar trajetória e pdb de frames e seleção específica (não funciona porque as H2O se afastam)
vmd -dispdev text
set mol [mol new cie_solv.top type parm7 waitfor all]
mol addfile output.cdf type netcdf first 0 last 2000 step 1 waitfor all
set sel [atomselect top "all and same residue as (within 5 of resname CIE)"]
animate write dcd com_traj.dcd beg 1 end 2000 sel $sel
animate write pdb com_traj.pdb beg 1 end 1 sel $sel


# adicionar label pela linha de comando
label add Atoms 0/6323
label addspring 0 4296 4299 1


vmd > label
label add [Atoms|Bonds|Angles|Dihedrals] {atoms as /}
label addspring
label list              -- return label categories
label list   -- return id's of labels in given category
label [show|hide|delete] [index] -- 
Control specific label or all labels in category
label graph -- Return a list of values for the given label
for all animation frames
label textsize []
label textthickness []

# convenções no VMD
resid no VMD pode ser mais de um tipo de residuo, por ex:
resid 1 quer dizer os residuos CIE 1 e também a primeira molécula de água: SOLV 1
Assim pra salvar mais de um composto pode ser interessante utilizar: "resname CIE or resid 234 765", assim salvará apenas 3 resíduos


From:
http://www.ks.uiuc.edu/Research/vmd/vmd-1.7/ug/node192.html

VMD Command-Line Options

When started, the following command-line options may be given to VMD. Note that if a command-line option does not start with a dash (-), and is not part of another option, it is assumed to be a PDB filename. Thus, the Unix command
        vmd molecule.pdb
will start VMD and load a molecule from the file molecule.pdb. On the Windows platform, one must preface the VMD invocation with the Windows start command
        start vmd molecule.pdb
  • -m : Load all subsequent files into separate molecules. The -f and -m options may be specified multiple times on the command line in order to load multiple molecule containing one or more files.
  • -h | -? : Print a summary a command-line options to the console.
  • -e filename : After initialization, execute the text commands in filename, and then resume normal operation.
  • -psf filename : Load the specified molecule (in PSF format) at startup. The PSF file only contains the molecular structure; a PDB or DCD file must also be specified when this option is used.
  • -pdb filename : Load the specified molecule (in PDB format) at startup.
  • -dcd filename : Load the specified trajectory file (in binary DCD format) at startup. The DCD file only contains atomic coordinates; a PDB or PSF file must also be specified when this option is used.
  • - filename : Load the specified file using the given filetype.
  • -f : Load all subsequent files into the same molecule. This is the default. A new molecule is created for each invocation of -f; thus, vmd -f 1.pdb 2.pdb -f 3.pdbloads 1.pdb and 2.pdb into the same molecule and 3.pdb into a different molecule.

  • -dispdev < win | text | cave | caveforms | none > : Specify the type of graphical display to use. The possible display devices include:
    • win: a standard graphics display window.
    • text: do not provide any graphics display window.
    • cave: use the CAVE virtual environment for display, forms are disabled.
    • caveforms: use the CAVE virtual environment for display and with forms enabled. This is useful with -display machine:0 for remote display of the forms when the CAVE uses the local screen.
    • none: same as text.
    It is possible to use VMD as a filter to convert coordinate files into rendered images, by using the -dispdev text and -e options.
  • -dist z : Specify the distance to the VMD image plane.
  • -height y : Specify the height of the VMD image plane.
  • -pos x y : Specify the position for the graphics display window. The position (x,y) is the number of pixels from the lower-left corner of the display to the lower-left corner of the graphics window.
  • -size x y : Specify the size for the graphics display window, in pixels.
  • -nt : Do not display the VMD title at startup.
  • -startup filename : Use filename as the VMD startup command script, instead of the default .vmdrc or vmd.rc file.
  • -debug [level : Turn on output of debugging messages, and optionally set the current debug level (1=few messages ... 5=many verbose messages). Note this is only useful if VMD has been compiled with debugging option included.

DynDom - Protein Domain Motion - PBP

Programa online que identifica as regiões na proteína que sofrem modificações conformacionais tendo cmo ase duas estruturas. O programa pode ser baixado para estudar uma trajetória de MD.

Resíduos envolvidos no bending (hinge group) para as duas estruturas cristalizadas.
http://fizz.cmp.uea.ac.uk/dyndom/

resid 75 to 77 227 to 241 254 to 255




Gnuplot


# PRINT SYMBOL AND SUBSCRIPT/SUPERSCRIPT
set terminal postscript eps enhanced mono lw 1 "Helvetica" 28 size 6.0,4.0
set ylabel "{/Symbol q} [deg cm^2 dmol^{-1}]"      

# Print anstrom:
set encoding iso_8859_1        
set ylabel "RMSD [\305]"

# PRINT in png file
set term png
set output "energies.png"

# Fixar o tamanho do gráfico
set bmargin 1.5
set lmargin 1
set rmargin 1
set tmargin 1

# REMOVE X/Y TICS
set xtics ""
set ytics ""

set xtics 0.5
set ytics 0.3

# REMOVE LABELS
set format x ""
set format y ""
#REINTRODUCE LABELS AND SCALE
set format x

# Exponential
# exponential format: XXe+0X
set format x "%6.0e"

# XTICS
set xtics ("April" 1, "May" 2, "June" 3, "July" 4)

set xtics 10000

# EIXOS CARTESIANOS
set {x|x2|y|y2|z}zeroaxis { {linestyle | ls }
                                | { linetype | lt }
                                  { linewidth | lw }}
     unset {x|x2|y|y2|z}zeroaxis
     show {x|y|z}zeroaxis

set xzeroaxis ls 5 lt 3 lw 1.5

set yzeroaxis ls 5 lt 3 lw 1.5

# shell script
#!/bin/sh
gnuplot << EOF
set format x "%.1e"
set term png  lw 1 font 'Verdana,5'
set output "Mult.png"
set yrange [1.5:4]
set xrange [0:3513]
set multiplot layout 2,2
p "Cu-DC21_O1P.dat" u 1:2 w l lc -1 # cor preta lc -1
p "Cu-DC21_O2P.dat" u 1:2 w l
p "Cu-DC20_O1P.dat" u 1:2 w l
p "Cu-DC20_O2P.dat" u 1:2 w l

EOF
display Mult.png

# plotar mais de uma coluna num único arquivo
plot 'test.dat' title 'data', \
     ' ' u ($1-dx):(d($2)) title '1-variable derivative', \
     ' ' u ($1-dx):(d2($1,$2)) title '2-variable derivative', \
     ' ' u ($1-dx):(d2($1,$2)) smooth csplines title '2-variable derivative (smoothed)'



p "1.out" u 1:2 t "" w lines lt 1 lw 5

set multiplot layout 5,5
set tics scale 0 # scale of tics, 0 is without tics
set bmargin 1.5
set lmargin 1
set rmargin 1
set tmargin 1
# set title "TDDFT calculation"
set xrange [2:4]
set yrange [0:0.35]
# set xtics offset 0,graph 0.05 #position of the x label
set ytics offset 0,graph 0.1
#set xtics 0.5
#set ytics 0.3
set xlabel ""
set ylabel ""

# remove the legend, x and y labels
#set nokey
set format x ""
set format y ""

#change the tics marks and tics labels
set format x
set format y
set ytics offset 0,graph 0.1
set xtics 0.5
set ytics 0.3



XXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX PLOT ENERGIES FILE XXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXX

set term png
set output "energies.png"

set multiplot layout 2,3 title ""
set bmargin 3
#set xtics 20000
#set format x "%6.0e"
plot "ENERGIES" u 1:3 t "TEMPERATURE" w l
plot "ENERGIES" u 1:2 t "EKINC" w l
plot "ENERGIES" u 1:4 t "EKS" w l
plot "ENERGIES" u 1:5 t "ECLASSIC" w l
plot "ENERGIES" u 1:6 t "EHAM:conserved ?" w l


set multiplot layout 1,2 title ""
set bmargin 3
set yrange [-0.5:4.5]
plot "ENERGIES" u 1:($5-$4) t "Enuclei" w l, "ENERGIES" u 1:(5*$2) t "5xEkinc" w l
set yrange [-82:-75.0]
plot "ENERGIES" u 1:4 t "EKS" w l, "ENERGIES" u 1:5 t "ECLASSIC" w l, "ENERGIES" u 1:6 t "EHAM:conserved ?" w l




set multiplot layout 2,3 title ""
set bmargin 3
plot "ENERGIES" u 1:2 t "EKINC" w l
plot "ENERGIES" u 1:3 t "TEMPERATURE" w l
plot "ENERGIES" u 1:4 t "EKS" w l, "ENERGIES" u 1:5 t "ECLASSIC" w l, "ENERGIES" u 1:6 t "EHAM:conserved ?" w l




XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXX PLOT ELECTRONIC SPECTRA XXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


grep "f=" tddft_original.out | awk '{print $3,$6}' > 1.txt
gnuplot
set title "TDDFT calculation"
set xlabel ""
set ylabel "Transition (eV)"
plot "1.txt" u 1:2 title "Absorsion" w impulses




XXXXXXXXX OTHERS XXXXXXXXXXXXXXXX
exponential format: XXe+0X
set format x "%6.0e"

set term png
set output "energies.png"


set xtics ("April" 1, "May" 2, "June" 3, "July" 4)

set xtics 10000

plot "test.dat" using 1:2:3 with yerrorbars
plot "test.dat" using 1:2:3 with xerrorbars


Create a title:                  > set title "Force-Deflection Data"
Put a label on the x-axis:       > set xlabel "Deflection (meters)"
Put a label on the y-axis:       > set ylabel "Force (kN)"
Change the x-axis range:         > set xrange [0.001:0.005]
Change the y-axis range:         > set yrange [20:500]
Have Gnuplot determine ranges:   > set autoscale
Put a label on the plot:         > set label "yield point" at 0.003, 260
Change the tic-marks:            >
set xtics 3000
set xtic ("0" 0,"3" 3000,"6" 6000,"9" 9000,"12" 12000,"15" 15000)
Move the key:                    > set key 0.01,100
Delete the Label line:           > unset key


set terminal postscript eps color lw 3 "Helvetica" 20
set output "spectra.eps"

#SOMAR COLUNA
 awk '{ soma = soma + $7} END {print soma} ' < cu.mol2



gnuplot
set multiplot
set xlabel ""
set ylabel ""
set size 1,0.2
set format x ""
set origin 0.0,0.8; plot "ENERGIES" u 1:2 t "EKINC" w l
set origin 0.0,0.6; plot "ENERGIES" u 1:3 t "TEMPERATURE" w l
set origin 0.0,0.4; plot "ENERGIES" u 1:4 t "EKS" w l
set origin 0.0,0.2; plot "ENERGIES" u 1:5 t "ECLASSIC" w l
set title "/local/GRS/Users/claudia/faceAB/5_TDDFT/CINCO/VEINTE"
set format x " %10.0f"
set xlabel "n steps"
set origin 0.0,0.0; plot "ENERGIES" u 1:6 t "EHAM:conserved ?" w l



#####
DOS

gnuplot
set terminal postscript eps color lw 2 "Helvetica" 20
set xrange [-13.75:-11.75]
#set multiplot layout 2,2
set output "apyhist.eps"
p  "./apyhist.txt" u 1:4 w l lw 4 lt 1  lc 9 t "Copper", "./apyhist.txt" u 1:5 w l lw 4 lt 1 lc 9 t "", "./apyhist.txt" u 1:6 w l lw 4 lt 1 lc 1 t "Coordinating Atoms", "./apyhist.txt" u 1:7 w l lw 4 lt 1 lc 1 t "", "./apyhist.txt" u 1:2 w l lw 4 lt 2 t "Total", "./apyhist.txt" u 1:3 w l lw 4 lt 2 t ""
set output "apzhist.eps"
p  "./apzhist.txt" u 1:4 w l lw 4 lt 1  lc 9 t "Copper", "./apzhist.txt" u 1:5 w l lw 4 lt 1 lc 9 t "", "./apzhist.txt" u 1:6 w l lw 4 lt 1 lc 1 t "Coordinating Atoms", "./apzhist.txt" u 1:7 w l lw 4 lt 1 lc 1 t "", "./apzhist.txt" u 1:2 w l lw 4 lt 2 t "Total", "./apzhist.txt" u 1:3 w l lw 4 lt 2 t ""
set output "apyepyt.eps"
p  "./apyepy.txt" u 1:4 w l lw 4 lt 1  lc 9 t "Copper", "./apyepy.txt" u 1:5 w l lw 4 lt 1 lc 9 t "", "./apyepy.txt" u 1:6 w l lw 4 lt 1 lc 1 t "Coordinating Atoms", "./apyepy.txt" u 1:7 w l lw 4 lt 1 lc 1 t "", "./apyepy.txt" u 1:2 w l lw 4 lt 2 t "Total", "./apyepy.txt" u 1:3 w l lw 4 lt 2 t ""
set output "apzepy.eps"
p  "./apzepy.txt" u 1:4 w l lw 4 lt 1  lc 9 t "Copper", "./apzepy.txt" u 1:5 w l lw 4 lt 1 lc 9 t "", "./apzepy.txt" u 1:6 w l lw 4 lt 1 lc 1 t "Coordinating Atoms", "./apzepy.txt" u 1:7 w l lw 4 lt 1 lc 1 t "", "./apzepy.txt" u 1:2 w l lw 4 lt 2 t "Total", "./apzepy.txt" u 1:3 w l lw 4 lt 2 t ""
exit

####
Fit

gnuplot
f(x) = mean_y
fit f(x) 'thr10_1.agr' u 1:2 via mean_y

set multiplot layout 2,2 columnsfirst

################
Average

echo "scale=2; `cat X2_X3a.dat | gawk '{sum+=$1}END{print sum}'` / `cat X2_X3a.dat | wc -l`" | bc



###############################

# Two axes
gnuplot
set xrange [200:800]
set yrange [0:0.45]
set y2range [0:45000]
set nokey
#set ytics 0.5 nomirror tc lt 1
#set ylabel '2*x' tc lt 1

#set y2tics 20000 nomirror tc lt 10000
#set y2label 'Absortion' tc lt 10000

plot 'UVData.txt' u 3:4 w i linetype 2, 'UVSpectrum.txt' u 2:3 w l linetype 1 axes x1y2 



# Plot using 2 axes
gnuplot << EOF

set term png lw 1 font 'Verdana,5'
set output "Mult.png"
set xrange [200:800]
#set yrange [0:0.45]
#set y2range [0:45000]
#set nokey
#set ytics 0.5 nomirror tc lt 1
#set ylabel '2*x' tc lt 1

#set y2tics 20000 nomirror tc lt 10000
#set y2label 'Absortion' tc lt 10000

set multiplot layout 3,1

plot 'gausssum2.2/UVData.txt' u 3:4 t "RHO2" w i linetype 2 , 'gausssum2.2/UVSpectrum.txt' u 2:3 t "" w l linetype 1 axes x1y2 
plot 'R1/gausssum2.2/UVData.txt' u 3:4  t "R1" w i linetype 2, 'R1/gausssum2.2/UVSpectrum.txt' u 2:3 t "" w l linetype 1 axes x1y2 
plot 'R2/gausssum2.2/UVData.txt' u 3:4   t "R2" w i linetype 2, 'R2/gausssum2.2/UVSpectrum.txt' u 2:3 t ""  w l linetype 1 axes x1y2 

EOF
display Mult.png &

Sites interessantes:
http://www.gnuplotting.org/

Shell commands

TAR

tar -xf \a\b\ca.tar file

tar -tvf  xxx.tar (list the contents of a tar or gzip file)

tar -tvf RHO.tar | sed -n '/leap/p'

tar --extract --file={tarball.tar} {file} 
example: tar --extract --file=rho.tar rho.pdb

tar cvf ~/a.tar `find -name tddft.out`

tar cvf a.tar --exclude=*.chk *


awk {'print $3,$6,$7,$8'} QM.coor

tail -n X file list X final lines from file

ls -p | grep "/" list only directories

diff FILE1 FILE2 compare 2 different files

GREP

grep "f=" $i | awk '{print $3,$6}' > $i

grep -A3 "STATE=" 12.out (3 lines after find "STATE")

grep -B3 "STATE=" 12.out (3 lines before find "STATE")

grep -v case #(everything except case) cat 1XDN.pdb | grep -v " HOH "
| grep -v " ATP " | grep -v " MG " > rece

Find

find ./* -type f -exec grep -l tddft {} \; | more

find ./ -size +1G -name *dcd

find . -iname "*.out"

find bin opt -iname "*.out"


cat 12.out|head -100|tail -50

ls *out | wc -l

paste file1 file2 > file3 paste name telephone > nameNtelephone

killall -9 cpmd.x

du -sh

touch -t 201204261000 *

sort -k 7 -n file sort 7th column in numerical order

sort -k 7 -r file sort 7th column in reverse order

awk {'print $1,'$i''} print the column 1 and the variable $i. Note
that the variable is in 'quotes'

cat filedata | awk '{ sum+=$8} END {print sum}'         sum a column of numbers


cat close_contacts.dat | sed 's/ /\'$'\n''/g' > a.dat # convert lines
in a file in column

printf '1 2 3 4' | sed 's/ /\'$'\n''/g' # convert line in column

emacs rectangle:

chmod +w file.dat

1)put the cursor in the top left point and press Ctr SPC

2) move the cursor to the botton rigth point and press: Ctr-x r


C-x r k Kill rectangle

C-x r d Delete rectangle

C-x r y Yank rectangle

C-x r c Clear rectangle

terça-feira, 1 de outubro de 2013

Amber frcmod file - Dihedral info

Here I show the dihedral part of the frcmod file from Amber code.

DIHE       divider  Force       Phase             Periodicity
ca-ca-cd-cc   1    2.550       180.000           2.000      same as X -c2-ca-X
ca-ca-cd-nh   1    2.550       180.000           2.000      same as X -c2-ca-X
na-cc-os-Cu   1    1.050       180.000           2.000      same as X -c2-os-X (?)
cc-os-Cu-nh   1    1.050         1.000           2.000      ATTN, need revision (?)
cc-os-Cu-os   1    0.000       180.000           2.000      ATTN, need revision (?)
cd-cc-os-Cu   1    1.050       180.000           2.000      same as X -c2-os-X (?)
cd-nh-Cu-os   1    1.050         1.000           2.000      ATTN, need revision (?)
cd-nh-Cu-nh   1    1.050       180.000           2.000      ATTN, need revision (?)
os-Cu-nh-c3   1    1.050       178.000           2.000      MBG, need revision
os-Cu-nh-cc   1    1.050       180.000           6.900      MBG, at least 2 minima
os-Cu-os-cd   1    1.050       177.000           2.000      MBG, need revision
Cu-os-cd-cc   1    1.050         0.800           2.000      MBG, as X -c2-os-X
Cu-os-cd-na   1    1.050       179.000           2.000      MBG, same as X -c2-os-X
nh-Cu-nh-c3   1    1.050         2.200           2.000      MBG, need revision
nh-Cu-nh-cc   1    1.050      -176.000           2.000      MBG, need revision
nh-Cu-os-cd   1    1.050       180.000           2.950      MBG, 2 minima
nh-cc-ca-ca   1    2.550       180.000           2.000      same as X -c2-ca-X
cd-cc-ca-ca   1    2.550       180.000           2.000      same as X -c2-ca-X


%FLAG DIHEDRAL_FORCE_CONSTANT
%FORMAT(5E16.8)  (PK(i), i=1,NPTRA)
  PK     : force constant for the dihedrals of each type, kcal/mol

%FLAG DIHEDRAL_PERIODICITY
%FORMAT(5E16.8)  (PN(i), i=1,NPTRA)
  PN     : periodicity of the dihedral of a given type

%FLAG DIHEDRAL_PHASE
%FORMAT(5E16.8)  (PHASE(i), i=1,NPTRA)
  PHASE  : phase of the dihedral of a given type, radians

3DNA

1) rodar ptraj pra converter a trajetória mdcrd em pdb:

more test.ptraj
trajin dna_solv_md1.mdcrd 1 599 100 
strip :WAT,Na+
center :1-12 mass origin
image origin center familiar

trajout output.pdb pdb append

 ptraj dna_solv.top < test.ptraj


2) rodar o find_pair
find_pair [OPTION] PDBFILE OUTFILE

3) 
ANÁLISE PARA UM FRAME:
analyse dna.inp

ANÁLISE PARA UMA TRAJETÓRIA:
rodar o x3dna_ensemble analyze -b dna.inp -e output.pdb 
/Desktop/DNA/DNA_6/GCCGGC/4-MD


ASSIM COM O INPUT (dna.inp), executar o comando analyse:

analyse dna.inp

__________________________



EXECUTA O COMANDO:
find_pair  dna.pdb dna.inp

handling file
uncommon residue DG5    1  on chain   [#1] assigned to: g
uncommon residue DC3    6  on chain   [#6] assigned to: c
uncommon residue DG5    7  on chain   [#7] assigned to: g
uncommon residue DC3   12  on chain   [#12] assigned to: c


Assim obtém o arquivo de input dna.inp



dna.pdb
dna.out
    2         # duplex
    6         # number of base-pairs
    1    1    # explicit bp numbering/hetero atoms
    1   12  0 #    1 | ..1.>-:...1_:[DG5]g-----c[DC3]:..12_:-<..1.  0.21  0.16 32.59  8.95 -2.84
    2   11  0 #    2 | ..1.>-:...2_:[.DC]C-----G[.DG]:..11_:-<..1.  1.29  1.27 22.18  9.05 -0.06
    3   10  0 #    3 | ..1.>-:...3_:[.DG]G-----C[.DC]:..10_:-<..1.  0.95  0.82 18.09  9.13 -1.51
    4    9  0 #    4 | ..1.>-:...4_:[.DC]C-----G[.DG]:...9_:-<..1.  0.93  0.22 14.21  8.93 -2.92
    5    8  0 #    5 | ..1.>-:...5_:[.DG]G-----C[.DC]:...8_:-<..1.  0.58  0.48 23.29  9.03 -2.28
    6    7  0 #    6 | ..1.>-:...6_:[DC3]c-----g[DG5]:...7_:-<..1.  1.62  1.61 36.71  8.63  1.67
##### Base-pair criteria used:     4.00     0.00    15.00     2.50    65.00     4.50     7.80 [ O N]
##### 0 non-Watson-Crick base-pairs, and 1 helix (0 isolated bps)

##### Helix #1 (6): 1 - 6

Não sei o que são os valores a direita





3) rodar o x3dna_ensemble analyze -b dna.inp -e output.pdb 
/Desktop/DNA/DNA_6/GCCGGC/4-MD


ASSIM COM O INPUT (dna.inp), executar o comando analyse:

analyse dna.inp


 more dna.out 
****************************************************************************
    3DNA v2.1 (2013), created and maintained by Xiang-Jun Lu (PhD)
****************************************************************************
1. The list of the parameters given below correspond to the 5' to 3' direction
   of strand I and 3' to 5' direction of strand II.

2. All angular parameters, except for the phase angle of sugar pseudo-
   rotation, are measured in degrees in the range of [-180, +180], and all
   displacements are measured in Angstrom units.
****************************************************************************
File name: dna.pdb
Date and time: Thu Oct 10 15:18:44 2013

Number of base-pairs: 6
Number of atoms: 386
****************************************************************************
****************************************************************************
RMSD of the bases (----- for WC bp, + for isolated bp, x for helix change)

            Strand I                    Strand II          Helix
   1   (0.068) ..1.>-:...1_:[DG5]g-----c[DC3]:..12_:-<..1. (0.035)     |
   2   (0.032) ..1.>-:...2_:[.DC]C-----G[.DG]:..11_:-<..1. (0.069)     |
   3   (0.058) ..1.>-:...3_:[.DG]G-----C[.DC]:..10_:-<..1. (0.038)     |
   4   (0.033) ..1.>-:...4_:[.DC]C-----G[.DG]:...9_:-<..1. (0.063)     |
   5   (0.049) ..1.>-:...5_:[.DG]G-----C[.DC]:...8_:-<..1. (0.049)     |
   6   (0.030) ..1.>-:...6_:[DC3]c-----g[DG5]:...7_:-<..1. (0.057)     |

****************************************************************************
(RMSD em relação ao DNA canônico)



****************************************************************************
Detailed H-bond information: atom-name pair and length [ O N]
   1 g-----c  [3]  O6 - N4  3.02  N1 - N3  2.81  N2 - O2  3.01
   2 C-----G  [3]  N4 - O6  3.39  N3 - N1  3.02  O2 - N2  2.92
   3 G-----C  [3]  O6 - N4  3.48  N1 - N3  3.14  N2 - O2  2.74
   4 C-----G  [3]  N4 - O6  2.93  N3 - N1  2.99  O2 - N2  2.98
   5 G-----C  [3]  O6 - N4  3.10  N1 - N3  3.06  N2 - O2  2.98
   6 c-----g  [3]  N4 - O6  2.98  N3 - N1  2.93  O2 - N2  2.78

****************************************************************************
(distância das ligações de hidrogênio entre as bases)



****************************************************************************
Overlap area in Angstrom^2 between polygons defined by atoms on successive
bases. Polygons projected in the mean plane of the designed base-pair step.

Values in parentheses measure the overlap of base ring atoms only. Those
outside parentheses include exocyclic atoms on the ring. Intra- and
inter-strand overlap is designated according to the following diagram:

                    i2  3'      5' j2
                       /|\      |
                        |       |
               Strand I |       | II
                        |       |
                        |       |
                        |      \|/
                    i1  5'      3' j1

     step      i1-i2        i1-j2        j1-i2        j1-j2        sum
   1 gC/Gc  0.86( 0.04)  0.00( 0.00)  0.00( 0.00)  1.65( 0.35)  2.52( 0.39)
   2 CG/CG  0.60( 0.00)  0.00( 0.00)  0.55( 0.00)  2.97( 0.80)  4.13( 0.80)
   3 GC/GC  3.83( 1.49)  0.00( 0.00)  0.00( 0.00)  5.22( 2.35)  9.05( 3.84)
   4 CG/CG  1.21( 0.00)  0.00( 0.00)  1.12( 0.00)  0.58( 0.00)  2.90( 0.00)
   5 Gc/gC  4.67( 2.05)  0.00( 0.00)  0.00( 0.00)  2.43( 0.37)  7.11( 2.43)

****************************************************************************
(valores mais importantes são os entre parênteses)
The same strand (intrastrand crosslink) 
The opposite strands of the DNA (interstrand crosslink).

****************************************************************************
Origin (Ox, Oy, Oz) and mean normal vector (Nx, Ny, Nz) of each base-pair in
   the coordinate system of the given structure

      bp        Ox        Oy        Oz        Nx        Ny        Nz
    1 g-c     29.711    27.758    19.769    -0.256    -0.075     0.964
    2 C-G     29.755    27.143    24.577     0.214     0.006     0.977
    3 G-C     30.188    27.559    27.233     0.125     0.062     0.990
    4 C-G     30.319    28.629    31.019     0.126     0.179     0.976
    5 G-C     30.297    28.839    34.366     0.066     0.172     0.983
    6 c-g     30.555    29.126    38.647    -0.095     0.297     0.950
****************************************************************************




Local base-pair parameters
     bp        Shear    Stretch   Stagger    Buckle  Propeller  Opening
    1 g-c      -0.01     -0.13      0.16     15.10     28.88     -0.04
    2 C-G       0.19     -0.17      1.27    -11.34    -19.07     -3.46
    3 G-C      -0.40      0.27      0.82     13.24    -12.34      9.70
    4 C-G       0.85     -0.31      0.22     -8.56    -11.34     -4.12
    5 G-C       0.33      0.00      0.48    -14.21    -18.45     -2.44
    6 c-g      -0.08     -0.10      1.61    -36.36      5.08      3.49
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ave.      0.15     -0.07      0.76     -7.02     -4.54      0.52
      s.d.      0.43      0.20      0.59     19.15     18.55      5.28
****************************************************************************




Local base-pair step parameters
    step       Shift     Slide      Rise      Tilt      Roll     Twist
   1 gC/Gc     -0.00      0.47      4.82     -4.10    -27.28     42.72
   2 CG/CG     -0.25     -0.21      2.70      6.04      0.54     26.19
   3 GC/GC     -0.60     -0.36      3.87     -0.07     -6.79     46.04
   4 CG/CG      0.07     -0.51      3.31      2.96     -1.85     33.13
   5 Gc/gC      0.47     -0.64      4.22     -5.17    -10.62     40.75
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ave.     -0.06     -0.25      3.79     -0.07     -9.20     37.77
      s.d.      0.40      0.43      0.82      4.71     11.00      8.02
****************************************************************************




Local base-pair helical parameters
    step       X-disp    Y-disp   h-Rise     Incl.       Tip   h-Twist
   1 gC/Gc      3.38     -0.42      3.88    -33.60      5.05     50.50
   2 CG/CG     -0.57      1.80      2.58      1.17    -13.11     26.87
   3 GC/GC      0.23      0.76      3.89     -8.62      0.09     46.51
   4 CG/CG     -0.57      0.37      3.33     -3.23     -5.17     33.31
   5 Gc/gC      0.53     -1.35      4.17    -14.88      7.25     42.36
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ave.      0.60      0.23      3.57    -11.83     -1.18     39.91
      s.d.      1.63      1.19      0.63     13.57      8.21      9.68
****************************************************************************


Structure classification: 

This is a right-handed nucleic acid structure
****************************************************************************
lambda: virtual angle between C1'-YN1 or C1'-RN9 glycosidic bonds and the
        base-pair C1'-C1' line

C1'-C1': distance between C1' atoms for each base-pair
RN9-YN1: distance between RN9-YN1 atoms for each base-pair
RC8-YC6: distance between RC8-YC6 atoms for each base-pair

    bp     lambda(I) lambda(II)  C1'-C1'   RN9-YN1   RC8-YC6
   1 g-c      58.2      50.6      10.7       8.9       9.8
   2 C-G      56.2      50.9      10.8       9.0       9.9
   3 G-C      58.1      62.1      10.6       9.1      10.3
   4 C-G      58.7      45.6      10.8       8.9       9.7
   5 G-C      56.3      47.6      10.9       9.0      10.0
   6 c-g      55.2      54.8      10.3       8.6       9.6









****************************************************************************
Classification of each dinucleotide step in a right-handed nucleic acid
structure: A-like; B-like; TA-like; intermediate of A and B, or other cases

    step       Xp      Yp      Zp     XpH     YpH     ZpH    Form
   1 gC/Gc   -2.14    8.79    0.78    0.93    7.93   -3.88
   2 CG/CG   -2.90    9.00    0.75   -3.64    8.98    1.13
   3 GC/GC   -3.15    8.91   -0.17   -2.94    8.80   -1.40     B
   4 CG/CG   -2.62    9.28    0.30   -3.09    9.29   -0.16     B
   5 Gc/gC   -2.90    8.45    0.49   -2.57    8.33   -1.52     B









****************************************************************************
Minor and major groove widths: direct P-P distances and refined P-P distances
   which take into account the directions of the sugar-phosphate backbones

   (Subtract 5.8 Angstrom from the values to take account of the vdw radii
    of the phosphate groups, and for comparison with FreeHelix and Curves.)

Ref: M. A. El Hassan and C. R. Calladine (1998). ``Two Distinct Modes of
     Protein-induced Bending in DNA.'' J. Mol. Biol., v282, pp331-343.

                  Minor Groove        Major Groove
                 P-P     Refined     P-P     Refined
   1 gC/Gc       ---       ---       ---       ---
   2 CG/CG       ---       ---       ---       ---
   3 GC/GC       9.3       ---      15.7       ---
   4 CG/CG       ---       ---       ---       ---
   5 Gc/gC       ---       ---       ---       ---
****************************************************************************



****************************************************************************
Global linear helical axis defined by equivalent C1' and RN9/YN1 atom pairs
Deviation from regular linear helix: 3.24(0.42)
Helix:     0.050   0.095   0.994
HETATM 9998  XS    X X 999      30.158  27.323  21.130
HETATM 9999  XE    X X 999      30.960  28.830  36.932
Average and standard deviation of helix radius:
      P: 9.32(0.43), O4': 6.32(0.50),  C1': 5.83(0.36)

Global parameters based on C1'-C1' vectors:

disp.: displacement of the middle C1'-C1' point from the helix
angle: inclination between C1'-C1' vector and helix (subtracted from 90)
twist: helical twist angle between consecutive C1'-C1' vectors
rise:  helical rise by projection of the vector connecting consecutive
       C1'-C1' middle points onto the helical axis

     bp       disp.    angle     twist      rise
   1 g-c      1.81     -4.90     43.18      2.80
   2 C-G      1.54     -6.45     30.09      3.81
   3 G-C      2.48     -5.11     39.24      2.89
   4 C-G      2.74     -9.14     35.00      2.93
   5 G-C      2.86     -7.24     44.91      3.46
   6 c-g      2.93     -4.36      ---       --- 
****************************************************************************
Main chain and chi torsion angles: 

Note: alpha:   O3'(i-1)-P-O5'-C5'
      beta:    P-O5'-C5'-C4'
      gamma:   O5'-C5'-C4'-C3'
      delta:   C5'-C4'-C3'-O3'
      epsilon: C4'-C3'-O3'-P(i+1)
      zeta:    C3'-O3'-P(i+1)-O5'(i+1)

      chi for pyrimidines(Y): O4'-C1'-N1-C2
          chi for purines(R): O4'-C1'-N9-C4

Strand I
  base    alpha    beta   gamma   delta  epsilon   zeta    chi
   1 g     ---     ---     72.5   144.7   -85.0   120.4   -63.7
   2 C    -93.5   126.6    63.4    82.9   170.0   -68.6  -152.4
   3 G    -67.9   177.4    74.5   152.4  -172.8  -103.8  -110.2
   4 C    -68.7   176.8    43.5   116.9   174.4   -92.7  -131.0
   5 G    -59.6   159.0    72.7   138.1   175.1   -88.7  -131.0
   6 c    -88.1  -138.7    48.9   150.9    ---     ---   -120.8

Strand II
  base    alpha    beta   gamma   delta  epsilon   zeta    chi
   1 c    -59.8   147.8    52.4   140.8    ---     ---   -123.5
   2 G    -59.3   160.5    48.7   134.5  -134.0   177.8   -95.1
   3 C    -75.3  -153.5    52.5   132.5  -167.6   -90.7  -110.2
   4 G    -56.4   170.9    51.4   131.3   170.5   -84.6  -121.8
   5 C    -74.2   179.4    59.8   134.6   175.6   -93.0  -110.6
   6 g     ---     ---     48.4   152.4  -162.9  -126.8  -108.0
****************************************************************************


****************************************************************************
Sugar conformational parameters: 

Note: v0: C4'-O4'-C1'-C2'
      v1: O4'-C1'-C2'-C3'
      v2: C1'-C2'-C3'-C4'
      v3: C2'-C3'-C4'-O4'
      v4: C3'-C4'-O4'-C1'

      tm: the amplitude of pucker
      P:  the phase angle of pseudorotation

Strand I
 base       v0      v1      v2      v3      v4      tm       P    Puckering
   1 g    -28.1    41.9   -37.6    25.0     0.9    40.5   158.4    C2'-endo
   2 C     -9.9    -8.4    21.4   -28.9    24.9    27.9    40.1    C4'-exo 
   3 G    -16.7    35.1   -38.7    29.5    -8.0    39.0   173.2    C2'-endo
   4 C    -29.9    25.5   -12.1    -5.2    23.7    30.0   113.7    C1'-exo 
   5 G    -40.8    46.8   -36.5    12.8    17.1    47.2   140.7    C1'-exo 
   6 c    -15.5    29.9   -31.3    23.3    -4.9    31.8   169.9    C2'-endo

Strand II
 base       v0      v1      v2      v3      v4      tm       P    Puckering
   1 c    -12.0    26.3   -29.8    24.2    -8.4    29.9   176.4    C2'-endo
   2 G    -40.2    49.2   -32.9    12.7    15.4    44.5   137.7    C1'-exo 
   3 C     -7.8    22.9   -27.2    21.7    -8.8    27.2   179.9    C2'-endo
   4 G    -35.9    46.0   -37.2    17.8    10.4    44.4   146.9    C2'-endo
   5 C    -23.5    32.8   -30.1    15.8     4.9    33.5   153.8    C2'-endo
   6 g    -15.5    27.9   -28.8    22.4    -4.8    29.3   169.7    C2'-endo
****************************************************************************




****************************************************************************
Same strand P--P and C1'--C1' virtual bond distances

                 Strand I                          Strand II
    step      P--P     C1'--C1'       step      P--P     C1'--C1'
   1 g/C       ---      4.48         1 c/G      6.67      5.37
   2 C/G      6.79      5.46         2 G/C      6.55      4.19
   3 G/C      7.46      4.93         3 C/G      7.10      5.30
   4 C/G      6.76      4.62         4 G/C      7.08      4.64
   5 G/c      7.41      5.85         5 C/g       ---      5.50
****************************************************************************
Helix radius (radial displacement of P, O4', and C1' atoms in local helix
   frame of each dimer)

                        Strand I                      Strand II
     step         P        O4'       C1'        P        O4'        C1'
   1 gC/Gc      7.86      4.28      4.44      8.11      4.98      5.17
   2 CG/CG     10.76      8.64      7.85      8.80      5.33      4.68
   3 GC/GC     10.15      7.01      6.43      8.42      5.44      5.10
   4 CG/CG      9.95      6.71      6.12      9.64      6.61      6.00
   5 Gc/gC      7.17      4.36      4.04     10.35      7.71      7.12
****************************************************************************
Position (Px, Py, Pz) and local helical axis vector (Hx, Hy, Hz)
         for each dinucleotide step

     step       Px        Py        Pz        Hx        Hy        Hz
   1 gC/Gc     32.76     28.04     22.22     -0.11      0.48      0.87
   2 CG/CG     28.25     27.96     26.09      0.05     -0.16      0.99
   3 GC/GC     29.56     28.30     29.09     -0.01      0.12      0.99
   4 CG/CG     30.38     28.09     32.73      0.11      0.08      0.99
   5 Gc/gC     30.20     30.31     36.43     -0.18      0.02      0.98