git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-2344 separated AlignmentFileI into AlignmentFileReaderI,
[jalview.git]
/
src
/
jalview
/
appletgui
/
CutAndPasteTransfer.java
diff --git
a/src/jalview/appletgui/CutAndPasteTransfer.java
b/src/jalview/appletgui/CutAndPasteTransfer.java
index
5617c64
..
c658734
100644
(file)
--- a/
src/jalview/appletgui/CutAndPasteTransfer.java
+++ b/
src/jalview/appletgui/CutAndPasteTransfer.java
@@
-22,17
+22,21
@@
package jalview.appletgui;
import jalview.analysis.AlignmentUtils;
import jalview.api.ComplexAlignFile;
import jalview.analysis.AlignmentUtils;
import jalview.api.ComplexAlignFile;
+import jalview.api.FeaturesSourceI;
import jalview.bin.JalviewLite;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
import jalview.bin.JalviewLite;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+import jalview.io.AlignmentFileReaderI;
import jalview.io.AnnotationFile;
import jalview.io.AppletFormatAdapter;
import jalview.io.AnnotationFile;
import jalview.io.AppletFormatAdapter;
-import jalview.io.FileParse;
+import jalview.io.DataSourceType;
+import jalview.io.FileFormatI;
import jalview.io.IdentifyFile;
import jalview.io.NewickFile;
import jalview.io.TCoffeeScoreFile;
import jalview.io.IdentifyFile;
import jalview.io.NewickFile;
import jalview.io.TCoffeeScoreFile;
+import jalview.json.binding.biojson.v1.ColourSchemeMapper;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.TCoffeeColourScheme;
import jalview.util.MessageManager;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.TCoffeeColourScheme;
import jalview.util.MessageManager;
@@
-49,6
+53,7
@@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
+import java.io.IOException;
public class CutAndPasteTransfer extends Panel implements ActionListener,
MouseListener
public class CutAndPasteTransfer extends Panel implements ActionListener,
MouseListener
@@
-63,7
+68,7
@@
public class CutAndPasteTransfer extends Panel implements ActionListener,
AlignFrame alignFrame;
AlignFrame alignFrame;
- FileParse source = null;
+ AlignmentFileReaderI source = null;
public CutAndPasteTransfer(boolean forImport, AlignFrame alignFrame)
{
public CutAndPasteTransfer(boolean forImport, AlignFrame alignFrame)
{
@@
-115,6
+120,7
@@
public class CutAndPasteTransfer extends Panel implements ActionListener,
addSequences.setVisible(false);
}
addSequences.setVisible(false);
}
+ @Override
public void actionPerformed(ActionEvent evt)
{
if (evt.getSource() == accept)
public void actionPerformed(ActionEvent evt)
{
if (evt.getSource() == accept)
@@
-191,7
+197,8
@@
public class CutAndPasteTransfer extends Panel implements ActionListener,
{
try
{
{
try
{
- NewickFile fin = new NewickFile(textarea.getText(), "Paste");
+ NewickFile fin = new NewickFile(textarea.getText(),
+ DataSourceType.PASTE);
fin.parse();
if (fin.getTree() != null)
fin.parse();
if (fin.getTree() != null)
@@
-222,17
+229,14
@@
public class CutAndPasteTransfer extends Panel implements ActionListener,
{
AlignmentI al = null;
{
AlignmentI al = null;
- String format = new IdentifyFile().Identify(text,
- AppletFormatAdapter.PASTE);
- AppletFormatAdapter afa = new AppletFormatAdapter(alignFrame.alignPanel);
try
{
try
{
- al = afa.readFile(text, AppletFormatAdapter.PASTE, format);
+ FileFormatI format = new IdentifyFile().identify(text,
+ DataSourceType.PASTE);
+ AppletFormatAdapter afa = new AppletFormatAdapter(
+ alignFrame.alignPanel);
+ al = afa.readFile(text, DataSourceType.PASTE, format);
source = afa.getAlignFile();
source = afa.getAlignFile();
- } catch (java.io.IOException ex)
- {
- ex.printStackTrace();
- }
if (al != null)
{
if (al != null)
{
@@
-259,17
+263,27
@@
public class CutAndPasteTransfer extends Panel implements ActionListener,
.getHiddenSequences();
boolean showSeqFeatures = ((ComplexAlignFile) source)
.isShowSeqFeatures();
.getHiddenSequences();
boolean showSeqFeatures = ((ComplexAlignFile) source)
.isShowSeqFeatures();
- ColourSchemeI cs = ((ComplexAlignFile) source).getColourScheme();
+ String colourSchemeName = ((ComplexAlignFile) source)
+ .getGlobalColourScheme();
af = new AlignFrame(al, hiddenSeqs, colSel,
alignFrame.viewport.applet, "Cut & Paste input - "
+ format, false);
af.getAlignViewport().setShowSequenceFeatures(showSeqFeatures);
af = new AlignFrame(al, hiddenSeqs, colSel,
alignFrame.viewport.applet, "Cut & Paste input - "
+ format, false);
af.getAlignViewport().setShowSequenceFeatures(showSeqFeatures);
- af.changeColour(cs);
+ ColourSchemeI cs = ColourSchemeMapper.getJalviewColourScheme(
+ colourSchemeName, al);
+ if (cs != null)
+ {
+ af.changeColour(cs);
+ }
}
else
{
af = new AlignFrame(al, alignFrame.viewport.applet,
"Cut & Paste input - " + format, false);
}
else
{
af = new AlignFrame(al, alignFrame.viewport.applet,
"Cut & Paste input - " + format, false);
+ if (source instanceof FeaturesSourceI)
+ {
+ af.getAlignViewport().setShowSequenceFeatures(true);
+ }
}
af.statusBar
}
af.statusBar
@@
-283,6
+297,10
@@
public class CutAndPasteTransfer extends Panel implements ActionListener,
.getString("label.successfully_pasted_alignment_file"));
}
}
.getString("label.successfully_pasted_alignment_file"));
}
}
+ } catch (IOException ex)
+ {
+ ex.printStackTrace();
+ }
}
/**
}
/**
@@
-293,7
+311,7
@@
public class CutAndPasteTransfer extends Panel implements ActionListener,
* @param al
* @return
*/
* @param al
* @return
*/
- protected boolean openSplitFrame(AlignmentI al, String format)
+ protected boolean openSplitFrame(AlignmentI al, FileFormatI format)
{
final AlignmentI thisAlignment = this.alignFrame.getAlignViewport()
.getAlignment();
{
final AlignmentI thisAlignment = this.alignFrame.getAlignViewport()
.getAlignment();
@@
-304,7
+322,7
@@
public class CutAndPasteTransfer extends Panel implements ActionListener,
}
AlignmentI protein = thisAlignment.isNucleotide() ? al : thisAlignment;
AlignmentI dna = thisAlignment.isNucleotide() ? thisAlignment : al;
}
AlignmentI protein = thisAlignment.isNucleotide() ? al : thisAlignment;
AlignmentI dna = thisAlignment.isNucleotide() ? thisAlignment : al;
- boolean mapped = AlignmentUtils.mapProteinToCdna(protein, dna);
+ boolean mapped = AlignmentUtils.mapProteinAlignmentToCdna(protein, dna);
if (!mapped)
{
return false;
if (!mapped)
{
return false;
@@
-332,6
+350,11
@@
public class CutAndPasteTransfer extends Panel implements ActionListener,
}
/*
}
/*
+ * 'align' the added alignment to match the current one
+ */
+ al.alignAs(thisAlignment);
+
+ /*
* Open SplitFrame with DNA above and protein below, including the alignment
* from textbox and a copy of the original.
*/
* Open SplitFrame with DNA above and protein below, including the alignment
* from textbox and a copy of the original.
*/
@@
-358,7
+381,7
@@
public class CutAndPasteTransfer extends Panel implements ActionListener,
try
{
tcf = new TCoffeeScoreFile(textarea.getText(),
try
{
tcf = new TCoffeeScoreFile(textarea.getText(),
- jalview.io.AppletFormatAdapter.PASTE);
+ jalview.io.DataSourceType.PASTE);
if (tcf.isValid())
{
if (tcf.annotateAlignment(alignFrame.viewport.getAlignment(), true))
if (tcf.isValid())
{
if (tcf.annotateAlignment(alignFrame.viewport.getAlignment(), true))
@@
-391,7
+414,7
@@
public class CutAndPasteTransfer extends Panel implements ActionListener,
if (tcf == null)
{
if (new AnnotationFile().annotateAlignmentView(alignFrame.viewport,
if (tcf == null)
{
if (new AnnotationFile().annotateAlignmentView(alignFrame.viewport,
- textarea.getText(), jalview.io.AppletFormatAdapter.PASTE))
+ textarea.getText(), jalview.io.DataSourceType.PASTE))
{
alignFrame.alignPanel.fontChanged();
alignFrame.alignPanel.setScrollValues(0, 0);
{
alignFrame.alignPanel.fontChanged();
alignFrame.alignPanel.setScrollValues(0, 0);
@@
-403,7
+426,7
@@
public class CutAndPasteTransfer extends Panel implements ActionListener,
else
{
if (!alignFrame.parseFeaturesFile(textarea.getText(),
else
{
if (!alignFrame.parseFeaturesFile(textarea.getText(),
- jalview.io.AppletFormatAdapter.PASTE))
+ jalview.io.DataSourceType.PASTE))
{
alignFrame.statusBar
.setText(MessageManager
{
alignFrame.statusBar
.setText(MessageManager
@@
-427,12
+450,12
@@
public class CutAndPasteTransfer extends Panel implements ActionListener,
if (alignFrame.alignPanel.av.applet.jmolAvailable)
{
new jalview.appletgui.AppletJmol(pdb, new SequenceI[] { seq }, null,
if (alignFrame.alignPanel.av.applet.jmolAvailable)
{
new jalview.appletgui.AppletJmol(pdb, new SequenceI[] { seq }, null,
- alignFrame.alignPanel, AppletFormatAdapter.PASTE);
+ alignFrame.alignPanel, DataSourceType.PASTE);
}
else
{
new MCview.AppletPDBViewer(pdb, new SequenceI[] { seq }, null,
}
else
{
new MCview.AppletPDBViewer(pdb, new SequenceI[] { seq }, null,
- alignFrame.alignPanel, AppletFormatAdapter.PASTE);
+ alignFrame.alignPanel, DataSourceType.PASTE);
}
}
}
}
@@
-478,6
+501,7
@@
public class CutAndPasteTransfer extends Panel implements ActionListener,
this.add(textarea, java.awt.BorderLayout.CENTER);
}
this.add(textarea, java.awt.BorderLayout.CENTER);
}
+ @Override
public void mousePressed(MouseEvent evt)
{
if (textarea.getText().startsWith(
public void mousePressed(MouseEvent evt)
{
if (textarea.getText().startsWith(
@@
-487,18
+511,22
@@
public class CutAndPasteTransfer extends Panel implements ActionListener,
}
}
}
}
+ @Override
public void mouseReleased(MouseEvent evt)
{
}
public void mouseReleased(MouseEvent evt)
{
}
+ @Override
public void mouseClicked(MouseEvent evt)
{
}
public void mouseClicked(MouseEvent evt)
{
}
+ @Override
public void mouseEntered(MouseEvent evt)
{
}
public void mouseEntered(MouseEvent evt)
{
}
+ @Override
public void mouseExited(MouseEvent evt)
{
}
public void mouseExited(MouseEvent evt)
{
}