Imagine what recipes you would like to write if you could ask all the bands on the protein which segments they are attached to!
I just had a crazy idea for storing in each band the segment numbers it connects to. We can store at least 9 digits after the decimal in the Strength property of the band. I propose using some of those digits to store the "from" and "to" segment numbers. Consider this Strength value: 1.001002001 The first two digits after the decimal can be anything and are used to actually control the strength of the band. The next 3 digits ("100") indicate the "from" segment number. The next 3 ("200") indicate the "to" segment number. The 9th digit is always 1 and guarantees that all the other 8 digits will be returned even if the "to" segment number includes trailing zeros (as in this case, we don't want the Strength rounded to 1.001002 just because segment 200 ends in zeros). (Not sure if this last digit is really important.) The digits used for storing segment numbers will add an insignificant amount to the intended strength of the band.
Here are some other sample "smart" Strength values:
1.500010631 - strength 1.50, from seg 1 to seg 63
0.500251501 - strength 0.50, from seg 25 to seg 150
9.990250351 - strength 9.99, from seg 25 to seg 35 (Note that when you want a strength 10 band you would have to use 9.99, because setting the strength greater than 10.0 throws an error.)
1.001210001 - strength 1.00, from seg 121 to space ("to" seg number is zero)
To make this work, we would need a library of functions to:
1. given two segment numbers, add a band and set its strength to include the band info, returning the band number
2. given a band number and a desired strength, set the band strength (rounding it to 2 decimal places) while preserving the band info
3. test whether a strength value returned by band.GetStrength is a valid "band info" value, and return both the strength and the band info
4. query all the bands on a protein and build a table of their "from" and "to" segments and band numbers
5. given a pair of seg numbers, return the band number connecting them, or a zero if there is no such band
Some of the above could be wrappers for existing band functions. There is also the possibility to replace some of the current band functions (see BitSpawn's library for turning filters on and off for a sample of how to do this). Eventually there would be a family of recipes that only make these "smart" bands and of recipes that use "smart" bands that other recipes have left behind. There could also be one simple recipe that you use to add a "smart" band when working by hand - select two segs and run the recipe; if exactly two segs are selected it adds a "smart" band there; else it gives you two sliders to choose which segs to add the band between. There would also have to be a recipe that lets you set the strength on an existing band when working by hand - select the two segs it connects, run the recipe, and enter the strength you want.
Does anyone think this would be useful? What script functionality would you like to see using "smart" bands? Suggestions for improving this framework?