Keywords: DeveloppersGuide

## what to change if you add new subnodes or new attributes

The current Handler classes in the package melting.handlers can manage this type of node hierarchy :

    <data type="strucure-type">
    	<subnode attribute1="value1" attribute2="value2">
    		<enthalpy>xx[...]xx.x</enthalpy>
    		<entropy>xx[...]xx.x</entropy>
    	</subnode>

    	   	[...]

    	<subnode sequence="AA/TT">
    		<enthalpy>xx[...]xx.x</enthalpy>
    		<entropy>xx[...]xx.x</entropy>
    	</subnode>
    </data>

1) You have to register your new attribute in the DataHandler class in the melting.handlers package. You need to change the method public void endElement(String uri, String localName, String name) to build the matching key in the dictionnary which will contain the thermodynamic parameters :

    	@Override
    	public void endElement(String uri, String localName, String name)
    			throws SAXException {
    		if (subHandler != null) {
    			subHandler.endElement(uri, localName, name);
    			if (subHandler.hasCompletedNode()) {
    				ThermoHandler handler = (ThermoHandler) subHandler;
    				String key = name;
    				if (handler.getAttribut().containsKey("type")) {
    					key += handler.getAttribut().get("type");
    				}
    				[...]

    				// Add your new attribute here
    			if (handler.getAttribut().containsKey("newAttribute-Name")) {
    			key += "subnode-Name" + handler.getAttribut().get("newAttribute-Name");
    			}
    				[...]
    	}

The dictionnary key for each thermodynamic parameter mostly has the following syntax,

Subnode-nameAttribute1Value1Attribute2Value2

but it can be different for some attributes. (see the method in details)
2) You have to create (or change) a method in the DataCollect class from the melting package to more easily get the thermodynamic parameters you need. See the example below :

    /**
    * to get the Thermodynamics object containing the parameters
    * for the base pair (base1, base2) next to the mismatching
    * base pair.
    * @param string base1 : from the sequence (5'3')
    * @param string base2 : from the complementary sequence (3'5')
    * @return Thermodynamics object containing the parameters for
    * the base pair (base1, base2) next to the mismatching base pair.
    */
    public Thermodynamics getClosureValue(String base1, String base2){
    		Thermodynamics s = data.get("closure"+"per-"+base1 + "/"
    		                            + base2);
    		return s;
    	}

    // Your method can be similar to the following method
    public Thermodynamics getNewThermodynamicParameter1(arg-1, ..., arg-n){
    	Thermodynamics s = data.get("node-name"+"attribute-1"+value-1
    	                             +[...]+"attribute-n"+value-n);
    	return s;
    }