view dccm.R @ 3:f61a718993fd draft default tip

"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/tree/master/tools/bio3d commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
author chemteam
date Mon, 07 Oct 2019 12:44:04 -0400
parents 0692d9f9edd3
children
line wrap: on
line source

#!/usr/bin/env Rscript

options(stringAsfactors = FALSE)
args <- commandArgs(trailingOnly = TRUE)

library(bio3d)
require(lattice)

dcdfile <- args[1]
pdbfile <- args[2]

dcd <- read.dcd(dcdfile)
pdb <- read.pdb(pdbfile)

selection <- args[3]
domain <- args[4]

output <- args[5]
dccm_plot <- args[6]

dcd <- read.dcd(dcdfile)
pdb <- read.pdb(pdbfile)

if (selection == "string") {
    inds <- atom.select(pdb, string = domain)
}
if (selection == "elety") {
    inds <- atom.select(pdb, elety = domain)
}
if (selection == "resid") {
    inds <- atom.select(pdb, resid = domain)
}
if (selection == "segid") {
    inds <- atom.select(pdb, segid = domain)
}

xyz <- fit.xyz(fixed=pdb$xyz, mobile=dcd, fixed.inds=inds$xyz, mobile.inds=inds$xyz)
cij<-dccm(xyz[,inds$xyz])

write.table(cij, file = output, row.names = TRUE, col.names = FALSE, quote =FALSE, sep="\t")

png(dccm_plot)
plot(cij)
dev.off()