From: Justin Gullingsrud (jgulling_at_mccammon.ucsd.edu)
Date: Wed Nov 19 2003 - 11:21:08 CST

Hi Stef,

I haven't tested this but it sounds like it could be generally useful.
Rather than immediately replacing what we have, since we're so close
to releasing VMD 1.8.2, I would suggest placing it in the VMD script
library, so that people who want to use this custom version can just
download the script and source it (this was the reason for making the
graphing behavior scriptable in the first place).

By the way, you can chop that final "-" with the command

  set input [string trimright $input "- "]

Hope I didn't spoil your fun. ;)

Cheers,
Justin

On Wed, Nov 19, 2003 at 06:01:41PM +0100, Teletchéa Stéphane wrote:
> Le mar 18/11/2003 à 18:26, Justin Gullingsrud a écrit :
> > Hi,
> >
> > > Thanks, i've looked at it, and i think it could be trivial or not.
> > > The title is written via the $item command, line 19 of the script:
> > >
> > > set input "@type xy\n@ title \"$item\"\n"
> > >
> > > And i suspect that $item contains an internal vmd variable designing the
> > > bond, angle, ... like bond0, bond1, ...
> >
> > You could do something like the following:
> >
> > set info [lindex [label list $type] $item]
> >
>
> Thank you very much for your guidelines. I've used them and now it
> works. Here is the modified procedure in tcl (extract of the file
> vmd/scripts/vmd/graphlabels.tcl) :
>
> proc vmd_labelcb_xmgr { args } {
> global vmd_graph_label
> foreach item $vmd_graph_label {
> foreach { type id } $item { break }
> set data [label graph $type $id]
> set info [label list $type]
>
> switch [lindex $item 0] {
> "Bonds" {
> set fin 2
> }
> "Angles" {
> set fin 3
> }
> "Dihedrals" {
> set fin 4
> }
> }
>
> set input "@type xy\n@ title \""
>
> for {set deb 0} { $deb < $fin } {incr deb 1} {
>
> set atom [lindex [lindex [lindex $info 0] $deb] 1]
> set sel [atomselect top "index $atom"]
> set atomname [$sel get name]
> set resid [$sel get resid]
> set resname [$sel get resname]
> append input "$resname $resid:$atomname - "
> }
>
> append input "\"\n"
>
> set i 0
> foreach elem $data {
> append input " $i $elem\n"
> incr i
> }
> set rc [catch {exec xmgrace -pipe << $input &} msg]
> if { $rc } {
> vmd_labelcb_save
> }
> }
> }
>
> The only problem is that it produces lines like this :
>
> GUA 15:C5 - CYT 16:C4 - <-- note there is an extra '-'
>
> It would be better to not have this extra '-'. but since the most
> important thing for me was to have atom names instead of
> Bond/Angle/Dihedral, i think it is quite ok. May be i'll find a clever
> way to do it tomorrow.
>
> Could this improvement be considered to be included in 1.8.2 ?
>
> I have not tested it with a protein, but as i used vmd own's variables,
> i think it should be straightforward.
>
> Some comments about the code :
>
> Variables fin and deb are (in French, like this i'm sure they won't
> interfere with the code ;-)) for :
>
> fin : end
> deb : début (beginning)
>
>
>
> Thanks for your comments,
> Stef
>
> --
> 17:55:27 up 36 days, 4:30, 9 users, load average: 0.00, 0.01, 0.00
> http://www.steletch.org
> Linux 2.4.21-0.25mdk #1 Thu Jul 24 13:10:52 MDT 2003