import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;
-import java.util.Set;
import java.util.Vector;
import javax.swing.JCheckBoxMenuItem;
public void setGUINucleotide(boolean nucleotide)
{
showTranslation.setVisible(nucleotide);
+ showReverse.setVisible(nucleotide);
+ showReverseComplement.setVisible(nucleotide);
conservationMenuItem.setEnabled(!nucleotide);
modifyConservation.setEnabled(!nucleotide);
showGroupConservation.setEnabled(!nucleotide);
return;
}
- format = new IdentifyFile().Identify(str, "Paste");
+ format = new IdentifyFile().identify(str, "Paste");
} catch (OutOfMemoryError er)
{
// TODO 1: no mappings are set up for EMBL product
// TODO 2: if they were, should add them to protein alignment, not
// dna
- Set<AlignedCodonFrame> cf = prods.getCodonFrames();
+ List<AlignedCodonFrame> cf = prods.getCodonFrames();
for (AlignedCodonFrame acf : cf)
{
al.addCodonFrame(acf);
}
- AlignFrame naf = new AlignFrame(al, DEFAULT_WIDTH,
+ AlignFrame newFrame = new AlignFrame(al, DEFAULT_WIDTH,
DEFAULT_HEIGHT);
- String newtitle = "" + ((dna) ? "Proteins" : "Nucleotides")
- + " for " + ((isRegSel) ? "selected region of " : "")
+ String newtitle = "" + (dna ? "Proteins" : "Nucleotides")
+ + " for " + (isRegSel ? "selected region of " : "")
+ getTitle();
- naf.setTitle(newtitle);
+ newFrame.setTitle(newtitle);
- // temporary flag until SplitFrame is released
boolean asSplitFrame = Cache.getDefault(
Preferences.ENABLE_SPLIT_FRAME, true);
if (asSplitFrame)
.getSequenceSelection();
if (dna)
{
- copyAlignment = AlignmentUtils.makeExonAlignment(
+ copyAlignment = AlignmentUtils.makeCdsAlignment(
sequenceSelection, cf);
al.getCodonFrames().clear();
al.getCodonFrames().addAll(cf);
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
copyThis.setTitle(AlignFrame.this.getTitle());
// SplitFrame with dna above, protein below
- SplitFrame sf = new SplitFrame(dna ? copyThis : naf,
- dna ? naf : copyThis);
- naf.setVisible(true);
+ boolean showSequenceFeatures = viewport
+ .isShowSequenceFeatures();
+ newFrame.setShowSeqFeatures(showSequenceFeatures);
+ copyThis.setShowSeqFeatures(showSequenceFeatures);
+ SplitFrame sf = new SplitFrame(dna ? copyThis : newFrame,
+ dna ? newFrame : copyThis);
+ newFrame.setVisible(true);
copyThis.setVisible(true);
String linkedTitle = MessageManager
.getString("label.linked_view_title");
}
else
{
- Desktop.addInternalFrame(naf, newtitle, DEFAULT_WIDTH,
+ Desktop.addInternalFrame(newFrame, newtitle, DEFAULT_WIDTH,
DEFAULT_HEIGHT);
}
}
String type = null;
try
{
- type = new IdentifyFile().Identify(file, protocol);
+ type = new IdentifyFile().identify(file, protocol);
} catch (Exception ex)
{
type = null;
/**
* Attempt to load a "dropped" file or URL string: First by testing whether
- * it's and Annotation file, then a JNet file, and finally a features file. If
+ * it's an Annotation file, then a JNet file, and finally a features file. If
* all are false then the user may have dropped an alignment file onto this
* AlignFrame.
*
{
if (protocol == null)
{
- protocol = jalview.io.FormatAdapter.checkProtocol(file);
+ protocol = FormatAdapter.checkProtocol(file);
}
// if the file isn't identified, or not positively identified as some
// other filetype (PFAM is default unidentified alignment file type) then
// try to parse it as a features file
if (format == null)
{
- format = new IdentifyFile().Identify(file, protocol);
+ format = new IdentifyFile().identify(file, protocol);
}
if (format.equalsIgnoreCase("JnetFile"))
{
viewport.setColumnSelection(cs);
isAnnotation = true;
}
- else
+ else if (IdentifyFile.FeaturesFile.equals(format))
{
- /*
- * if (format.equalsIgnoreCase("PDB")) {
- *
- * String pdbfn = ""; // try to match up filename with sequence id
- * try { if (protocol == jalview.io.FormatAdapter.FILE) { File fl =
- * new File(file); pdbfn = fl.getName(); } else if (protocol ==
- * jalview.io.FormatAdapter.URL) { URL url = new URL(file); pdbfn =
- * url.getFile(); } } catch (Exception e) { } ; if (assocSeq ==
- * null) { SequenceIdMatcher idm = new SequenceIdMatcher(viewport
- * .getAlignment().getSequencesArray()); if (pdbfn.length() > 0) {
- * // attempt to find a match in the alignment SequenceI mtch =
- * idm.findIdMatch(pdbfn); int l = 0, c = pdbfn.indexOf("."); while
- * (mtch == null && c != -1) { while ((c = pdbfn.indexOf(".", l)) >
- * l) { l = c; } if (l > -1) { pdbfn = pdbfn.substring(0, l); } mtch
- * = idm.findIdMatch(pdbfn); } if (mtch != null) { // try and
- * associate // prompt ? PDBEntry pe = new AssociatePdbFileWithSeq()
- * .associatePdbWithSeq(file, protocol, mtch, true); if (pe != null)
- * { System.err.println("Associated file : " + file + " with " +
- * mtch.getDisplayId(true)); alignPanel.paintAlignment(true); } } //
- * TODO: maybe need to load as normal otherwise return; } }
- */
- // try to parse it as a features file
- boolean isGroupsFile = parseFeaturesFile(file, protocol);
- // if it wasn't a features file then we just treat it as a general
- // alignment file to load into the current view.
- if (!isGroupsFile)
+ if (parseFeaturesFile(file, protocol))
{
- new FileLoader().LoadFile(viewport, file, protocol, format);
+ alignPanel.paintAlignment(true);
}
+ }
else
{
- alignPanel.paintAlignment(true);
+ new FileLoader().LoadFile(viewport, file, protocol, format);
}
- }
}
}
if (isAnnotation)
} catch (Exception x)
{
}
- ;
new OOMWarning(
"loading data "
+ (protocol != null ? (protocol.equals(FormatAdapter.PASTE) ? "from clipboard."
{
// TODO no longer a menu action - refactor as required
final AlignmentI alignment = getViewport().getAlignment();
- Set<AlignedCodonFrame> mappings = alignment.getCodonFrames();
+ List<AlignedCodonFrame> mappings = alignment.getCodonFrames();
if (mappings == null)
{
return;
sf.setComplementVisible(this, show);
}
}
+
+ /**
+ * Generate the reverse (optionally complemented) of the selected sequences,
+ * and add them to the alignment
+ */
+ @Override
+ protected void showReverse_actionPerformed(boolean complement)
+ {
+ AlignmentI al = null;
+ try
+ {
+ Dna dna = new Dna(viewport, viewport.getViewAsVisibleContigs(true));
+
+ al = dna.reverseCdna(complement);
+ viewport.addAlignment(al, "");
+ } catch (Exception ex)
+ {
+ System.err.println(ex.getMessage());
+ return;
+ }
+ }
}
class PrintThread extends Thread