|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.strbio.util.HTML
public class HTML
Useful functions for manipulating HTML
Version 1.0, 5/18/07
Constructor Summary | |
---|---|
HTML()
|
Method Summary | |
---|---|
static java.lang.String |
classifyFasta(java.lang.String fasta,
java.lang.String cssClass,
int start,
int length)
This function adds markup around a given section of a FASTA sequence stored as a String. |
static java.lang.String |
classifyMSF(java.lang.String msf,
java.lang.String cssClass,
int start,
int length)
This function adds markup around a given section of a Profile stored in a MSF-formatted String. |
static java.lang.String |
classifyMSF(java.lang.String msf,
java.lang.String cssClass,
int start,
int length,
int seqNum)
This function is just like the classifyMSF function that marks up an entire profile, but this one can mark up only a single sequence in a profile if you prefer. |
static java.lang.String |
stripHTML(java.lang.String a)
Strip all HTML in a string, returning a new String. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HTML()
Method Detail |
---|
public static final java.lang.String stripHTML(java.lang.String a)
public static final java.lang.String classifyFasta(java.lang.String fasta, java.lang.String cssClass, int start, int length) throws java.io.IOException
elements. This is useful for colorizing (or otherwise changing the style) of a section of FASTA sequence.Use Polymer.writeFasta() with a PrintfWriter in front of a StringWriter to write your Polymer to a String, then use this function to mark it up.
The start monomer is 0-indexed, and a string may be marked up multiple times (HTML elements are autodetected and ignored when counting monomers). If the region to be marked up is partly outside the boundaries of the string, the portion of the sequence inside the boundaries will be marked.
The input String can be legal FASTA format (starting with a header) or raw sequence without the header. If there is a header, it's left unmodified. Within the sequence, whitespace is left unchanged and not counted towards the number of monomers. Anything in the sequence between angle brackets is assumed to be HTML, and also left unchanged and not counted towards the number of monomers. All other non-whitespace characters in the sequence are assumed to be monomers; there's no check as to whether they're valid. There's also no check as to whether the added markup is nested properly; that's up to you.
Multiple FASTA sequences in one string are not supported, and the header (if present) must be the first line of the string and begin with '>'.
java.io.IOException
public static final java.lang.String classifyMSF(java.lang.String msf, java.lang.String cssClass, int start, int length) throws java.io.IOException
elements. This is useful for colorizing (or otherwise changing the style) of a section of the profile.Use Profile.writeMSF() with a PrintfWriter in front of a StringWriter to write your Profile to a String, then use this function to mark it up.
The start monomer is 0-indexed, and a string may be marked up multiple times (HTML elements are autodetected and ignored when counting monomers). If the region to be marked up is partly outside the boundaries of the string, the portion of the sequence inside the boundaries will be marked.
The input String must be a MSF formatted using Profile.writeMSF-- it's too complicated to support arbitrary legal MSF. If you have another format, try reading it to a Profile and re-writing it.
There's no check as to whether the added markup is nested properly; that's up to you.
java.io.IOException
public static final java.lang.String classifyMSF(java.lang.String msf, java.lang.String cssClass, int start, int length, int seqNum) throws java.io.IOException
If seqNum is -1, all sequences are marked up. Otherwise, only the Nth sequence (starting at 0) is marked up. Sequence detection is done very loosely, ignoring sequence names. It is assumed that the sequences will be in the same order within each group.
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |