@@ -7,7 +7,6 @@ import {ExternalInterfaceCtx} from 'eterna/util/ExternalInterface';
77import { Assert } from 'flashbang' ;
88
99export default class FoldingContextAPI {
10- private readonly _scriptInterface : ExternalInterfaceCtx ;
1110 private readonly _getFolder : ( ) => Folder | null ;
1211 private readonly _getIsPseudoknot : ( ) => boolean ;
1312
@@ -19,18 +18,17 @@ export default class FoldingContextAPI {
1918 return this . _getIsPseudoknot ( ) ;
2019 }
2120
22- constructor ( params : { scriptInterface : ExternalInterfaceCtx , getFolder : ( ) => Folder , getIsPseudoknot : ( ) => boolean } ) {
21+ constructor ( params : { getFolder : ( ) => Folder , getIsPseudoknot : ( ) => boolean } ) {
2322 this . _getIsPseudoknot = params . getIsPseudoknot ;
2423 this . _getFolder = params . getFolder ;
25- this . _scriptInterface = params . scriptInterface ;
2624 }
2725
28- public registerToScriptInterface ( ) {
29- this . _scriptInterface . addCallback ( 'current_folder' , ( ) : string | null => (
26+ public registerToScriptInterface ( scriptInterface : ExternalInterfaceCtx ) {
27+ scriptInterface . addCallback ( 'current_folder' , ( ) : string | null => (
3028 this . _folder ? this . _folder . name : null
3129 ) ) ;
3230
33- this . _scriptInterface . addCallback ( 'fold' ,
31+ scriptInterface . addCallback ( 'fold' ,
3432 ( seq : string , constraint : string | null = null ) : string | null => {
3533 if ( this . _folder === null ) {
3634 return null ;
@@ -41,7 +39,7 @@ export default class FoldingContextAPI {
4139 return folded . getParenthesis ( null , this . _isPseudoknot ) ;
4240 } ) ;
4341
44- this . _scriptInterface . addCallback ( 'fold_with_binding_site' ,
42+ scriptInterface . addCallback ( 'fold_with_binding_site' ,
4543 ( seq : string , site : number [ ] , bonus : number ) : string | null => {
4644 if ( this . _folder === null ) {
4745 return null ;
@@ -56,7 +54,7 @@ export default class FoldingContextAPI {
5654 return folded . getParenthesis ( ) ;
5755 } ) ;
5856
59- this . _scriptInterface . addCallback ( 'energy_of_structure' , ( seq : string , secstruct : string ) : number | null => {
57+ scriptInterface . addCallback ( 'energy_of_structure' , ( seq : string , secstruct : string ) : number | null => {
6058 if ( this . _folder === null ) {
6159 return null ;
6260 }
@@ -68,7 +66,7 @@ export default class FoldingContextAPI {
6866 } ) ;
6967
7068 // AMW: still give number[] back because external scripts may rely on it
71- this . _scriptInterface . addCallback ( 'pairing_probabilities' ,
69+ scriptInterface . addCallback ( 'pairing_probabilities' ,
7270 ( seq : string , secstruct : string | null = null ) : number [ ] | null => {
7371 if ( this . _folder === null ) {
7472 return null ;
@@ -88,7 +86,7 @@ export default class FoldingContextAPI {
8886 return pp . data ;
8987 } ) ;
9088
91- this . _scriptInterface . addCallback ( 'subopt_single_sequence' ,
89+ scriptInterface . addCallback ( 'subopt_single_sequence' ,
9290 (
9391 seq : string , kcalDelta : number ,
9492 pseudoknotted : boolean , temp : number = EPars . DEFAULT_TEMPERATURE
@@ -102,7 +100,7 @@ export default class FoldingContextAPI {
102100 kcalDelta , pseudoknotted , temp ) ;
103101 } ) ;
104102
105- this . _scriptInterface . addCallback ( 'subopt_oligos' ,
103+ scriptInterface . addCallback ( 'subopt_oligos' ,
106104 (
107105 seq : string , oligoStrings : string [ ] , kcalDelta : number ,
108106 pseudoknotted : boolean , temp : number = EPars . DEFAULT_TEMPERATURE
@@ -123,7 +121,7 @@ export default class FoldingContextAPI {
123121 oligoStrings , kcalDelta , pseudoknotted , temp ) ;
124122 } ) ;
125123
126- this . _scriptInterface . addCallback ( 'cofold' ,
124+ scriptInterface . addCallback ( 'cofold' ,
127125 (
128126 seq : string , oligo : string , malus : number = 0.0 , constraint : string | null = null
129127 ) : string | null => {
@@ -143,7 +141,7 @@ export default class FoldingContextAPI {
143141 } &${ folded . slice ( len ) . getParenthesis ( ) } `;
144142 } ) ;
145143
146- this . _scriptInterface . addCallback ( 'get_defect' ,
144+ scriptInterface . addCallback ( 'get_defect' ,
147145 (
148146 seq : string , secstruct : string , pseudoknotted : boolean , temp : number = EPars . DEFAULT_TEMPERATURE
149147 ) : number | null => {
0 commit comments