Keywords: DeveloppersGuide

# How to add new thermodynamic model

1) Creates a new class which implements the PatternComputationMethod interface or which extends the PatternComputation class in the melting.patternModels package.
If the structure computed by the new class is already registered by the program, you can create your class in the appropriate package (cngPatterns, cricksPair, InternalLoops, longBulge, longDanglingEnds, secondDanglingEnds, singleBulge, singleDanglingEnds, singleMismatch, specificAcids, tandemMismatches or wobble).
The PatternComputation class contains all the base implementations of each PatternComputationMethod method except for this function : boolean isApplicable(Environment environment, int pos1, int pos2).
You have to implement this method to compute the enthalpy and entropy of a motif in the duplex. You also have to override the function boolean isApplicable(Environment environment, int pos1,int pos2) to define the conditions of application of the new thermodynamic model.

2) Always register the new model in the RegisterMethod class in the melting.configuration package. Depending on which structure in the duplex your new model computes, you will have to add one of these following lines :

- New model for Crick's pairs computation

      private void initialiseCricksMethods(){
      		[...]

      		// To map the model name to the class which
      		// implements it.
              cricksMethod.put("model-Name",
                               ClassName.class);
      	}

- New model for single mismatch computation

      private void initialiseSingleMismatchMethods(){
      		[...]

      		// To map the model name to the class which implements it.
              singleMismatchMethod.put("model-Name", ClassName.class);
      	}

- New model for tandem mismatches computation

      private void initialiseTandemMismatchMethods(){
      		[...]

      		// To map the model name to the class which
      		// implements it.
              tandemMismatchMethod.put("model-Name",
                                     ClassName.class);
      	}

- New model for GU base pairs computation

      private void initialiseWobbleMismatchMethods(){
      		[...]

      		// To map the model name to the class which
      		// implements it.
              wobbleMethod.put("model-Name",
                              ClassName.class);
      	}

- New model for internal loop computation

      private void initialiseInternalLoopMethods(){
      		[...]

      		// To map the model name to the class which
      		// implements it.
              internalLoopMethod.put("model-Name",
                                     ClassName.class);
      	}

- New model for single bulge loop computation

      private void initialiseSingleBulgeLoopMethods(){
      		[...]

      		// To map the model name to the class which
      		// implements it.
              singleBulgeLoopMethod.put("model-Name",
                                        ClassName.class);
      	}

- New model for long bulge loop computation

      private void initialiseLongBulgeLoopMethods(){
      		[...]

      		// To map the model name to the class which
      		// implements it.
              longBulgeLoopMethod.put("model-Name",
                                      ClassName.class);
      	}

- New model for single dangling end computation

      private void initialiseSingleDanglingEndMethods(){
      		[...]

      		// To map the model name to the class which
      		// implements it.
              singleDanglingEndMethod.put("model-Name",
                                          ClassName.class);
      	}

- New model for double dangling end computation

      private void initialiseDoubleDanglingEndMethods(){
      		[...]

      		// To map the model name to the class which
      		// implements it.
              doubleDanglingEndMethod.put("model-Name",
                                          ClassName.class);
      	}

- New model for long dangling end computation

      private void initialiseLongDanglingEndMethods(){
      		[...]

      		// To map the model name to the class which
      		// implements it.
              longDanglingEndMethod.put("model-Name",
                                        ClassName.class);
      	}

- New model for CNG repeats computation

      private void initialiseCNGRepeatsMethods(){
      		[...]

      		// To map the model name to the class which
      		// implements it.
              CNGRepeatsMethod.put("model-Name",
                                  ClassName.class);
      	}

- New model for inosine computation

      private void initialiseInosineMethods(){
      		[...]

      		// To map the model name to the class
      		// which implements it.
              inosineMethod.put("model-Name",
                                ClassName.class);
      	}

- New model for azobenzene computation

      private void initialiseAzobenzeneMethods(){
      		[...]

      		// To map the model name to the class
      		// which implements it.
              azobenzeneMethod.put("model-Name",
                                  ClassName.class);
      	}

- New model for locked nucleic acid computation

      private void initialiseLockedAcidMethods(){
      		[...]

      		// To map the model name to the class which
      		// implements it.
              lockedAcidMethod.put("model-Name",
                                  ClassName.class);
      	}

- New model for hydroxyadenosine computation

      private void initialiseHydroxyadenosineMethods(){
      		[...]

      		// To map the model name to the class which
      		// implements it.
              hydroxyadenosineMethod.put("model-Name",
                                        ClassName.class);
      	}

3) Create a public static String defaultFileName as instance variable of the class. It represents the name of the XML file containing the thermodynamic parameters for this model. You must print it if the user requires the verbose mode. You can create another public static String which contains the thermodynamic formula of the model and print it during the verbose mode.
For each message you want to print during the verbose mode, you must write this line : OptionManagement.meltingLogger.log(Level.FINE, "message to print");

4) You always must override or implement this function : void initialiseFileName(String methodName). It is necessary to write that the new class can use the thermodynamic parameters of its default File or use the thermodynamic parameters of another file required by the user.

    @Override
    	public void initialiseFileName(String methodName){
    		super.initialiseFileName(methodName);

    		if (this.fileName == null){
    			this.fileName = defaultFileName; // The public static String
    			                                 // of this class.
    		}
    	}

Some base implementations have been written for some non specific thermodynamic models, maybe your new class can extend one of the following base implementations. (but you always have to do the steps 1 to 4)

Subsections

- - Thermodynamic model for Crick's pairs computation
  - Thermodynamic model for single bulge loop computation
  - Thermodynamic model for inosine computation