Class SimpleAlignmentStyler

java.lang.Object
org.biojava.bio.program.blast2html.AbstractAlignmentStyler
org.biojava.bio.program.blast2html.SimpleAlignmentStyler

Simple implementation for specifying markup styles. Has 3 modes of operation: SHOW_ALL, SHOW_SAME invalid input: '&' SHOW_DIFF.

SHOW_ALL - returns the default style for all given residues. SHOW_SAME - only returns a markup style if the styles for both characters are the same. SHOW_DIFF - only returns a markup style if the styles for both are different. Styles can be easily defined in two ways.
1. Add each style by calling addStyle( poChar, poColour ) For example, String oRed = "FFA2A2"; oStyler.addStyle( "-", oRed ); oStyler.addStyle( "N", oRed ); oStyler.addStyle( "A", oRed ); oStyler.addStyle( "T", oRed ); oStyler.addStyle( "C", oRed ); oStyler.addStyle( "G", oRed );

2. Alternatively the styles could be specified in a java properties file and loaded by calling readColourMapFromProperties( poFilename ), or readColourMap() and setting the system property 'colourMap' to the correct filename.
This file should be in java properties format, mapping characters to colours, specified in HEX RGB. For example:

 # set everything red
 - = FFA2A2
 N = FFA2A2
 A = FFA2A2
 T = FFA2A2
 C = FFA2A2
 G = FFA2A2
 
Note this is simply character based, so if you want to colour gaps then you need to specify a colour for the gap character.

If no colour is specified for a character then it is uncoloured. Primary author - Colin Hardman (CAT) Other authors - Tim Dilks (CAT) Simon Brocklehurst (CAT) Stuart Johnston (CAT) Lawerence Bower (CAT) Derek Crockford (CAT) Neil Benn (CAT) Copyright 2001 Cambridge Antibody Technology Group plc. This code released to the biojava project, May 2001 under the LGPL license.

Version:
1.0
Author:
Cambridge Antibody Technology Group plc
  • Field Details

    • SHOW_ALL

      public static int SHOW_ALL
      Return default styles
    • SHOW_SAME

      public static int SHOW_SAME
      Only return if the two colour classes for query and subject are the same
    • SHOW_DIFF

      public static int SHOW_DIFF
      As NORMAL except only return if the two colour classes for query and subject are the different
  • Constructor Details

    • SimpleAlignmentStyler

      public SimpleAlignmentStyler(int piStyle)
      Creates a new SimpleAlignmentStyler instance.

      The int flag should be one of SimpleAlignmentStyler.SHOW_ALL, SimpleAlignmentStyler.SHOW_SAME or SimpleAlignmentStyler.SHOW_DIFF.

      Parameters:
      piStyle - (one of SimpleAlignmentStyler.SHOW_SAME or SimpleAlignmentStyler.SHOW_DIFF).
      Throws:
      IllegalArgumentException - - if style not one of allowed values
  • Method Details

    • readColourMapFromProperties

      protected void readColourMapFromProperties(String poFileName)
      Setup styles from java property file.
      Parameters:
      poFileName - - the file name of the property file.
    • readColourMap

      protected void readColourMap()
      Read the the properties file that specifies the character/colour mapping. The location of the property file is specified by the system property 'colourMap'.
    • getStyle

      public void getStyle(String poFirst, String poSecond, String[] poStyleHolder)
      Returns the styles for the two aligned characters in the form of predefined font classes.

      Null is acceptable value for no style.

      Specified by:
      getStyle in class AbstractAlignmentStyler
      Parameters:
      poFirst - - the first char in the alignment
      poSecond - - the second char in the alignment
      poStyleHolder - - an array to hold the styles, [0] = first etc