python, character replacement


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 1  
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.
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Science: Mathematics
Difficulty: Medium
A 'Millinillion' is a real number.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Special character replacement

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

2. Shell Programming and Scripting

Trigger email from script if the Special Character replacement is successfull

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

3. Shell Programming and Scripting

sed - replacement file path with variable - Escaping / character

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

4. Programming

Python, How to print a character \

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

5. UNIX for Dummies Questions & Answers

global search and replacement of a non-ascii character

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

6. UNIX for Dummies Questions & Answers

banner character replacement

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

7. Shell Programming and Scripting

Sed-Special character replacement

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

8. Shell Programming and Scripting

KSH - Character Replacement

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

9. Shell Programming and Scripting

Character replacement

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

10. Shell Programming and Scripting

Help needed in character replacement in Korn Shell

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

Featured Tech Videos