Keywords: DeveloppersGuide

## New denaturing agent species or other species

1) If the new species is an ion which can't be included in the algorithm from Owczarzy et al. 2008 or if it is a new denaturing agent, you have to create a new instance variable of RegisterMethods in the melting.cinfiguration package. The new private static HashMap<String, Class<? extends CorrectionMethod» register all the corrections for the new species.

    /**
    * HasMap formamideCorrection : contains all the methods for
    * the new species correction.
    */
    	private static HashMap<String, Class<? extends CorrectionMethod>>
    	                                   newSpeciesCorrection =
    	  new HashMap<String, Class<? extends CorrectionMethod>>();

2) You have to create a new method in RegisterMethods to initialise the new HasMap :

    /**
    * initialises the newSpeciesCorrectionMethod HashMap of
    * the RegisterMethods object.
    */
    	private void initialiseNewSpeciesCorrectionMethod(){
    		[...]
    		newSpeciesCorrection.put("NewSpeciesCorrection-Name",
    		                                   ClassName.class);
    	}

3) You have to create a new option to give the possibility to change the correction for the new species. You must add a new public static final String in the OptionManagement class to register the name of the new option. (melting.configuration package)

    /**
    * Option name for to change the default correction for the
    * new species.
    */
    	public static final String newSpeciesOption = "Option-Name";

4) Choose a default new species correction for each type of hybridization in the following methods of OptionManagement :

    /**
    * initialises the DNADefaultOptions HashMap of the
    * OptionManagement object.
    */
    	private void initialisesDNADefaultOptions() {
    		[...]

    		this.DNADefaultOptions.put(newSpeciesOption,
    		                    "DNAdefaultCorrection-Name");
    	}

    /**
    * initialises the RNADefaultOptions HashMap of the
    * OptionManagement object.
    */
    	private void initialiseRNADefaultOptions() {
    		[...]

    		this.RNADefaultOptions.put(newSpeciesOption,
    		                   "RNAdefaultCorrection-Name");

    	}

    /**
    * initialises the hybridDefaultOptions HashMap of the
    * OptionManagement object.
    */
    	private void initialiseHybridDefaultOptions() {
    		[...]

    		this.hybridDefaultOptions.put(newSpeciesOption,
    		                  "DNARNAdefaultCorrection-Name");

    	}

    /**
    * initialises the mRNADefaultOptions HashMap of the
    * OptionManagement object.
    */
    	private void initialiseMRNADefaultOptions() {
    		[...]

    		this.mRNADefaultOptions.put(newSpeciesOption,
    		                  "mRNAdefaultCorrection-Name");

    	}

5) You have to register the new option in the HashMap registerEnvironmentOptions of OptionManagement. You just have to add the following line into the method private void initialiseRegisterEnvironmentOptions() of OptionManagement :

    /**
    * Initialises the registerEnvironmentOptions HashMap of the
    * OptionManagement object.
    */
    	private void initialiseRegisterEnvironmentOptions(){
    		[...]

    		registerEnvironmentOptions.add(newSpeciesOption);

    	}

6) You have to register the new species and the new corrections for it in RegisterMethods (melting.configuration package). You must add the following line to the method private void initialiseOtherCorrectionMethod() :

    /**
    * initialises the otherCorrectionMethod HashMap of the
    * RegisterMethods object.
    */
    	private void initialiseOtherCorrectionMethod(){
    		[...]

    		// create a relationship between the new option and
    		//the corrections registered for the new species.
    		otherCorrection.put(OptionManagement.newSpeciesOption,
    		                                 newSpeciesCorrection);
    	}

7) You have to complete the method public ThermoResult computeOtherMeltingCorrections(Environment environment) of RegisterMethods. This method is important to correct the melting temperature if another ion or denaturing agent species are present :

    public ThermoResult computeOtherMeltingCorrections(Environment
                                                     environment){
    		[...]

     // Check if the new species is present in the environment
     if (environment.getNewSpecies() > 0){

    // Get the correction associated with the option name of the
    // new species.
    CorrectionMethod newSpeciesCorrection =
    getCorrectionMethod(OptionManagement.newSpeciesCorrection,
    environment.getOptions().get(OptionManagement.newSpeciesCorrection));

    if (newSpeciesCorrection == null){
    	throw new NoExistingMethodException("There is no implemented
    	                                    new species correction.");
    }
    else if (newSpeciesCorrection.isApplicable(environment)){
    environment.setResult
        (newSpeciesCorrection.correctMeltingResults(environment));
    }
    else {
    	throw new MethodNotApplicableException("The new species correction
    	   is not applicable with this environment
    	   (option " + OptionManagement.newSpeciesCorrection + ").");
    }
    }

8) Create a new class for the new species corrections as it is explained in the section How to add new corrections for Na, Mg, K, Tris, DMSO and/or formamide.