compbio.data.sequence
Class ClustalAlignmentUtil

java.lang.Object
  extended by compbio.data.sequence.ClustalAlignmentUtil

public final class ClustalAlignmentUtil
extends Object

Tools to read and write clustal formated files

Version:
1.0 September 2009
Author:
Petr Troshin based on jimp class

Field Summary
static char gapchar
          Dash char to be used as gap char in the alignments
 
Constructor Summary
ClustalAlignmentUtil()
           
 
Method Summary
static boolean isValidClustalFile(InputStream input)
          Please note this method closes the input stream provided as a parameter
static Alignment readClustalFile(File file)
           
static Alignment readClustalFile(InputStream instream)
          Read Clustal formatted alignment.
static void writeClustalAlignment(OutputStream outStream, Alignment alignment)
          Write Clustal formatted alignment Limitations: does not record the consensus.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gapchar

public static final char gapchar
Dash char to be used as gap char in the alignments

See Also:
Constant Field Values
Constructor Detail

ClustalAlignmentUtil

public ClustalAlignmentUtil()
Method Detail

readClustalFile

public static Alignment readClustalFile(InputStream instream)
                                 throws IOException,
                                        UnknownFileFormatException
Read Clustal formatted alignment. Limitations: Does not read consensus Sequence names as well as the sequences are not guaranteed to be unique!

Throws:
{@link - IOException}
{@link - UnknownFileFormatException}
IOException
UnknownFileFormatException

isValidClustalFile

public static boolean isValidClustalFile(InputStream input)
Please note this method closes the input stream provided as a parameter

Parameters:
input -
Returns:
true if the file is recognised as Clustal formatted alignment, false otherwise

writeClustalAlignment

public static void writeClustalAlignment(OutputStream outStream,
                                         Alignment alignment)
                                  throws IOException
Write Clustal formatted alignment Limitations: does not record the consensus. Potential bug - records 60 chars length alignment where Clustal would have recorded 50 chars.

Parameters:
outStream -
alignment -
Throws:
IOException

readClustalFile

public static Alignment readClustalFile(File file)
                                 throws UnknownFileFormatException,
                                        IOException
Throws:
UnknownFileFormatException
IOException