knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(DocTDA)
View(bio3d::elements)

Download de structures of five proteins of the Globin family derived from five different species. The following commands could be used to download this structures directly from the Protein Data Bank. Note that we only need to provide a list of PDB identifiers to the function and a pathways to the storing folder to download them.

globin_structures <- c("3RGK","1YMB","1MBO","1LHS","2NRL") #Select the structures you want to work with.
bio3d::get.pdb(globin_structures,path = "./Path_To_Folder" ) #Download the pdb files for each structure in the folder specified.
paths_to_str <- dir("./Path_To_Folder",full.names = T) #Create a vector with the absolute pathws to each downloaded structure.
structures <- read_multi_pdb(paths_to_str) #Reads all ped structures into R's environment.

Alternatively we will load the same structures stored as data in our package. We will extract the alpha carbon coordinates of each structure on the list.

data("structures") #load the globin strucutures.

class(structures$`1LHS`)

alpha_carbs <- extract_multiple_alpha(structures) #Produces a new list with the coordinates for the alpha carbons of the structures included in the previous list.

Compute max distances for each alpha carbon coordinate matrix.

max_distances <- compute_max_d_multi(alpha_carbs)

Computing barcodes for the selected alpha carbon structures.

barcodes_multi <- compute_homology_multi(alpha_carbs) #This function computes the barcodes for the 

You can also compute the barcode of an individual structure using this function.

barcode_A <- compute_homology(alpha_carbs[[1]])

barcode_B <- compute_homology(alpha_carbs[[2]])

barcode_B_no_cero <- barcode_B[!barcode_B[,"dimension"] == 0,]

barcode_B_no_one <- barcode_B[!barcode_B[,"dimension"] == 1,]

barcode_B_no_two <- barcode_B[!barcode_B[,"dimension"] == 2,]

barcode_B_no_one_two <- barcode_B[!barcode_B[,"dimension"] %in% c(1,2),]

barcode_B_no_one_two_pseudo <- add_pseudo_barcode(barcode_B_no_one_two)

library(DocTDA)
help(add_pseudo_barcode)

as.factor(barcode_A[,"dimension"])

compute_sim_barcode_pair(barcode_A,barcode_A)

barcode_plot <- plot_barcodes(as.matrix(barcode_B_no_one_two_pseudo)
)

class(barcode_A)
as.matrix(barcode_B_no_one_two_pseudo)

dimensions_plot <- plot_dimensions(as.matrix(barcode_B_no_one_two_pseudo)
)

cowplot::plot_grid(barcode_plot,dimensions_plot)
dev.off()
seq_to_compute <- seq(from = 0, to = max(barcode_individual[,2:3])+5,by = 0.1)
compute_pbf_for_curve(vec_vals = seq_to_compute,barcode = barcode_individual,dim_betti = 0)

#compute_pbf_for_curve()
#pdb_temp <- read.pdb("/home/jj/Desktop/DrugBank/SpikeProteinTest/6vxx.pdb")
#pdb_temp$remark
#test_clean <- get_bio_clean(pdb_temp,"/home/jj/Desktop/","6vxx")
#warnings()
#data_test <- read.pdb("/home/jj/Desktop/6vxx_bio_1_clean.pdb")

#pdbs <- dir("/home/jj/Desktop/DrugBank/PDBs/",full.names = T)
#extract_and_clean_multi(pdbs,"/temp")
library(DocTDA)
paths_to_bio <- "/home/jj/Desktop/DrugBank/PDBs_Bio_Clean/"
head(get_bio_assembly_information(paths_to_bio[1:10]))
cf_2 <- get(load(file = "/home/jj/Desktop/DrugBank/Database/control_file_2.Rda"))
cf_2 <- cf_2[1:10,]
colnames(cf_2)
test_par <- function(x){
  df_temp <- data.frame(t(x))
  return(df_temp)
  }
library(parallel)
cl <- makeCluster(2)
test <- parApply(cl,X = cf_2,1,test_par)
View(test[[1]])
rec <- "/home/jj/Desktop/DrugBank/Protein_PDBQT"
lig <- "/home/jj/Desktop/DrugBank/Drug_PDBQT"
out_path <- "/home/jj/Desktop/DrugBank/Experiment_One/"
pdb <- "/home/jj/Desktop/DrugBank/PDBs_Bio_Clean"
path_to_save_mat <- "/home/jj/Desktop/"

rec_files <- dir(rec,full.names = TRUE)[1:50]
lig_files <- dir(lig,full.names = TRUE)[1:100]
pdb_files <- dir(pdb,full.names = TRUE)[1:50]
out_path <- "/home/jj/Desktop/DrugBank/Experiment_One/Do"
path_to_save_mat <- "/home/jj/Desktop/"

ret_mat <- compute_by_square(bio_assay_pdbqt = rec_files,drug_pdbqt_paths = lig_files,output_path = out_path,bio_assay_paths =  pdb_files,exhaust = 8,save_control_matrix_path  = path_to_save_mat)
dim(ret_mat)
table(ret_mat)
View(ret_mat)
#create_vina_command(rec,lig,out_path,pdb_file,exhaust = 8)



#pdb_readed <- bio3d::read.pdb(rec)
#bio3d::com
#library(bio3d)
#bio3d::elements
#elements
#center_of_mass <- com(pdb_readed)
#rm("")

x_size <- range(pdb_readed$atom$x)[2] -range(pdb_readed$atom$x)[1]
y_size <- range(pdb_readed$atom$y)[2] -range(pdb_readed$atom$y)[1]
z_size <- range(pdb_readed$atom$z)[2] -range(pdb_readed$atom$z)[1]

#Parsing logs

file_test <- "/home/jj/Desktop/DrugBank/Experiment_One/1A00_bio_1_AND_DB00118.log"

parse_max_energy_vina <- function(log_file_path){
  read_temp <- readLines(log_file_path)
  max_bin_en <- as.numeric(strsplit(read_temp[which(grepl("kcal/mol",read_temp)) + 2]," ")[[1]][13])
  return(max_bin_en)
  }


#Copy drug 3D structures to antonio...

#scp /home/jj/Desktop/DrugBank/Drug_Structures/"3D structures.sdf"  antoniojr@10.30.227.10:"/home/antoniojr/Prueba\ similitud/Drugs"

#Copy split drugs to antonio

#scp /home/jj/Desktop/DrugBank/Drug_Structures/split_sdf.py   antoniojr@10.30.227.10:"/home/antoniojr/Prueba\ similitud/Drugs"

##python split_sdf.py 


jfores/DocTDA documentation built on March 19, 2022, 9:37 p.m.