wiki:AddingFilterType

org.grits.toolbox.util.structure.glycan plugin contains several filter types to be used. Current filter types are as follows:

  • GlycanFilterMonosaccharide
  • GlycanFilterSubstituent
  • GlycanFilterSubstructure
  • ComboFilter
  • GlycanFilterAnd
  • GlycanFilterOr
  • GlycanFilterNot

Adding a new filter type requires creating a new class that extends one of:

  • org.grits.toolbox.util.structure.glycan.filter.om.IntegerFilter
  • org.grits.toolbox.util.structure.glycan.filter.om.BooleanFilter

and implementing the two abstract methods and also toString() method to display the filter in the table properly (if it is going to be a member of a ComboFilter)

     public abstract boolean accept(GlycanFilterVisitor a_operator) throws GlycanFilterException;
	
     public abstract Filter copy ();

Additionally, for correct JAXB marshalling and unmarshalling, the new filter type needs to be added to the list of JAXBContext classses defined in FilterUtils class as shown below:

package org.grits.toolbox.util.structure.glycan.util;
...

public class FilterUtils {
        @SuppressWarnings("rawtypes")
	public static Class[] filterClassContext = {GlycanFilterMonosaccharide.class, GlycanFilterSubstituent.class, 
			GlycanFilterSubstructure.class, GlycanFilterModification.class,
			GlycanFilterAnd.class, GlycanFilterOr.class, GlycanFilterNot.class, GlycanFilterAntenna.class, ComboFilter.class};

Finally, the org.grits.toolbox.util.structure.glycan.filter.om.GlycanFilterVisitor needs to be updated to add a new "visit" method for the new filter type.

For required changes specific to glycanarray plugin see GlycanArrayFilters

For required changes specific to MS plugins see MSFilters

Last modified 4 years ago Last modified on 07/31/2017 11:26:27 PM