02-19-2009
python, character replacement
Hello, I need to do this in python but I'm just learning py and it's quite urgent.
I have a script I created and need an interactive python script to modify part of a line.
MY SCRIPT
#ligand prep. Uses 'ind' prefix. The initial ligand must be ind.pdb. This
#generates ind.pdbqt.
prepare_ligand4.py -l ind.pdb -A hydrogens_bonds -U nphs_lps -o ind.pdbqt
#First a 'generic' receptor must be made. Here the molecule should be called
#rec.pdb
#The receptor has ad atom types (t), gasteiger charges (q) added. This also
#adds non-polar hydrogens (nphs) and bonds (bonds) so a torsion root can be
#found. The output is a *pdbqt file ready for dockng. The command is:
prepare_receptor4.py -r rec.pdb -o rec_rigid.pdbqt -A 'bonds'-A 'checkhydrogens' -U 'nphs'
#where *.pdb is input file and the output will be pdbqt.
#The flex and rigid receptors, use the receptor pdbqt made earlier
**** prepare_flexreceptor4.py -r rec_rigid.pdbqt -s TYR119_TRP312 -x rec_flex.pdbqt
#Movable residue list seperated by underscores.
#-s is the movable residue; this is aswell as the backbone and amide bonds are
#fixed. This makes 2 files, a flexible and a rigid, that is rec_flex.pdbqt and
#rec_rigid.pdbqt. Use the rigid file for grid
#param file.-x flex.pdbqt
#prep of flex docking
*** prepare_flexdocking4.py -l ind.pdbqt -r rec_flex.pdbqt -s TYR119_TRP312
#To prepare a gpf we use the rigid ligand. Use:ligand_types for hsg1="A_C_HD_N_OA"
prepare_gpf4.py -l ind.pdbqt -r rec_rigid.pdbqt -x rec_flex.pdbqt -p npts="150 150 150" -i ref.grid
#The ligand types are those obtained from, prepare_ligand_dict.py -l ind.pdbqt
#-d ./ligand.types. ref.grid holds the co ordinates for docking.
#making a file called ligand.types containing the types of residues.
#Thes atoms are used in creating the dpf, docking parameter file.
#The docking parameter file contains the information on the docking.
prepare_dpf4.py -l ind.pdbqt -r rec_rigid.pdbqt -i ref.dpf -p flexres=rec_flex.pdbqt -p set_ga=lga -p ga_num_evals=5000000 -o ind_rec_rigid.dpf
#This uses the ligand atoms. Other parameters should be varied. The resulting
#flexres specifies the flexible residue file. dpf is ind_rec_rigid.dpf.
#Now autogrid4 and autodock4 can be used.
autogrid4 -p rec_rigid.gpf -l dock.glg
#this makes the necessary maps and logs. Use the rigid receptor.
autodock4 -p ind_rec_rigid.dpf -l my_docking.dlg &
#the dpf is named after the receptor and ligand. Producing the docking log
#(dlg) which contains any errors and the results.
######################### ###################################################
At the lines I marked ***
there is
-s TYR119_TRP312
I need to be able to change this.
For example I need a prog that says
'enter movable residues seperated by underscore:
then replaces the capitalised bit. eg 'enter residues:'
I type ALA1_LYS2
the prog puts this on the line at the correct point.
Thanks
ps I'm a biochemist. Learning py but it will be ages.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
How do I replace a space " " character at a particular position in a line?
e.g. I have a file below
$ cat i2
111 002 A a
33 0011 B c
2222 003 C a
I want all the 1st spaces to be replaced with forward slash "/" and the 3rd spaces to have 5 spaces to get the output below:
111/002... (8 Replies)
Discussion started by: stevefox
8 Replies
2. Shell Programming and Scripting
Hi,
I am working on a command that replaces some occurrences of quotation marks in file. The quotation mark cannot be the first or the last character in line and cannot be preceded or followed by a comma.
I am not an expert in regular expressions, but I managed to create the following... (2 Replies)
Discussion started by: piooooter
2 Replies
3. Shell Programming and Scripting
Hey all.
Easy question.
I have a (ksh) varaible x. It contains the following (for example): N557788
I want to replace the "N" with a "-".
I've done this before but for the life of me I cannot remember how I did it.
Thanks.
mtw (2 Replies)
Discussion started by: mixxamike
2 Replies
4. Shell Programming and Scripting
Hi
I want to replace ./testsed.ksh
with
testsed.ksh
./ is to be removed
scriptnm=`sed -e 's/\.///' $0
does not work
Please help (3 Replies)
Discussion started by: usshell
3 Replies
5. UNIX for Dummies Questions & Answers
Can we able to replace the character # in banner command with some other characters. Can we able to blink the character in Kornshell (1 Reply)
Discussion started by: sivakumar.rj
1 Replies
6. UNIX for Dummies Questions & Answers
Hi, I need to do a global search and replacement of a non-ascii character. Let me first give the background of my problem.
Very frequently, I need to copy set of references from different sources. Typically, a reference would like this:
Banumathy et al., 2002 G. Banumathy, V. Singh and U.... (1 Reply)
Discussion started by: effjay
1 Replies
7. Programming
In python, if I use '\', error, use "\", error again, use '\\' or "\\", the print result will be \\
If I want to print a single \, what can I do?
Thanks in advance
Sorry... I have solved this problem...
Thanks anyway (2 Replies)
Discussion started by: Henryyy
2 Replies
8. Shell Programming and Scripting
Hi,,
I have the line below in a file:
$!VarSet |LFDSFN1| = '"E:\APC\Trials\20140705_427_Prototype Trial\Data\T4_20140705_Trial_Cycle_Data_13_T_Norm.txt" "VERSION=100 FILEEXT=\"*.txt\" FILEDESC=\"General Text\" "+""+"TITLE{SEARCH=NONE NAME=\"New Dataset\" LINE=1I want to write a script to change... (2 Replies)
Discussion started by: carlr
2 Replies
9. Shell Programming and Scripting
Hello Gurus,
I have a script developed...
#!/bin/bash
#---------------------------------------------------------------------
# This pScript will remove/replace the special characters fromfiles
#---------------------------------------------------------------------
trxdate="`date... (1 Reply)
Discussion started by: nanduedi
1 Replies
10. Shell Programming and Scripting
Hi Guys,
I have a file which needs to be replaced with tab delimited
AA§Orgin Name§Mapping based on prod_usa§§§§
BB§Date§2019-08-11 23:30:01§§§§
I am trying below code
sed 's// /g' test.txt
Expected
AA|Orgin Name|Mapping based on prod_usa|||
BB|Date|2019-08-11 23:30:01|||| (6 Replies)
Discussion started by: rohit_shinez
6 Replies
LEARN ABOUT DEBIAN
dh_pysupport
DH_PYSUPPORT(1) python-support DH_PYSUPPORT(1)
NAME
dh_pysupport - use the python-support framework to handle Python modules
SYNOPSIS
dh_pysupport [debhelper options] [-V X.Y] [-X item [...]] [-n] [module dirs ...]
DESCRIPTION
dh_pysupport is a debhelper program that will scan your package, detect public modules in /usr/lib/pythonX.Y/site-packages, and move them
to the shared Python modules location. It will generate appropriate postinst/prerm scripts to byte-compile modules installed there for all
available python versions.
It will also look for private Python modules and will byte-compile them with the current Python version. You may have to list the
directories containing private Python modules.
If a file named debian/pyversions exists, it is used to determine the python versions with which the package can work.
Appropriate dependencies on python-support, python and pythonX.Y are put in ${python:Depends}. The ${python:Versions} and
${python:Provides} optional substitution variables are made available as well.
OPTIONS
module dirs
If your package installs private python modules in non-standard directories, you can make dh_pysupport check those directories by
passing their names on the command line. By default, it will check /usr/lib/$PACKAGE, /usr/share/$PACKAGE, /usr/lib/games/$PACKAGE and
/usr/share/games/$PACKAGE
-n, --noscripts
Do not modify postinst/postrm scripts.
-d This option is deprecated.
-V X.Y
Force private modules to be bytecompiled with the specific X.Y python version, regardless of the default python version on the system.
-X item, --exclude=item
Exclude files that contain "item" anywhere in their filename from being taken into account to generate the python dependency. It also
excludes them from byte-compilation. You may use this option multiple times to build up a list of things to exclude.
CONFORMS TO
Python policy as of 2006-08-10
SEE ALSO
debhelper(7)
This program is a part of python-support but is made to work with debhelper.
AUTHORS
Josselin Mouette <joss@debian.org>, Raphael Hertzog <hertzog@debian.org>
1.0.15 2012-06-30 DH_PYSUPPORT(1)