import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
+import java.awt.Color;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.BitSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
import jalview.api.AlignmentViewPanel;
import jalview.api.SequenceRenderer;
import jalview.datamodel.Alignment;
import jalview.gui.StructureViewer.ViewerType;
import jalview.io.DataSourceType;
import jalview.io.FileFormats;
+import jalview.io.FileLoader;
import jalview.schemes.JalviewColourScheme;
import jalview.structure.AtomSpec;
import jalview.structure.AtomSpecModel;
-import jalview.structure.StructureCommandsI.SuperposeData;
+import jalview.structure.StructureCommandI;
import jalview.structure.StructureMapping;
import jalview.structure.StructureSelectionManager;
-
-import java.awt.Color;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.BitSet;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
import junit.extensions.PA;
/**
}
@Override
- protected List<String> executeCommand(String command,
+ protected List<String> executeCommand(StructureCommandI command,
boolean getReply)
{
return null;
}
@Override
- protected int getModelNoForFile(String chainId)
+ protected String getModelIdForFile(String chainId)
{
- return 0;
+ return "";
}
@Override
ssm.setMapping(new SequenceI[] { seq3 }, null, PDB_3,
DataSourceType.PASTE, null);
- testee = newBindingModel(pdbFiles, seqs, ssm);
+ testee = newBindingModel(pdbFiles, seqs, ssm, null);
}
/**
* @param pdbFiles
* @param seqs
* @param ssm
+ * @param alignPanel
*/
protected AAStructureBindingModel newBindingModel(PDBEntry[] pdbFiles,
SequenceI[][] seqs,
- StructureSelectionManager ssm)
+ StructureSelectionManager ssm, AlignmentViewPanel avp)
{
AAStructureBindingModel model = new AAStructureBindingModel(ssm,
pdbFiles, seqs, null)
@Override
public String[] getStructureFiles()
{
- return new String[] { "INLINE1YCS", "INLINE3A6S", "INLINE1OOT" };
+ String[] files = new String[getPdbCount()];
+ for (int i = 0; i < this.getPdbCount(); i++)
+ {
+ files[i] = getPdbEntry(i).getFile();
+ }
+ return files;
}
@Override
@Override
public SequenceRenderer getSequenceRenderer(
- AlignmentViewPanel alignment)
+ AlignmentViewPanel avp)
{
- return null;
+ return avp == null ? null
+ : new jalview.gui.SequenceRenderer(
+ avp.getAlignViewport());
}
@Override
- protected List<String> executeCommand(String command,
+ protected List<String> executeCommand(StructureCommandI command,
boolean getReply)
{
return null;
}
+ /*
+ * for this test, let structure model ids be 0, 1, ...
+ * corresponding to first, second etc pdbfile
+ */
@Override
- protected int getModelNoForFile(String chainId)
+ protected String getModelIdForFile(String pdbfile)
{
- return 0;
+ for (int i = 0; i < this.getPdbCount(); i++)
+ {
+ if (pdbfile.equals(this.getPdbEntry(i).getFile()))
+ {
+ return String.valueOf(i);
+ }
+ }
+ return "";
}
@Override
/*
* create a data bean to hold data per structure file
*/
- SuperposeData[] structs = new SuperposeData[testee.getStructureFiles().length];
+ AAStructureBindingModel.SuperposeData[] structs = new AAStructureBindingModel.SuperposeData[testee.getStructureFiles().length];
for (int i = 0; i < structs.length; i++)
{
- structs[i] = new SuperposeData(al.getWidth(), 0);
+ structs[i] = new AAStructureBindingModel.SuperposeData(al.getWidth(), "0");
}
/*
* initialise BitSet of 'superposable columns' to true (would be false for
@Test(groups = { "Functional" })
public void testFindSuperposableResidues_hiddenColumn()
{
- SuperposeData[] structs = new SuperposeData[al.getHeight()];
+ AAStructureBindingModel.SuperposeData[] structs = new AAStructureBindingModel.SuperposeData[al.getHeight()];
for (int i = 0; i < structs.length; i++)
{
- structs[i] = new SuperposeData(al.getWidth(), 0);
+ structs[i] = new AAStructureBindingModel.SuperposeData(al.getWidth(), "0");
}
/*
* initialise BitSet of 'superposable columns' to true (would be false for
* load these sequences, coloured by Strand propensity,
* with columns 2-4 hidden
*/
- SequenceI seq1 = new Sequence("seq1", "MHRSQSSSGG");
- SequenceI seq2 = new Sequence("seq2", "MVRSNGGSSS");
- AlignmentI al = new Alignment(new SequenceI[] { seq1, seq2 });
- AlignFrame af = new AlignFrame(al, 800, 500);
+ String fasta = ">seq1\nMHRSQSSSGG\n>seq2\nMVRSNGGSSS";
+ AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(fasta,
+ DataSourceType.PASTE);
+ AlignmentI al = af.getViewport().getAlignment();
af.changeColour_actionPerformed(JalviewColourScheme.Strand.toString());
ColumnSelection cs = new ColumnSelection();
cs.addElement(2);
cs.addElement(4);
af.getViewport().setColumnSelection(cs);
af.hideSelColumns_actionPerformed(null);
- SequenceRenderer sr = new jalview.gui.SequenceRenderer(
- af.getViewport());
+ SequenceI seq1 = al.getSequenceAt(0);
+ SequenceI seq2 = al.getSequenceAt(1);
SequenceI[][] seqs = new SequenceI[][] { { seq1 }, { seq2 } };
- String[] files = new String[] { "seq1.pdb", "seq2.pdb" };
PDBEntry[] pdbFiles = new PDBEntry[2];
- pdbFiles[0] = new PDBEntry("PDB1", "A", Type.PDB, "INLINEPDB1");
- pdbFiles[1] = new PDBEntry("PDB2", "B", Type.PDB, "INLINEPDB2");
+ pdbFiles[0] = new PDBEntry("PDB1", "A", Type.PDB, "seq1.pdb");
+ pdbFiles[1] = new PDBEntry("PDB2", "B", Type.PDB, "seq2.pdb");
StructureSelectionManager ssm = new StructureSelectionManager();
/*
"B", map, null);
ssm.addStructureMapping(sm2);
- AAStructureBindingModel binding = newBindingModel(pdbFiles, seqs, ssm);
+ AAStructureBindingModel binding = newBindingModel(pdbFiles, seqs, ssm,
+ af.alignPanel);
/*
* method under test builds a map of structures residues by colour
* verify the map holds what it should
*/
- Map<Object, AtomSpecModel> colours = binding.buildColoursMap(ssm, files,
- seqs, sr, af.alignPanel);
+ Map<Object, AtomSpecModel> colours = binding.buildColoursMap(ssm, seqs,
+ af.alignPanel);
ChimeraCommands helper = new ChimeraCommands();
/*