Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(cvq2)
- library(leaps)
- #Q2TEST f-ja kaip ir PHASE Q2 lygiai tokia pati
- q2test<-function(activity, predicted_activity) {
- prediction_error_sq<-(predicted_activity-activity)^2
- avg_activity<-mean(activity)
- sigma_y_sq<-(activity-avg_activity)^2
- q2test_val<-1-sum(prediction_error_sq)/sum(sigma_y_sq)
- return(q2test_val)
- }
- # cia is karto jau pKd imta:
- visu_CA_pKd<-read.table("visu_CA_pKd.csv", sep=",", header=TRUE)
- qsar1<-data.frame(K<-visu_CA_pKd$CAI)
- qsar1$x<-as.matrix(read.table("edragon_descriptors_fix4.csv", sep=",", skip=1))
- #random numbers:
- #> test <- sort(round(runif(10, 1, 40)))
- #> test
- test <- c(2, 3, 8, 9, 10, 16, 18, 19, 29, 35)
- #tada:
- train <- c(1, 4, 5, 6, 7, 11, 12, 13, 14, 15, 17, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40)
- r2=NULL
- r2good=NULL
- for (i in 1:1317 ) {
- fit.single<-lm(qsar1$K[train]~qsar1$x[train,i])
- r2[i]<-summary(fit.single)$r.squared
- if(r2[i]>0.25) {
- r2good[i]<-r2[i]
- }
- }
- good_deskr_nr<-NULL
- for (i in 1:1317 ) {
- if(r2[i]>0.25) {
- good_deskr_nr<-c(good_deskr_nr, i)
- }
- }
- #leaps<-regsubsets(qsar1$K[train]~qsar1$x[train,good_deskr_nr], data=qsar1, nvmax=3)
- #plot(leaps, scale="r2")
- CA1_geri_deskr<-c(292, 313, 331)
- qsar_1_train<-lm(qsar1$K[train] ~ qsar1$x[train, CA1_geri_deskr[1]] + qsar1$x[train, CA1_geri_deskr[2]] + qsar1$x[train, CA1_geri_deskr[3]])
- print(summary(qsar_1_train))
- qsar_1_test_pred_values<-coef(qsar_1_train)[1]+coef(qsar_1_train)[2]*qsar1$x[test, CA1_geri_deskr[1]]+coef(qsar_1_train)[3]*qsar1$x[test, CA1_geri_deskr[2]]+coef(qsar_1_train)[4]*qsar1$x[test, CA1_geri_deskr[3]]
- qsar_1_test<-lm(qsar_1_test_pred_values ~ qsar1$K[test])
- print(summary(qsar_1_test))
- x<-cbind(qsar1$x[train,c(CA1_geri_deskr[1], CA1_geri_deskr[2], CA1_geri_deskr[3])], qsar1$K[train])
- colnames(x)[4]<-"y"
- qsar_1_q2<-cvq2(x)
- print(qsar_1_q2)
- print(q2test(qsar1$K[test],qsar_1_test_pred_values))
- #==========================================
- qsar2<-data.frame(K<-visu_CA_pKd$CAII)
- qsar2$x<-as.matrix(read.table("edragon_descriptors_fix4.csv", sep=",", skip=1))
- r2=NULL
- r2good=NULL
- for (i in 1:1317 ) {
- fit.single<-lm(qsar2$K[train]~qsar2$x[train,i])
- r2[i]<-summary(fit.single)$r.squared
- if(r2[i]>0.25) {
- r2good[i]<-r2[i]
- }
- }
- good_deskr_nr<-NULL
- for (i in 1:1317 ) {
- if(r2[i]>0.25) {
- good_deskr_nr<-c(good_deskr_nr, i)
- }
- }
- #leaps<-regsubsets(qsar2$K[train]~qsar2$x[train,good_deskr_nr], data=qsar2, nvmax=3)
- #plot(leaps, scale="r2")
- CA2_geri_deskr<-c(298, 647, 1093)
- #kaip ir be leaps variantas:
- #tada imti didziausia is r2good ir salinti koreliacijas su kitais, rasti kuris nekoreliuoja
- #r2very_good istrintos koreliacijos su 1231 kuris labai geras sitame....
- #arba r2good kas gero tada dar ziureti su leaps
- #cia panaudot sena gal geriau
- qsar_2_train<-lm(qsar2$K[train] ~ qsar2$x[train, CA2_geri_deskr[1]] +qsar2$x[train, CA2_geri_deskr[2]] + qsar2$x[train, CA2_geri_deskr[3]])
- print(summary(qsar_2_train))
- qsar_2_test_pred_values<-coef(qsar_2_train)[1]+coef(qsar_2_train)[2]*qsar2$x[test, CA2_geri_deskr[1]]+coef(qsar_2_train)[3]*qsar2$x[test, CA2_geri_deskr[2]]+coef(qsar_2_train)[4]*qsar2$x[test, CA2_geri_deskr[3]]
- qsar_2_test<-lm(qsar_2_test_pred_values ~ qsar2$K[test])
- print(summary(qsar_2_test))
- x<-cbind(qsar2$x[train,c(CA2_geri_deskr[1], CA2_geri_deskr[2], CA2_geri_deskr[3])], qsar2$K[train])
- colnames(x)[4]<-"y"
- qsar_2_q2<-cvq2(x)
- print(qsar_2_q2)
- print(q2test(qsar2$K[test],qsar_2_test_pred_values))
- #=============================================
- qsar6<-data.frame(K<-visu_CA_pKd$CAVI)
- qsar6$x<-as.matrix(read.table("edragon_descriptors_fix4.csv", sep=",", skip=1))
- r2=NULL
- r2good=NULL
- for (i in 1:1317 ) {
- fit.single<-lm(qsar6$K[train]~qsar6$x[train,i])
- r2[i]<-summary(fit.single)$r.squared
- if(r2[i]>0.25) {
- r2good[i]<-r2[i]
- }
- }
- good_deskr_nr<-NULL
- for (i in 1:1317 ) {
- if(r2[i]>0.25) {
- good_deskr_nr<-c(good_deskr_nr, i)
- }
- }
- #leaps<-regsubsets(qsar6$K[train]~qsar6$x[train,good_deskr_nr[1:25]], data=qsar6, nvmax=3)
- #plot(leaps, scale="r2")
- CA6_geri_deskr<-c(271, 423, 942)
- qsar_6_train<-lm(qsar6$K[train] ~ qsar6$x[train, CA6_geri_deskr[1]] + qsar6$x[train, CA6_geri_deskr[2]] + qsar6$x[train, CA6_geri_deskr[3]])
- print(summary(qsar_6_train))
- qsar_6_test_pred_values<-coef(qsar_6_train)[1]+coef(qsar_6_train)[2]*qsar6$x[test, CA6_geri_deskr[1]]+coef(qsar_6_train)[3]*qsar6$x[test, CA6_geri_deskr[2]]+coef(qsar_6_train)[4]*qsar6$x[test, CA6_geri_deskr[3]]
- qsar_6_test<-lm(qsar_6_test_pred_values ~ qsar6$K[test])
- print(summary(qsar_6_test))
- x<-cbind(qsar6$x[train,c(CA6_geri_deskr[1], CA6_geri_deskr[2], CA6_geri_deskr[3])], qsar6$K[train])
- colnames(x)[4]<-"y"
- qsar_6_q2<-cvq2(x)
- print(qsar_6_q2)
- print(q2test(qsar6$K[test],qsar_6_test_pred_values))
- #===============================================
- qsar7<-data.frame(K<-visu_CA_pKd$CAVII)
- qsar7$x<-as.matrix(read.table("edragon_descriptors_fix4.csv", sep=",", skip=1))
- r2=NULL
- r2good=NULL
- for (i in 1:1317 ) {
- fit.single<-lm(qsar7$K[train]~qsar7$x[train,i])
- r2[i]<-summary(fit.single)$r.squared
- if(r2[i]>0.25) {
- r2good[i]<-r2[i]
- }
- }
- good_deskr_nr<-NULL
- for (i in 1:1317 ) {
- if(r2[i]>0.25) {
- good_deskr_nr<-c(good_deskr_nr, i)
- }
- }
- #leaps<-regsubsets(qsar7$K[train]~qsar7$x[train,good_deskr_nr[1:25]], data=qsar7, nvmax=3)
- #plot(leaps, scale="r2")
- CA7_geri_deskr<-c(422, 647, 942)
- qsar_7_train<-lm(qsar7$K[train] ~ qsar7$x[train, CA7_geri_deskr[1]] + qsar7$x[train, CA7_geri_deskr[2]] + qsar7$x[train, CA7_geri_deskr[3]])
- print(summary(qsar_7_train))
- qsar_7_test_pred_values<-coef(qsar_7_train)[1]+coef(qsar_7_train)[2]*qsar7$x[test, CA7_geri_deskr[1]]+coef(qsar_7_train)[3]*qsar7$x[test, CA7_geri_deskr[2]]+coef(qsar_7_train)[4]*qsar7$x[test, CA7_geri_deskr[3]]
- qsar_7_test<-lm(qsar_7_test_pred_values ~ qsar7$K[test])
- print(summary(qsar_7_test))
- x<-cbind(qsar7$x[train,c(CA7_geri_deskr[1], CA7_geri_deskr[2], CA7_geri_deskr[3])], qsar7$K[train])
- colnames(x)[4]<-"y"
- qsar_7_q2<-cvq2(x)
- print(qsar_7_q2)
- print(q2test(qsar7$K[test],qsar_7_test_pred_values))
- #===============================================
- qsar13<-data.frame(K<-visu_CA_pKd$CAXIII)
- qsar13$x<-as.matrix(read.table("edragon_descriptors_fix4.csv", sep=",", skip=1))
- r2=NULL
- r2good=NULL
- for (i in 1:1317 ) {
- fit.single<-lm(qsar13$K[train]~qsar13$x[train,i])
- r2[i]<-summary(fit.single)$r.squared
- if(r2[i]>0.25) {
- r2good[i]<-r2[i]
- }
- }
- good_deskr_nr<-NULL
- for (i in 1:1317 ) {
- if(r2[i]>0.25) {
- good_deskr_nr<-c(good_deskr_nr, i)
- }
- }
- #leaps<-regsubsets(qsar13$K[train]~qsar13$x[train,good_deskr_nr], data=qsar13, nvmax=3)
- #plot(leaps, scale="r2")
- CA13_geri_deskr<-c(365, 649, 937)
- qsar_13_train<-lm(qsar13$K[train] ~ qsar13$x[train, CA13_geri_deskr[1]] + qsar13$x[train, CA13_geri_deskr[2]] + qsar13$x[train, CA13_geri_deskr[3]])
- print(summary(qsar_13_train))
- qsar_13_test_pred_values<-coef(qsar_13_train)[1]+coef(qsar_13_train)[2]*qsar13$x[test, CA13_geri_deskr[1]]+coef(qsar_13_train)[3]*qsar13$x[test, CA13_geri_deskr[2]]+coef(qsar_13_train)[4]*qsar13$x[test, CA13_geri_deskr[3]]
- qsar_13_test<-lm(qsar_13_test_pred_values ~ qsar13$K[test])
- print(summary(qsar_13_test))
- x<-cbind(qsar13$x[train,c(CA13_geri_deskr[1], CA13_geri_deskr[2], CA13_geri_deskr[3])], qsar13$K[train])
- colnames(x)[4]<-"y"
- qsar_13_q2<-cvq2(x)
- print(qsar_13_q2)
- print(q2test(qsar13$K[test],qsar_13_test_pred_values))
- #===============================================
- qsar12<-data.frame(K<-visu_CA_pKd$CAXII)
- qsar12$x<-as.matrix(read.table("edragon_descriptors_fix4.csv", sep=",", skip=1))
- novel_descriptor<-read.table("novel_descriptor.csv", sep=",", header=TRUE)
- qsar12$x<-cbind(qsar12$x, novel_descriptor$T.OH..Cl.)
- r2=NULL
- r2good=NULL
- for (i in 1:1318 ) {
- fit.single<-lm(qsar12$K[train]~qsar12$x[train,i])
- r2[i]<-summary(fit.single)$r.squared
- if(r2[i]>0.25) {
- r2good[i]<-r2[i]
- }
- }
- good_deskr_nr<-NULL
- for (i in 1:1318 ) {
- if(r2[i]>0.25) {
- good_deskr_nr<-c(good_deskr_nr, i)
- }
- }
- #leaps<-regsubsets(qsar12$K[train]~qsar12$x[train,good_deskr_nr], data=qsar12, nvmax=3)
- #plot(leaps, scale="r2")
- CA12_geri_deskr<-c(1135, 1259, 1318)
- qsar_12_train<-lm(qsar12$K[train] ~ qsar12$x[train, CA12_geri_deskr[1]] + qsar12$x[train, CA12_geri_deskr[2]] + qsar12$x[train, CA12_geri_deskr[3]])
- print(summary(qsar_12_train))
- qsar_12_test_pred_values<-coef(qsar_12_train)[1]+coef(qsar_12_train)[2]*qsar12$x[test, CA12_geri_deskr[1]]+coef(qsar_12_train)[3]*qsar12$x[test, CA12_geri_deskr[2]]+coef(qsar_12_train)[4]*qsar12$x[test, CA12_geri_deskr[3]]
- qsar_12_test<-lm(qsar_12_test_pred_values ~ qsar12$K[test])
- print(summary(qsar_12_test))
- x<-cbind(qsar12$x[train,c(CA12_geri_deskr[1], CA12_geri_deskr[2], CA12_geri_deskr[3])], qsar12$K[train])
- colnames(x)[3]<-"nd"
- colnames(x)[4]<-"y"
- qsar_12_q2<-cvq2(x)
- print(qsar_12_q2)
- print(q2test(qsar12$K[test],qsar_12_test_pred_values))
- #===============================================
- #su CA 12, bet be naujo deskriptoriaus:
- r2=NULL
- r2good=NULL
- for (i in 1:1317 ) {
- fit.single<-lm(qsar12$K[train]~qsar12$x[train,i])
- r2[i]<-summary(fit.single)$r.squared
- if(r2[i]>0.25) {
- r2good[i]<-r2[i]
- }
- }
- good_deskr_nr<-NULL
- for (i in 1:1317 ) {
- if(r2[i]>0.25) {
- good_deskr_nr<-c(good_deskr_nr, i)
- }
- }
- #leaps<-regsubsets(qsar12$K[train]~qsar12$x[train,good_deskr_nr], data=qsar12, nvmax=3)
- #plot(leaps, scale="r2")
- CA12a_geri_deskr<-c(111, 275, 1135)
- qsar_12a_train<-lm(qsar12$K[train] ~ qsar12$x[train, CA12a_geri_deskr[1]] + qsar12$x[train, CA12a_geri_deskr[2]] + qsar12$x[train, CA12a_geri_deskr[3]])
- print(summary(qsar_12_train))
- qsar_12a_test_pred_values<-coef(qsar_12a_train)[1]+coef(qsar_12a_train)[2]*qsar12$x[test, CA12a_geri_deskr[1]]+coef(qsar_12a_train)[3]*qsar12$x[test, CA12a_geri_deskr[2]]+coef(qsar_12a_train)[4]*qsar12$x[test, CA12a_geri_deskr[3]]
- qsar_12a_test<-lm(qsar_12a_test_pred_values ~ qsar12$K[test])
- print(summary(qsar_12a_test))
- x<-cbind(qsar12$x[train,c(CA12a_geri_deskr[1], CA12a_geri_deskr[2], CA12a_geri_deskr[3])], qsar12$K[train])
- colnames(x)[3]<-"nd"
- colnames(x)[4]<-"y"
- qsar_12a_q2<-cvq2(x)
- print(qsar_12a_q2)
- print(q2test(qsar12$K[test],qsar_12a_test_pred_values))
- #===============================================
- #grafiko asys nuo/iki:
- minK<-4.3
- maxK<-9.4
- qsar1_sv<-coef(qsar_1_train)[1]+coef(qsar_1_train)[2]*qsar1$x[, CA1_geri_deskr[1]]+coef(qsar_1_train)[3]*qsar1$x[, CA1_geri_deskr[2]]+coef(qsar_1_train)[4]*qsar1$x[, CA1_geri_deskr[3]]
- qsar2_sv<-coef(qsar_2_train)[1]+coef(qsar_2_train)[2]*qsar2$x[, CA2_geri_deskr[1]]+coef(qsar_2_train)[3]*qsar2$x[, CA2_geri_deskr[2]]+coef(qsar_2_train)[4]*qsar2$x[, CA2_geri_deskr[3]]
- qsar6_sv<-coef(qsar_6_train)[1]+coef(qsar_6_train)[2]*qsar6$x[, CA6_geri_deskr[1]]+coef(qsar_6_train)[3]*qsar6$x[, CA6_geri_deskr[2]]+coef(qsar_6_train)[4]*qsar6$x[, CA6_geri_deskr[3]]
- qsar7_sv<-coef(qsar_7_train)[1]+coef(qsar_7_train)[2]*qsar7$x[, CA7_geri_deskr[1]]+coef(qsar_7_train)[3]*qsar7$x[, CA7_geri_deskr[2]]+coef(qsar_7_train)[4]*qsar7$x[, CA7_geri_deskr[3]]
- qsar13_sv<-coef(qsar_13_train)[1]+coef(qsar_13_train)[2]*qsar13$x[, CA13_geri_deskr[1]]+coef(qsar_13_train)[3]*qsar13$x[, CA13_geri_deskr[2]]+coef(qsar_13_train)[4]*qsar13$x[, CA13_geri_deskr[3]]
- qsar12_sv<-coef(qsar_12_train)[1]+coef(qsar_12_train)[2]*qsar12$x[, CA12_geri_deskr[1]]+coef(qsar_12_train)[3]*qsar12$x[, CA12_geri_deskr[2]]+coef(qsar_12_train)[4]*qsar12$x[, CA12_geri_deskr[3]]
- #grafikui<-cbind(qsar$K, qsar1, qsar2, qsar3)
- #colnames(grafikui)[1]<-"pKd"
- mod_qsar1<-lm(qsar1_sv[train]~qsar1$K[train])
- mod_qsar2<-lm(qsar2_sv[train]~qsar2$K[train])
- mod_qsar6<-lm(qsar6_sv[train]~qsar6$K[train])
- mod_qsar7<-lm(qsar7_sv[train]~qsar7$K[train])
- mod_qsar13<-lm(qsar13_sv[train]~qsar13$K[train])
- mod_qsar12<-lm(qsar12_sv[train]~qsar12$K[train])
- mod_qsar1t<-lm(qsar1_sv[test]~qsar1$K[test])
- mod_qsar2t<-lm(qsar2_sv[test]~qsar1$K[test])
- mod_qsar6t<-lm(qsar6_sv[test]~qsar6$K[test])
- mod_qsar7t<-lm(qsar7_sv[test]~qsar7$K[test])
- mod_qsar13t<-lm(qsar13_sv[test]~qsar13$K[test])
- mod_qsar12t<-lm(qsar12_sv[test]~qsar12$K[test])
- png("Edita2013_visom_CA.png", width=600, height=900)
- par(mfrow=c(3,2), mar=c(1,1,0,0), oma=c(6,6,0,0), cex.axis=2)
- plot(qsar1$K[train], qsar1_sv[train], tck = 0.02, pch=16, col="gray", cex=3, xlim=c(minK, maxK), ylim=c(minK, maxK), ann=FALSE, xaxt="n")
- points(qsar1$K[test], qsar1_sv[test], tck = 0.02, pch=15, cex=3)
- abline(mod_qsar1)
- title(bquote(atop("CA I", atop(R^2==0.83, R[TEST] ^2==0.70))), line = -4, cex.main=3, adj=0)
- #title('QSAR CAI train set', line = -3, cex.main=3)
- axis(1,col.axis = "transparent", tck = 0.02)
- plot(qsar2$K[train], qsar2_sv[train], tck = 0.02, pch=16, col="gray", cex=3, xlim=c(minK, maxK), ylim=c(minK, maxK), xlab=NA, ylab=NA, xaxt="n", yaxt="n")
- points(qsar2$K[test], qsar2_sv[test], tck = 0.02, pch=15, cex=3)
- abline(mod_qsar2)
- title(bquote(atop("CA II", atop(R^2==0.89, R[TEST] ^2==0.57))), line = -4, cex.main=3, adj=0)
- #title('QSAR CAII train set', line = -3, cex.main=3)
- axis(1,col.axis = "transparent", tck = 0.02)
- axis(2,col.axis = "transparent", tck = 0.02)
- plot(qsar6$K[train], qsar6_sv[train], tck = 0.02, pch=16, col="gray", cex=3, xlim=c(minK, maxK), ylim=c(minK, maxK), ann=FALSE, xaxt="n")
- points(qsar6$K[test], qsar6_sv[test], tck = 0.02, pch=15, cex=3)
- abline(mod_qsar6)
- title(bquote(atop("CA VI", atop(R^2==0.79, R[TEST] ^2==0.77))), line = -4, cex.main=3, adj=0)
- #title('QSAR CAVI train set', line = -3, cex.main=3)
- plot(qsar7$K[train], qsar7_sv[train], tck = 0.02, pch=16, col="gray", cex=3, xlim=c(minK, maxK), ylim=c(minK, maxK), ann=FALSE, xaxt="n", yaxt="n")
- points(qsar7$K[test], qsar7_sv[test], tck = 0.02, pch=15, cex=3)
- abline(mod_qsar7)
- title(bquote(atop("CA VII", atop(R^2==0.89, R[TEST] ^2==0.87))), line = -4, cex.main=3, adj=0)
- #title('QSAR CAVII train set', line = -3, cex.main=3)
- axis(1,col.axis = "transparent", tck = 0.02)
- axis(2,col.axis = "transparent", tck = 0.02)
- plot(qsar12$K[train], qsar12_sv[train], tck = 0.02, pch=16, col="gray", cex=3, xlim=c(minK, maxK), ylim=c(minK, maxK), ann=FALSE)
- points(qsar12$K[test], qsar12_sv[test], tck = 0.02, pch=15, cex=3)
- abline(mod_qsar12)
- title(bquote(atop("CA XII", atop(R^2==0.82, R[TEST] ^2==0.60))), line = -4, cex.main=3, adj=0)
- #title('QSAR CAXII train set', line = -3, cex.main=3)
- plot(qsar13$K[train], qsar13_sv[train], tck = 0.02, pch=16, col="gray", cex=3, xlim=c(minK, maxK), ylim=c(minK, maxK), yaxt="n", cex.lab=3)
- points(qsar13$K[test], qsar13_sv[test], tck = 0.02, pch=15, cex=3)
- abline(mod_qsar13)
- title(bquote(atop("CA XIII", atop(R^2==0.88, R[TEST] ^2==0.68))), line = -4, cex.main=3, adj=0)
- #title('QSAR CAXIII train set', line = -3, cex.main=3)
- axis(2,col.axis = "transparent", tck = 0.02)
- mtext(expression(paste(pK[d], ' (experimental)')), SOUTH<-1, line=2.5, cex=2, outer=TRUE)
- mtext(expression(paste(pK[d], ' (calculated)')), WEST<-2, line=2.5, cex=2, outer=TRUE)
- dev.off()
- #png("Edita2013_visom_CA_test.png", width=600, height=900)
- #par(mfrow=c(3,2), mar=c(1,1,0,0), oma=c(6,6,0,0), cex.axis=2)
- #plot(qsar1$K[test], qsar1_sv[test], tck = 0.02, pch=15, cex=3, xlim=c(minK, maxK), ylim=c(minK, maxK), ann=FALSE, xaxt="n")
- #abline(mod_qsar1t)
- #title(bquote(atop("CA I", R^2==0.70)), line = -3, cex.main=3)
- ##title('QSAR CAI test set', line = -3, cex.main=3)
- #axis(1,col.axis = "transparent", tck = 0.02)
- #plot(qsar2$K[test], qsar2_sv[test], tck = 0.02, pch=15, cex=3, xlim=c(minK, maxK), ylim=c(minK, maxK), xlab=NA, ylab=NA, xaxt="n", yaxt="n")
- #abline(mod_qsar2t)
- #title(bquote(atop("CA II", R^2==0.57)), line = -3, cex.main=3)
- ##title('QSAR CAII test set', line = -3, cex.main=3)
- #axis(1,col.axis = "transparent", tck = 0.02)
- #axis(2,col.axis = "transparent", tck = 0.02)
- #plot(qsar6$K[test], qsar6_sv[test], tck = 0.02, pch=15, cex=3, xlim=c(minK, maxK), ylim=c(minK, maxK), ann=FALSE, xaxt="n")
- #abline(mod_qsar6t)
- #title(bquote(atop("CA VI", R^2==0.77)), line = -3, cex.main=3)
- ##title('QSAR CAVI test set', line = -3, cex.main=3)
- #plot(qsar7$K[test], qsar7_sv[test], tck = 0.02, pch=15, cex=3, xlim=c(minK, maxK), ylim=c(minK, maxK), ann=FALSE, xaxt="n", yaxt="n")
- #abline(mod_qsar7t)
- #title(bquote(atop("CA VII", R^2==0.87)), line = -3, cex.main=3)
- ##title('QSAR CAVII test set', line = -3, cex.main=3)
- #axis(1,col.axis = "transparent", tck = 0.02)
- #axis(2,col.axis = "transparent", tck = 0.02)
- #plot(qsar12$K[test], qsar12_sv[test], tck = 0.02, pch=15, cex=3, xlim=c(minK, maxK), ylim=c(minK, maxK), ann=FALSE)
- #abline(mod_qsar12t)
- #title(bquote(atop("CA XII", R^2==0.36)), line = -3, cex.main=3)
- ##title('QSAR CAXII test set', line = -3, cex.main=3)
- #plot(qsar13$K[test], qsar13_sv[test], tck = 0.02, pch=15, cex=3, xlim=c(minK, maxK), ylim=c(minK, maxK), yaxt="n", cex.lab=3)
- #abline(mod_qsar13t)
- #title(bquote(atop("CA XIII", R^2==0.68)), line = -3, cex.main=3)
- ##title('QSAR CAXIII test set', line = -3, cex.main=3)
- #axis(2,col.axis = "transparent", tck = 0.02)
- #mtext(expression(paste(pK[d], ' (experimental)')), SOUTH<-1, line=2.5, cex=2, outer=TRUE)
- #mtext(expression(paste(pK[d], ' (calculated)')), WEST<-2, line=2.5, cex=2, outer=TRUE)
- #dev.off()
- #================================================
- #dabar paskaiciuoti, test setui
- #pKd skirtumus eperm ir spejamus
- #padaryti ju koreliacijas ir grafikus
- CA12_1_exprm<-qsar12$K[test]-qsar1$K[test]
- CA12_2_exprm<-qsar12$K[test]-qsar2$K[test]
- CA12_6_exprm<-qsar12$K[test]-qsar6$K[test]
- CA12_7_exprm<-qsar12$K[test]-qsar7$K[test]
- CA12_13_exprm<-qsar12$K[test]-qsar13$K[test]
- CA12_SUM_exprm<-CA12_1_exprm+CA12_2_exprm+CA12_6_exprm+CA12_7_exprm+CA12_13_exprm
- CA12_1_sp<-qsar12_sv[test]-qsar1_sv[test]
- CA12_2_sp<-qsar12_sv[test]-qsar2_sv[test]
- CA12_6_sp<-qsar12_sv[test]-qsar6_sv[test]
- CA12_7_sp<-qsar12_sv[test]-qsar7_sv[test]
- CA12_13_sp<-qsar12_sv[test]-qsar13_sv[test]
- CA12_SUM_sp<-CA12_1_sp+CA12_2_sp+CA12_6_sp+CA12_7_sp+CA12_13_sp
- #dabar vel tas pats tik cia jau sumuota pabaigoj:
- mod_CA12_1t<-lm(CA12_1_sp~CA12_1_exprm)
- mod_CA12_2t<-lm(CA12_2_sp~CA12_2_exprm)
- mod_CA12_6t<-lm(CA12_6_sp~CA12_6_exprm)
- mod_CA12_7t<-lm(CA12_7_sp~CA12_7_exprm)
- mod_CA12_13t<-lm(CA12_13_sp~CA12_13_exprm)
- mod_CA12_SUMt<-lm(CA12_SUM_sp~CA12_SUM_exprm)
- x<-cbind(CA12_1_sp, CA12_1_exprm)
- colnames(x)[2]<-"y"
- qsar_12_1_q2<-cvq2(x)
- print(qsar_12_1_q2)
- print(summary(mod_CA12_1t))
- print(summary(mod_CA12_2t))
- print(summary(mod_CA12_6t))
- print(summary(mod_CA12_7t))
- print(summary(mod_CA12_13t))
- print(summary(mod_CA12_SUMt))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement