Molecular Docking
obable
Convert mol2 -> Pdbqt using obable command line tool
app.jl
printstyled("\n Triple Negative Brest Cancer 🦚\n\n",color=:green)
current_path = pwd()
energy_minimize_structures_path = String("$current_path/energy-minimize-structures")
@info "Current path : $current_path"
@info "Energy Minimize structres path : $energy_minimize_structures_path "
# get all list of structures
all_mol2_structures = readdir(energy_minimize_structures_path)
name_folder = "converted"
function CreateFolder()
current_folder_list = readdir(pwd())
for i in current_folder_list
if i === name_folder
return
end
end
mkdir(name_folder)
end
CreateFolder() # to check whether folder is already there or not
for structure in all_mol2_structures
# to convert spelling into lowercase and remove mol2 extension
name = lowercase(split(structure,".")[1])
printstyled("Started working on $structure \t",color=:light_cyan)
structure_path = "$energy_minimize_structures_path/$structure"
# to run the command line tool
run(`obabel.exe -i mol2 $structure_path -o pdbqt -O ./converted/$name.pdbqt`)
printstyled("Compeleted $structure 🦚\n",color=:green)
endAutodock
app.jl
using DelimitedFiles
println("Autodock")
current_path = pwd()
autodock_path = "$current_path/middleware"
all_structures_path = "$current_path/converted"
all_structures = readdir("$all_structures_path")
docked_folder = "docked"
rececptor_name = "7AAD.pdbqt"
function CreateFolder(name_folder,path)
allFolder = readdir("$path")
for dir in allFolder
if dir === name_folder
return
end
end
mkdir("$current_path/$name_folder")
end
CreateFolder(docked_folder,current_path)
print(all_structures)
function CreateConfigFile(name_of_ligand,rececptor_name,path)
touch("$path/$name_of_ligand-config.txt")
open("$path/$name_of_ligand-config.txt","w") do io
writedlm(io,["ligand = $all_structures_path/$name_of_ligand.pdbqt" ,
"receptor = $rececptor_name",
"center_x = 20.262",
"center_y = 35.132",
"center_z = 21.294",
"size_x = 54",
"size_y = 54",
"size_z = 54",
"energy_range = 3 ",
"exhaustiveness = 8",
"num_modes = 10 "
])
end
printstyled("Created Comfig File for $name_of_ligand",color=:light_cyan)
end
for structure in all_structures
println("\n")
structure_name = lowercase(split("$structure",".")[1])
path = mkdir("$current_path/$docked_folder/$structure_name")
@info "Folder Created $path"
# create a config file for structure
CreateConfigFile("$structure_name",rececptor_name,"$path")
run(`$autodock_path/vina.exe --config $path/$structure_name-config.txt --log $path/$structure_name-output.txt`)
# command line tool
printstyled("Completed docking of $structure_name \n\n")
endRandom piece of code
to extrate autodock data from log file to create graph and automate mdx
mdexGenerator.jl
current_path = pwd()
docked_folder_path = "$current_path/docked"
get_all_folders_in_docked = readdir(docked_folder_path)
function ExtractFile(f,structure_name)
line = 0
println("```powershell filename=\"$structure_name\"")
for i in eachline(f)
line = line + 1
if line >= 25
println(i)
end
end
println("```\n\n")
end
# loop all folders
for dir in get_all_folders_in_docked
# printstyled("\n name of folder $dir \n\n",color=:light_yellow)
get_all_files = readdir("$docked_folder_path/$dir")
# loop through all files
done = 0
for files in get_all_files
f = open("$docked_folder_path/$dir/$dir-output.txt","r")
if done < 1
ExtractFile(f,dir)
done = done + 1
end
end
endTo read the File
path = "./lig/ligand.txt"
f = open(path,"r")
function finalFunction()
line = 0
for i in eachline(f)
line = line + 1
if line >= 25
println(i)
end
end
end🦚🦚🦚🦚🦚🦚🦚🦚🦚🦚🦚🦚🦚🦚🦚🦚🦚🦚🦚
mode | affinity | dist from best mode
| (kcal/mol) | rmsd l.b.| rmsd u.b.
-----+------------+----------+----------
1 -7.0 0.000 0.000
2 -6.9 2.092 2.744
3 -6.9 9.159 9.848
4 -6.9 1.687 3.128
5 -6.8 9.484 11.275
6 -6.7 9.748 12.336
7 -6.7 1.616 3.040
8 -6.7 15.879 18.360
9 -6.6 2.286 7.916
10 -6.6 7.649 12.197
Writing output ... done.