Distance matrix using center of mass

Issue #282 resolved
Former user created an issue

I was wandering whether it is possible to output a matrix of distance (dm) using the center of mass of the residues and ligands in a protein?

Many thanks in advance,

Alexander

Comments (2)

  1. Xinqiu Yao

    Hi,

    Yes, it is doable, but you need to write a simple script to do it. For example,

    pdb <- read.pdb('1tag')
    
    # remove water
    pdb <- atom.select(pdb, 'water', inverse=TRUE, value=TRUE)
    
    # Get all atom masses and split them according to residues
    m <- atom2mass(pdb$atom[, 'elety'])
    id_res <- paste(pdb$atom[, 'chain'], pdb$atom[, 'resno'], pdb$atom[, 'insert'], sep='_')
    mass <- split(m, id_res)
    
    # Split xyz according to residues
    xyz <- split(pdb$xyz, rep(id_res, each=3))
    
    # Calculate center of mass of residues
    com <- as.numeric(sapply(unique(id_res), function(i) com.xyz(xyz[[i]], mass=mass[[i]])))
    
    # distance matrix
    dm <- dm.xyz(com)
    
    plot.dmat(dm)
    

    Let me know if you have any question!

  2. Log in to comment