label.successfully_loaded_file = Successfully loaded file {0}
label.successfully_loaded_matrix = Successfully loaded score matrix {0}
label.successfully_saved_to_file_in_format = Successfully saved to file: {0} in {1} format.
+label.successfully_printed_to_stdout_in_format = Successfully printed to STDOUT in {0} format.
label.copied_sequences_to_clipboard = Copied {0} sequences to clipboard.
label.check_file_matches_sequence_ids_alignment = Check that the file matches sequence IDs in the alignment.
label.problem_reading_tcoffee_score_file = Problem reading T-COFFEE score file
label.successfully_loaded_file = Fichero cargado exitosamente {0}
label.successfully_loaded_matrix = Matriz cargada exitosamente {0}
label.successfully_saved_to_file_in_format = Guardado exitosamente en el fichero: {0} en formato {1}.
+label.successfully_printed_to_stdout_in_format = Impresso exitosamente al STDOUT en formato {0}.
label.copied_sequences_to_clipboard = Copiadas {0} secuencias en el portapapeles.
label.check_file_matches_sequence_ids_alignment = Comprobar que el fichero coincide con el ID de la secuencia en el alineamiento.
label.problem_reading_tcoffee_score_file = Problema de lectura del fichero de puntuaciones T-COFFEE
theseArgsWereParsed &= processLinked(id);
processGroovyScript(id);
boolean processLinkedOkay = theseArgsWereParsed;
-
+
// wait around until alignFrame isn't busy
- AlignFrame af=afMap.get(id);
- while (af!=null && af.getViewport().isCalcInProgress())
+ AlignFrame af = afMap.get(id);
+ while (af != null && af.getViewport().isCalcInProgress())
{
- try {
+ try
+ {
Thread.sleep(25);
- } catch (Exception q) {};
+ } catch (Exception q)
+ {
+ }
+ ;
}
-
+
theseArgsWereParsed &= processImages(id);
if (processLinkedOkay)
theseArgsWereParsed &= processOutput(id);
if ("" != colour)
{
ColourSchemeI cs = ColourSchemeProperty.getColourScheme(
- af.getViewport(), af.getViewport().getAlignment(), colour);
-
- if (cs==null && !"None".equals(colour))
+ af.getViewport(), af.getViewport().getAlignment(),
+ colour);
+
+ if (cs == null && !"None".equals(colour))
+ {
+ Console.warn(
+ "Couldn't parse '" + colour + "' as a colourscheme.");
+ }
+ else
{
- Console.warn("Couldn't parse '"+colour+"' as a colourscheme.");
- } else {
af.changeColour(cs);
}
Jalview.testoutput(argParser, Arg.COLOUR, "zappo", colour);
structureFilepath, tft, paeFilepath, false,
ssFromStructure, false, viewerType);
- if (sv==null)
+ if (sv == null)
{
Console.error("Failed to import and open structure view.");
continue;
}
try
{
- long tries=1000;
- while (sv.isBusy() && tries>0)
+ long tries = 1000;
+ while (sv.isBusy() && tries > 0)
{
Thread.sleep(25);
if (sv.isBusy())
"Waiting for viewer for " + structureFilepath);
}
}
- if (tries==0 && sv.isBusy())
+ if (tries == 0 && sv.isBusy())
{
- Console.warn("Gave up waiting for structure viewer to load. Something may have gone wrong.");
+ Console.warn(
+ "Gave up waiting for structure viewer to load. Something may have gone wrong.");
}
} catch (Exception x)
{
- Console.warn("Exception whilst waiting for structure viewer "+structureFilepath,x);
+ Console.warn("Exception whilst waiting for structure viewer "
+ + structureFilepath, x);
}
- Console.debug("Successfully opened viewer for "+structureFilepath);
+ Console.debug(
+ "Successfully opened viewer for " + structureFilepath);
String structureImageFilename = ArgParser.getValueFromSubValOrArg(
avm, av, Arg.STRUCTUREIMAGE, subVals);
if (sv != null && structureImageFilename != null)
if (sview instanceof AppJmol)
{
AppJmol jmol = (AppJmol) sview;
- try {
- Console.debug("Rendering image to "+structureImageFile);
+ try
+ {
+ Console.debug("Rendering image to " + structureImageFile);
jmol.makePDBImage(structureImageFile, imageType, renderer,
- userBis);
- Console.debug("Finished Rendering image to "+structureImageFile);
+ userBis);
+ Console.debug("Finished Rendering image to "
+ + structureImageFile);
- }
- catch (ImageOutputException ioexc)
+ } catch (ImageOutputException ioexc)
{
- Console.warn("Unexpected error whilst exporting image to "+structureImageFile,ioexc);
+ Console.warn("Unexpected error whilst exporting image to "
+ + structureImageFile, ioexc);
}
}
Cache.setProperty("EXPORT_EMBBED_BIOJSON", "false");
Console.info("Writing " + file);
- try {
- switch (type)
+ try
{
-
- case "svg":
- Console.debug("Outputting type '" + type + "' to " + fileName);
- af.createSVG(file, renderer);
- break;
-
- case "png":
- Console.debug("Outputting type '" + type + "' to " + fileName);
- af.createPNG(file, null, userBis);
- break;
-
- case "html":
- Console.debug("Outputting type '" + type + "' to " + fileName);
- HtmlSvgOutput htmlSVG = new HtmlSvgOutput(af.alignPanel);
- htmlSVG.exportHTML(fileName, renderer);
- break;
-
- case "biojs":
- Console.debug("Creating BioJS MSA Viwer HTML file: " + fileName);
- try
- {
- BioJsHTMLOutput.refreshVersionInfo(
- BioJsHTMLOutput.BJS_TEMPLATES_LOCAL_DIRECTORY);
- } catch (URISyntaxException e)
+ switch (type)
{
- e.printStackTrace();
+
+ case "svg":
+ Console.debug("Outputting type '" + type + "' to " + fileName);
+ af.createSVG(file, renderer);
+ break;
+
+ case "png":
+ Console.debug("Outputting type '" + type + "' to " + fileName);
+ af.createPNG(file, null, userBis);
+ break;
+
+ case "html":
+ Console.debug("Outputting type '" + type + "' to " + fileName);
+ HtmlSvgOutput htmlSVG = new HtmlSvgOutput(af.alignPanel);
+ htmlSVG.exportHTML(fileName, renderer);
+ break;
+
+ case "biojs":
+ Console.debug(
+ "Creating BioJS MSA Viwer HTML file: " + fileName);
+ try
+ {
+ BioJsHTMLOutput.refreshVersionInfo(
+ BioJsHTMLOutput.BJS_TEMPLATES_LOCAL_DIRECTORY);
+ } catch (URISyntaxException e)
+ {
+ e.printStackTrace();
+ }
+ BioJsHTMLOutput bjs = new BioJsHTMLOutput(af.alignPanel);
+ bjs.exportHTML(fileName);
+ break;
+
+ case "eps":
+ Console.debug("Creating EPS file: " + fileName);
+ af.createEPS(file, name);
+ break;
+
+ case "imagemap":
+ Console.debug("Creating ImageMap file: " + fileName);
+ af.createImageMap(file, name);
+ break;
+
+ default:
+ Console.warn(Arg.IMAGE.argString() + " type '" + type
+ + "' not known. Ignoring");
+ break;
}
- BioJsHTMLOutput bjs = new BioJsHTMLOutput(af.alignPanel);
- bjs.exportHTML(fileName);
- break;
-
- case "eps":
- Console.debug("Creating EPS file: " + fileName);
- af.createEPS(file, name);
- break;
-
- case "imagemap":
- Console.debug("Creating ImageMap file: " + fileName);
- af.createImageMap(file, name);
- break;
-
- default:
- Console.warn(Arg.IMAGE.argString() + " type '" + type
- + "' not known. Ignoring");
- break;
- }
- } catch (Exception ioex) {
- Console.warn("Unexpected error during export",ioex);
+ } catch (Exception ioex)
+ {
+ Console.warn("Unexpected error during export", ioex);
}
}
}
String val = av.getValue();
SubVals subVals = av.getSubVals();
String fileName = subVals.getContent();
+ boolean stdout = fileName.equals("-");
File file = new File(fileName);
boolean overwrite = ArgParser.getFromSubValArgOrPref(avm,
Arg.OVERWRITE, subVals, null, "OVERWRITE_OUTPUT", false);
!Platform.isHeadless());
// if backups is not true then --overwrite must be specified
- if (file.exists() && !(overwrite || backups))
+ if (file.exists() && !(overwrite || backups || stdout))
{
Console.error("Won't overwrite file '" + fileName + "' without "
+ Arg.OVERWRITE.argString() + " or "
Console.info("Writing " + fileName);
- af.saveAlignment(fileName, ff);
+ af.saveAlignment(fileName, ff, stdout);
Console.debug("Returning backups to " + savedBackupsPreference);
if (savedBackupsPreference != null)
Cache.applicationProperties.put(BackupFiles.ENABLED,
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.URL;
import java.util.ArrayList;
import jalview.viewmodel.ViewportRanges;
import jalview.ws.DBRefFetcher;
import jalview.ws.DBRefFetcher.FetchFinishedListenerI;
-import jalview.ws.datamodel.alphafold.PAEContactMatrix;
import jalview.ws.jws1.Discoverer;
import jalview.ws.jws2.Jws2Discoverer;
import jalview.ws.jws2.jabaws2.Jws2Instance;
*/
public void saveAlignment(String file, FileFormatI format)
{
+ saveAlignment(file, format, false);
+ }
+
+ public void saveAlignment(String file, FileFormatI format, boolean stdout)
+ {
lastSaveSuccessful = true;
- lastFilenameSaved = file;
+ if (!stdout)
+ {
+ lastFilenameSaved = file;
+ }
lastFormatSaved = format;
if (FileFormat.Jalview.equals(format))
shortName = shortName
.substring(shortName.lastIndexOf(File.separatorChar) + 1);
}
+ // TODO deal with stdout=true
lastSaveSuccessful = new Jalview2XML().saveAlignment(this, file,
shortName);
else
{
// create backupfiles object and get new temp filename destination
- boolean doBackup = BackupFiles.getEnabled();
+ boolean doBackup = BackupFiles.getEnabled() && !stdout;
BackupFiles backupfiles = null;
if (doBackup)
{
String tempFilePath = doBackup ? backupfiles.getTempFilePath()
: file;
Console.trace("ALIGNFRAME setting PrintWriter");
- PrintWriter out = new PrintWriter(new FileWriter(tempFilePath));
+ PrintWriter out = stdout
+ ? new PrintWriter(new OutputStreamWriter(System.out))
+ : new PrintWriter(new FileWriter(tempFilePath));
if (backupfiles != null)
{
}
out.print(output);
+ out.flush();
Console.trace("ALIGNFRAME about to close file");
out.close();
Console.trace("ALIGNFRAME closed file");
- AlignFrame.this.setTitle(file);
- statusBar.setText(MessageManager.formatMessage(
- "label.successfully_saved_to_file_in_format", new Object[]
- { fileName, format.getName() }));
+ AlignFrame.this.setTitle(stdout ? "STDOUT" : file);
+ if (stdout)
+ {
+ statusBar.setText(MessageManager.formatMessage(
+ "label.successfully_printed_to_stdout_in_format",
+ new Object[]
+ { format.getName() }));
+ }
+ else
+ {
+ statusBar.setText(MessageManager.formatMessage(
+ "label.successfully_saved_to_file_in_format",
+ new Object[]
+ { fileName, format.getName() }));
+ }
lastSaveSuccessful = true;
} catch (IOException e)
{
protected void htmlMenuItem_actionPerformed(ActionEvent e)
{
HtmlSvgOutput htmlSVG = new HtmlSvgOutput(alignPanel);
- try {
+ try
+ {
htmlSVG.exportHTML(null);
- } catch (ImageOutputException x) {
+ } catch (ImageOutputException x)
+ {
// report problem to console and raise dialog
}
}
public void bioJSMenuItem_actionPerformed(ActionEvent e)
{
BioJsHTMLOutput bjs = new BioJsHTMLOutput(alignPanel);
- try {
- bjs.exportHTML(null);
- } catch (ImageOutputException x) {
- // report problem to console and raise dialog
- }
+ try
+ {
+ bjs.exportHTML(null);
+ } catch (ImageOutputException x)
+ {
+ // report problem to console and raise dialog
+ }
}
public void createImageMap(File file, String image)
{
- try {
- alignPanel.makePNGImageMap(file, image);
- } catch (ImageOutputException x) {
+ try
+ {
+ alignPanel.makePNGImageMap(file, image);
+ } catch (ImageOutputException x)
+ {
// report problem to console and raise dialog
}
}
@Override
- public void createPNG_actionPerformed(ActionEvent e) {
- try{
+ public void createPNG_actionPerformed(ActionEvent e)
+ {
+ try
+ {
createPNG(null);
} catch (ImageOutputException ioex)
{
// raise dialog, and report via console
}
}
+
@Override
- public void createEPS_actionPerformed(ActionEvent e) {
- try{
+ public void createEPS_actionPerformed(ActionEvent e)
+ {
+ try
+ {
createEPS(null);
} catch (ImageOutputException ioex)
{
// raise dialog, and report via console
}
-
+
}
+
@Override
- public void createSVG_actionPerformed(ActionEvent e) {
- try{
+ public void createSVG_actionPerformed(ActionEvent e)
+ {
+ try
+ {
createSVG(null);
} catch (ImageOutputException ioex)
{
// raise dialog, and report via console
}
-
+
}
+
/**
* Creates a PNG image of the alignment and writes it to the given file. If
* the file is null, the user is prompted to choose a file.
createPNG(f, null, BitmapImageSizing.nullBitmapImageSizing());
}
- public void createPNG(File f, String renderer, BitmapImageSizing userBis) throws ImageOutputException
+ public void createPNG(File f, String renderer, BitmapImageSizing userBis)
+ throws ImageOutputException
{
alignPanel.makeAlignmentImage(TYPE.PNG, f, renderer, userBis);
}
*
* @param f
*/
- public void createEPS(File f) throws ImageOutputException
+ public void createEPS(File f) throws ImageOutputException
{
createEPS(f, null);
}
*
* @param f
*/
- public void createSVG(File f) throws ImageOutputException
+ public void createSVG(File f) throws ImageOutputException
{
createSVG(f, null);
}
// annotation was duplicated earlier
alignment.addAnnotation(sequences[i].getAnnotation()[a]);
// take care of contact matrix too
- ContactMatrixI cm=sequences[i].getContactMatrixFor(sequences[i].getAnnotation()[a]);
- if (cm!=null)
+ ContactMatrixI cm = sequences[i]
+ .getContactMatrixFor(sequences[i].getAnnotation()[a]);
+ if (cm != null)
{
- alignment.addContactListFor(sequences[i].getAnnotation()[a], cm);
+ alignment.addContactListFor(sequences[i].getAnnotation()[a],
+ cm);
}
-
+
alignment.setAnnotationIndex(sequences[i].getAnnotation()[a],
a);
}
return tp;
}
- public void showContactMapTree(AlignmentAnnotation aa,
- ContactMatrixI cm)
+ public void showContactMapTree(AlignmentAnnotation aa, ContactMatrixI cm)
{
int x = 4, y = 5;
int w = 400, h = 500;
{
NewickFile fin = new NewickFile(
new FileParse(cm.getNewick(), DataSourceType.PASTE));
- String title = aa.label + " "
- + cm.getTreeMethod() + " tree" + (aa.sequenceRef != null
+ String title = aa.label + " " + cm.getTreeMethod() + " tree"
+ + (aa.sequenceRef != null
? (" for " + aa.sequenceRef.getDisplayId(false))
: "");