org.biojava.nbio.structure.align.gui.MultipleAlignmentJmolDisplay Maven / Gradle / Ivy
/*
* BioJava development code
*
* This code may be freely distributed and modified under the
* terms of the GNU Lesser General Public Licence. This should
* be distributed with the code. If you do not have a copy,
* see:
*
* http://www.gnu.org/copyleft/lesser.html
*
* Copyright for this code is held jointly by the individual
* authors. These should be listed in @author doc comments.
*
* For more information on the BioJava project and its aims,
* or to join the biojava-l mailing list, visit the home page
* at:
*
* http://www.biojava.org/
*
*/
package org.biojava.nbio.structure.align.gui;
import java.awt.Dimension;
import java.util.ArrayList;
import java.util.List;
import javax.swing.Box;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JScrollPane;
import org.biojava.nbio.structure.Atom;
import org.biojava.nbio.structure.StructureException;
import org.biojava.nbio.structure.align.gui.aligpanel.MultipleAligPanel;
import org.biojava.nbio.structure.align.gui.aligpanel.MultipleStatusDisplay;
import org.biojava.nbio.structure.align.gui.jmol.AbstractAlignmentJmol;
import org.biojava.nbio.structure.align.gui.jmol.JmolTools;
import org.biojava.nbio.structure.align.gui.jmol.MultipleAlignmentJmol;
import org.biojava.nbio.structure.align.multiple.Block;
import org.biojava.nbio.structure.align.multiple.MultipleAlignment;
import org.biojava.nbio.structure.align.multiple.util.MultipleAlignmentDisplay;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
/**
* Utility Class that provides helper methods for the visualization of
* {@link MultipleAlignment}s.
*
* Currently supported: Alignment Panel Display, select aligned
* residues in Jmol by their PDB name, show a text Frame for any sequence
* alignment format, basic Jmol display from a MultipleAlignment, generate
* an artificial PDB structure with a new model for every aligned structure.
*
* @author Aleix Lafita
* @since 4.2.0
*
*/
public class MultipleAlignmentJmolDisplay {
//private static final Logger logger =
// LoggerFactory.getLogger(MultipleAlignmentJmolDisplay.class);
/**
* Utility method used in the {@link MultipleAlignmentJmol} Frame,
* when the aligned residues of a structure in the alignment have
* to be selected for formatting them (coloring and style).
*
* @param structNum the structure index (row) of the alignment
* @param multAln the MultipleAlignment that contains the equivalent
* positions
* @param ca the atom array of the structure specified
* (corresponding to the structure index)
* @return List of pdb Strings corresponding to the aligned positions
* of the structure.
*/
public static List getPDBresnum(int structNum,
MultipleAlignment multAln, Atom[] ca){
List lst = new ArrayList();
for(Block block : multAln.getBlocks() ) {
for (int i=0; i rotatedAtoms = MultipleAlignmentDisplay.getRotatedAtoms(multAln);
MultipleAlignmentJmol jmol =
new MultipleAlignmentJmol(multAln, rotatedAtoms);
jmol.setTitle(jmol.getStructure().getPDBHeader().getTitle());
return jmol;
}
}