IMPACT
Class AlignmentEditor

java.lang.Object
  extended by IMPACT.AlignmentEditor

public class AlignmentEditor
extends java.lang.Object

Implementation of methods and data structures for GUIAlignmentEditor.

Author:
Emanuel Maldonado
See Also:
GUIAlignmentEditor, MSATableModel

Field Summary
static java.lang.String TMPMSA_FILE
          Temporary MSA file for input to PhyML.
 
Constructor Summary
AlignmentEditor(java.io.File file, java.lang.String format)
          Constructor method for Alignment Editor.
 
Method Summary
 int getMaxTaxaNameSize()
          Get maximum size for taxa name of input file read.
 int getSequenceCount()
          Get number of sequences for file loaded.
 int getSiteCount()
          Get number of sites for file loaded.
 java.lang.String[] getTableColNames()
          Get column names for table.
These consist of numbered sites.
 java.lang.String[] getTableColNamesRev()
          Get column names for table.
These consist of taxa names.
 java.lang.Object[][] getTableElements()
          Get table values for table.
These consist of sequences presented in rows.
 java.lang.Object[][] getTableElementsRev()
          Get table values for table.
These consist of sequences presented in columns.
 void initializeNormalView(boolean[] markedSeq)
          Initialize normal view of data (by sequence).
View can be by sequence or by site, in terms of rows.
 void initializeOppositeView(boolean[] markedSites)
          Initialize opposite view of data (by site).
View can be by sequence or by site, in terms of rows.
 boolean readMSAFile()
          Read sequences from specified file and format.
File and Format instantiated through the constructor method.
 void removeCanceledTMPFls(Utilities util, java.lang.String newTreeFile, boolean selected)
          Remove temporary files created for PhyML execution resulting from cancelation.
 java.lang.String[] renamePhymlFiles(Utilities util, java.lang.String newTreeFile, boolean selected)
          Rename PhyML files created on directory Phylogeny to name specified by user.
 void writeMSAFile(boolean[] markedSeq, boolean[] markedSites, java.lang.String file, java.lang.String format)
          Write sequences to specified file and format after filtering.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TMPMSA_FILE

public static final java.lang.String TMPMSA_FILE
Temporary MSA file for input to PhyML.

See Also:
Constant Field Values
Constructor Detail

AlignmentEditor

public AlignmentEditor(java.io.File file,
                       java.lang.String format)
Constructor method for Alignment Editor.

Parameters:
file - The file with MSA sequence.
format - The format of file: FASTA, MASE, PHYLIP, CLUSTAL, DCSE.
Method Detail

getSequenceCount

public int getSequenceCount()
Get number of sequences for file loaded.

Returns:
number of sequences.

getSiteCount

public int getSiteCount()
Get number of sites for file loaded.

Returns:
number of sites.

initializeNormalView

public void initializeNormalView(boolean[] markedSeq)
Initialize normal view of data (by sequence).
View can be by sequence or by site, in terms of rows.

Parameters:
markedSeq - values that set selection of sequences in the table.
See Also:
initializeOppositeView(boolean[] markedSites)

initializeOppositeView

public void initializeOppositeView(boolean[] markedSites)
Initialize opposite view of data (by site).
View can be by sequence or by site, in terms of rows.

Parameters:
markedSites - values that set selection of sequences in the table.
See Also:
initializeNormalView(boolean[] markedSeq)

getTableColNames

public java.lang.String[] getTableColNames()
Get column names for table.
These consist of numbered sites.

Returns:
table titles of normal view.
See Also:
MSATableModel, getTableElements(), initializeNormalView(boolean[] markedSeq)

getTableElements

public java.lang.Object[][] getTableElements()
Get table values for table.
These consist of sequences presented in rows.

Returns:
table elements of normal view.
See Also:
MSATableModel, getTableColNames(), initializeNormalView(boolean[] markedSeq)

getTableColNamesRev

public java.lang.String[] getTableColNamesRev()
Get column names for table.
These consist of taxa names.

Returns:
table titles of opposite view.
See Also:
MSATableModel, getTableElementsRev(), initializeOppositeView(boolean[] markedSites)

getTableElementsRev

public java.lang.Object[][] getTableElementsRev()
Get table values for table.
These consist of sequences presented in columns.

Returns:
table elements of opposite view.
See Also:
MSATableModel, getTableColNamesRev(), initializeOppositeView(boolean[] markedSites)

getMaxTaxaNameSize

public int getMaxTaxaNameSize()
Get maximum size for taxa name of input file read.

Returns:
maximum among taxa names.

readMSAFile

public boolean readMSAFile()
Read sequences from specified file and format.
File and Format instantiated through the constructor method.

Returns:
success of operation
See Also:
writeMSAFile(boolean [] markedSeq, boolean[] markedSites, String file, String format), FileFormatConverter

writeMSAFile

public void writeMSAFile(boolean[] markedSeq,
                         boolean[] markedSites,
                         java.lang.String file,
                         java.lang.String format)
Write sequences to specified file and format after filtering.

Parameters:
markedSeq - selected sequences to be written to file.
markedSites - selected sites to be written to file.
file - where to save the current table values. if null saves to currently opened file and format.
format - file format to write if saving to different file; if format null, defaults to FASTA.
See Also:
readMSAFile(), FileFormatConverter

renamePhymlFiles

public java.lang.String[] renamePhymlFiles(Utilities util,
                                           java.lang.String newTreeFile,
                                           boolean selected)
Rename PhyML files created on directory Phylogeny to name specified by user. Or otherwise using same name of initially loaded msa file.
If file already exists will be overwriten.

Parameters:
util - utilities to access locations.
newTreeFile - possibly chosen by the user.
selected - true, if user chosed new tree name; false, otherwise.
Returns:
new tree file name with absolute path and corresponding stat file.

removeCanceledTMPFls

public void removeCanceledTMPFls(Utilities util,
                                 java.lang.String newTreeFile,
                                 boolean selected)
Remove temporary files created for PhyML execution resulting from cancelation.

Parameters:
util - utilities to access locations.
newTreeFile - possibly chosen by the user.
selected - true, if user chosed new tree name; false, otherwise.