On Aug 21, 2007, at 4:34 PM, gary thompson wrote:

> Dear All
>
> when running convert_restraints_to_xplor.tcl I have found that  
> using removeLowLikelihoodPeakAssignments with any value doesn't  
> change the number of assignments written
>
> the function is used as follows
>
> removeLowLikelihoodPeakAssignments \
>     -pot $3dc \
>     -likelihoodCutoff 0.9
>
>
> however, the source is
>
> proc removeLowLikelihoodPeakAssignments args {
>
>     set pot    [requiredFlagVal $args -pot]
>     set cutoff [flagVal $args -cutoff 0.91]
>     set remVar [flagVal $args -remarksVariableName ""]
>     set preventUnassignment [flagExists $args -preventUnassignment]
>
>
> clearly the flag should be -cutoff rather than -likelihoodCutoff  
> (which i guess it was at some date in the past)

D'oh!  Thanks for the catch.  BTW, I really don't use  
removeLowLikelihoodPeakAssignments any more in the current scripts.


> nb. while sorting this out i wrote the following functions to count  
> the current number of active pa's
>
> proc countAssignments potential {
>     set i 0
>     set j 0
>     foreach curPeak [$potential peaks] {
>         Peak -this $curPeak
>         set pas [$curPeak peakAssignments]
>         if {[llength $pas] > 0} {
>             incr j
>         }
>         foreach curPA $pas {
>             incr i
>         }
>     }
>     return [list $j $i]
> }

Errum, this will let you calculate the mean number of peakAssignments  
per peak, which is >= the number of
active PAs per peak, which is what you say you want.  To get the  
latter, try something like

proc countActivePeakAssignments potential {

        set retVal [list]

        foreach curPeak [$potential peaks] {
                Peak -this $curPeak
                set curCount 0
                foreach curPA [$curPeak peakAssignments] {
                        PeakAssignment -this  $curPA
                        if {[$curPA isActive]} {
                                incr curCount
                        }
                        rename $curPA ""
                }
                if {$curCount > 0} {
                        lappend retVal $curCount
                }
                rename $curPeak ""
        }

        return [list [mean $retVal] [standardDeviation $retVal]]
}

>
>
> now this brought up some questions
> a. what is the list of sub commands for a potential (or where do i  
> find it)

Sending a MarvinNOEPotential object a garbage message, like

        $pot sdkfjsdlfjls

will cause it to return an error message containing all the valid  
messages that MarvinNOEPotentials understand.
The same thing is true of Peaks, ShiftAssignments, and PeakAssignments.

They're generally defined in C++ (look in xplor/marvin/*.hh and  
*.cc), and their meaning should generally be
pretty obvious.

> b. what does Peak/PA -this $curPeak do?

As Charles pointed out, it's one of the uglier aspects of the TCL  
interface.  It's how pointers are turned into live
TCL objects.

Notice the rename lines in my code above.  These are also part of the  
ugly side of the TCL interface.  They delete
those TCL objects, allowing the memory to be reclaimed.

>
> c. is there an easier way to do this?

In some cases, I have C++ code that does exactly what you're looking  
for, so it's trivial to call the appropriate method.
But in general, if you want to report statistics in some specific  
way, you're on the right track--running through all the
peaks and peakAssignments in TCL loops, and acting as you see fit.

Hope this helps.

--JK

Reply via email to