<mapID target="importvcf" url="html/features/importvcf.html" />
<mapID target="importvcf.attribs" url="html/features/importvcf.html#attribs" />
+ <mapID target="logging" url="html/logging.html" />
</map>
</tocitem>
</tocitem>
<tocitem text="Preferences" target="preferences" />
+ <tocitem text="The Java Console, Logging and Reporting Bugs" target="logging" />
<tocitem text="Scripting with Groovy" target="groovy">
<tocitem text="Groovy Features Counter example" target="groovy.featurescounter"/>
</tocitem>
"OK" to initiate the retrieval.</li>
</ol>
- <p>If you use the WSDBFetch sequence fetcher services (EMBL,
- UniProt, PFAM, and RFAM) in work for publication, please cite:</p>
- <p>
- Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S., Tate
- J., Velankar S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez
- R. <br> SOAP-based services provided by the European
- Bioinformatics Institute.<br> Nucleic Acids Res. 33(1):W25-W28
- (2005) <br> <br>
- </p>
+ <p>If you use the Sequence Fetcher, please remember to cite the
+ corresponding services (linked to below):</p>
+ <ul>
+ <li>Ensembl - <a
+ href="https://github.com/Ensembl/ensembl-rest/wiki#citing">The
+ Ensembl REST API</a></li>
+ <li>EMBL/EMBLCDS - Provided by the <a
+ href="https://www.ebi.ac.uk/ena/browser/api/#/ENA_Browser_Data_API/getFlatFileUsingGET">European
+ Nucleotide Archive's ENA Data API</a><br />
+ <em>Note: Versions of Jalview prior to 2.11.1.1 employed the
+ XML endpoint of the ENA browser, which was retired in August
+ 2020.</em></li>
+ <li>Uniprot - Free Text Search and Retrieval via the <a
+ href="https://www.uniprot.org/help/api">Uniprot REST API</a></li>
+ <li>PDB - Free Text Search via the <a
+ href="https://www.ebi.ac.uk/pdbe/api/doc/search.html">PDBe
+ REST API</a> and retrieval via <a
+ href="https://www.ebi.ac.uk/Tools/dbfetch/">WSDbFetch</a><br />
+ Pillai S., Silventoinen V., Kallio K., Senger M., Sobhany S., Tate
+ J., Velankar S., Golovin A., Henrick K., Rice P., Stoehr P., Lopez
+ R. <br> SOAP-based services provided by the European
+ Bioinformatics Institute.<br> Nucleic Acids Res.
+ 33(1):W25-W28 (2005) <br> <br>
+ </li>
+ </ul>
</body>
</html>
<td>Redo the last sequence edit undone.</td>
</tr>
<tr>
- <td><strong>Up Arrow</strong></td>
- <td>Both</td>
- <td>Moves selected sequence(s) up the alignment.<br />In
- Cursor mode press Alt key to move selection or sequence under
- cursor.
- </td>
- </tr>
- <tr>
- <td><strong>Down Arrow</strong></td>
- <td>Both</td>
- <td>Moves selected sequence(s) down the alignment.<br />In
- Cursor mode press Alt key to move selection or sequence under
- cursor.
- </td>
- </tr>
- <tr>
- <td><strong>Left Arrow</strong></td>
- <td>Normal</td>
- <td>Slides selected sequence(s) left. Press Alt key to slide
- in cursor mode</td>
- </tr>
- <tr>
- <td><strong>Right Arrow</strong></td>
- <td>Normal</td>
- <td>Slides selected sequence(s) right. Press Alt key to slide
- in cursor mode</td>
- </tr>
- <tr>
<td><strong>Cursor Keys<br> (Arrow Keys)
</strong></td>
<td>Cursor</td>
</td>
</tr>
<tr>
+ <td><strong>Cursor Keys<br> (Arrow Keys)
+ </strong></td>
+ <td>Normal<br />
+ <em>(+Alt in Cursor)</em></td>
+ <td>Moves selected sequence(s) up, down, left, or right
+ according to the direction pressed.<br>
+ <br>
+ <em>Alt+Arrow key to move selection or sequence under cursor
+ in cursor mode.</em>
+ </td>
+ </tr>
+ <tr>
<td><strong>Page Up</strong></td>
<td>Both</td>
<td>Scroll up the alignment view</td>
* The Jalview Authors are detailed in the 'AUTHORS' file.
-->
<head>
-<title>Logging and Reporting Bugs</title>
+<title>The Java Console, Logging and Reporting Bugs</title>
</head>
<body>
<h2>
<center>
- <strong>Logging and Reporting Bugs</strong>
+ <strong>The Java Console, Logging and Reporting Bugs</strong>
</center>
</h2>
<p>
However, it is possible that some early logging information from when Jalview is initially launched, is not shown in the Java Console:
<br/>
- If you are using a version of Jalview installed from one of our install4j installers, then Jalview's initial launch logging can be found in
+ If you are using a standard desktop version of Jalview installed from one of our install4j installers, then Jalview's initial launch logging can be found in
<pre>JALVIEW_APP_DIR/launcher.log</pre>
where <em>JALVIEW_APP_DIR</em> is the directory that Jalview's application was installed into.
<br/>
<li>In Linux and other Unix OSes this is <em>~/opt/jalview</em> by default</li>
</ul>
<br/>
- Whereas if you are using the Jalview executable jar file (also used by bioconda installations) then a minimised launcher will output logging information to STDOUT and STDERR.
+ Whereas if you are using the Jalview executable jar file (also used by bioconda installations) then the default run class (<em>jalview.bin.Launcher</em> -- a minimised launcher that will set memory and linux dpi settings before re-launching <em>jalview.bin.Jalview</em>), will output logging information to STDOUT and STDERR.
</p>
<h3><a name="java_console">Java Console and Log Level</a></h3>
-
-
+ <p>
+ The Java Console is opened by selecting <strong>Tools → Show Java Console</strong>. This option is saved across Jalview sessions so you can start Jalview with the Java Console already open by previously quitting Jalview with the Java Console already opened. Selecting <em>Show Java Console</em> in the <em>Tools</em> menu a second time will deselect the option and close the window. Closing the window in your system's usual way will also deselect the option in the <em>Tools</em> menu.
+ </p>
+ <p>
+ The Java Console's text display always shows information about your system and Jalview installation setup, which is followed by messages output from some of the processes that your Jalview session has performed since opening the console.
+ </p>
+ <p>
+ You can control the detail of what appears as output by selecting a <em>Log level</em> using the drop-down list at the bottom left of the console. There are several levels of logging that you can choose from: in decreasing levels of verbosity they are: TRACE, DEBUG, INFO, WARN. By default the level initially chosen is INFO.
+ </p>
+ <p>
+ <strong>Note! If you change the log level in the Java Console, this change will only persist for as long as the console is open. Once you close the console the log level will revert back to what it had been when you opened the console (usually INFO).</strong>
+ </p>
+ <p>
+ You can change the default log level by editing the Jalview preferenecs file, <em>.jalview_properties</em>, found in your home directory (on Windows: %HOMEPATH%, or the folder above 'My Documents'; on macOS: ~ or /Users/<em>username</em>; on linux/unix: ~ or /home/<em>username</em>), and setting the property <em>logs.Jalview.level</em> to the log level you prefer, e.g.
+ <pre>
+ logs.Jalview.level=DEBUG
+ </pre>
+ You can also set the property
+ <pre>
+ logs.Axis.level=DEBUG
+ </pre>
+ to get debug information for Jalview's JPred service. The Axis log level cannot be set from within the Java Console.
+ </p>
+ <p>
+ You can set the <em>logs.jalview.level</em> property to a log level not usually presented in the Java Console (though restricted to log levels used by Apache Log4j -- see <a href="https://logging.apache.org/log4j/2.x/manual/customloglevels.html">Log4j Custom Log Levels</a> for details of the standard log levels available). Jalview does not currently define any custom log levels. If you do set the property with a log level that is normally not visible in the Java Console this should be respected and visibly selected when you open the console.
+ </p>
+ <p>
+ The <em>Clear</em> button at the bottom of the console will clear all logging messages except for the initial system information which is rewritten to the console.
+ </p>
+ <p>
+ The <em>Copy to clipboard</em> button at the bottom right of the console will copy all of the text in the console to your system clipboard, ready to paste into another application (e.g. email composer or issue tracker).
+ </p>
+
<h3>Reporting Bugs</h3>
+ <p>
+ If you come across a problem in Jalview where something is not working as described, or how you think it should, you should first check the <a href="https://www.jalview.org/faq">Jalview FAQ</a> to see if this is a known problem and if there is a suggested workaround.
+ </p>
+ <p>
+ If there is no FAQ answer covering your problem then you can submit a bug report on the <a href="https://issues.jalview.org/">Jalview Issue Tracker</a>. It is good practice to search the issue tracker first to see if the issue has already been reported. If an issue already exists please continue to add your own comments to the issue which may well help narrow down the problem, if not then you can create an account and submit a new bug report:
+ </p>
+ <p>
+ Make sure that you set Project to <em>Jalview (JAL)</em>, and Issue Type to <em>Bug</em> or <em>New Feature</em> or <em>Improvement</em> appropriately.<br/>
+ Give a one line summary of the issue in the <em>Summary</em>.
+ <br/>
+ In the <em>Environment</em> text box you can describe the system you are using. This is usually most easily done by opening the Java Console, clicking the <em>Clear</em> button, and then immediately on the <em>Copy to clipboard</em> button, and then pasting the clipboard into the text box.
+ </p>
+ <p>
+ You can then give more detailed information about how to recreate the problem in the <em>Description</em> text box. If you want to attach any screenshots or example alignment files that demonstrate the problem then you can drag them to the Create Issue dialog in your browser, or use the <em>Attachment</em> browse facility to locate them on your computer.
+ </p>
+
+ <p>
+ To help the Jalview team with diagnosing a particular issue, it is really helpful if you can also add more detailed logs output whilst re-creating the problem. To do this, open the Java Console, click the <em>Clear</em> button and select TRACE in the <em>Log level</em> drop down list.
+ <br/>
+ Whilst leaving the console open, perform the task in Jalview that re-creates the problem.
+ <br/>
+ Then you can copy the debug information in the Java Console by clicking on the <em>Copy to clipboard</em> button and then paste that into the Description, or a Comment of your issue.
+ </p>
+
+ <p>For other queries or comments about Jalview, remember you can contact the Jalview team using email via the <a href="https://www.jalview.org/mailman/listinfo/jalview-discuss">Jalview discussion list</a> or on Twitter <a href="https://twitter.com/Jalview/">@Jalview</a>!
+ </p>
</body>
</html>
specifying output format when exporting an alignment via the
command line
</li>
+ <li>
+ <!-- JAL-3667 -->Windows 10: For a minority of users, if
+ backups are not enabled, Jalview sometimes fails to
+ overwrite an existing file and raises a warning dialog. (in
+ 2.11.0, and 2.11.1.0, the workaround is to try to save the
+ file again, and if that fails, delete the original file and
+ save in place.)
+ </li>
</ul> <em>Developing Jalview</em>
<ul>
<li>
tooltips. (Also affects v2.11.1.0)
</li>
<li>
- <!-- JAL-3667 -->Windows 10: For a minority of users, if
- backups are not enabled, Jalview sometimes fails to
- overwrite an existing file and raises a warning dialog.
- Workaround is to try to save the file again, and if that
- fails, delete the original file and save in place.
- </li>
- <li>
<!-- JAL-3702 -->Drag and drop of alignment file onto
- alignment window not working correctly when in a HiDPI
- scaled mode in Linux
+ alignment window when in a HiDPI scaled mode in Linux only
+ works for the top left quadrant of the alignment window
</li>
<li>
<!-- JAL-3701 -->Stale build data in jalview standalone jar
builds (only affects 2.11.1.1 branch)
</li>
+ <li>
+ <!-- JAL-3127 -->Sequence ID colourscheme not re-applied
+ when alignment view restored from project (since Jalview 2.11.0)
+ </li>
</ul>
</td>
</tr>
* @return
*/
MappedFeatures findComplementFeaturesAtResidue(SequenceI sequence, int pos);
+
+ /**
+ * Sends a message to let any registered parties know that something about
+ * feature rendering has changed
+ */
+ void notifyFeaturesChanged();
+
}
// interface, simplifying instantiating classes
/**
- * Answers true if the specified feature type is displayed
+ * Answers true if the specified feature type is to be displayed, false if no
+ * preference
*
* @param type
* @return
boolean isFeatureDisplayed(String type);
/**
+ * Answers true if the specified feature type is to be hidden, false if no
+ * preference
+ *
+ * @param type
+ * @return
+ */
+ boolean isFeatureHidden(String type);
+
+ /**
* Answers true if the specified feature group is displayed
*
* @param group
void setVisible(String featureType);
+ void setHidden(String featureType);
+
/**
* Sets all the specified feature types to visible. Visibility of other
* feature types is not changed.
// lcastor = Logger.getLogger("org.exolab.castor.xml.Marshaller");
// lcastor.setLevel(Level.toLevel(Cache.getDefault("logs.Castor.Level",
// Level.INFO.toString())));
+ // we shouldn't need to do this
+ org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.INFO);
+
jalview.bin.Cache.log.setLevel(Level.toLevel(Cache
.getDefault("logs.Jalview.level", Level.INFO.toString())));
// laxis.addAppender(ap);
SequenceOntologyI so = SequenceOntologyFactory.getInstance();
@Override
- public boolean isFeatureDisplayed(String type)
+ public boolean isFeatureHidden(String type)
{
- return (so.isA(type, SequenceOntologyI.EXON)
- || so.isA(type, SequenceOntologyI.SEQUENCE_VARIANT));
+ return (!so.isA(type, SequenceOntologyI.EXON)
+ && !so.isA(type, SequenceOntologyI.SEQUENCE_VARIANT));
}
@Override
import jalview.api.AlignmentViewPanel;
import jalview.api.FeatureRenderer;
+import jalview.api.FeatureSettingsModelI;
import jalview.api.SequenceRenderer;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+import jalview.gui.AppJmol;
import jalview.gui.IProgressIndicator;
import jalview.io.DataSourceType;
import jalview.io.StructureFile;
import jalview.structure.StructureSelectionManager;
import jalview.structures.models.AAStructureBindingModel;
import jalview.util.MessageManager;
+import jalview.ws.dbsources.Pdb;
import java.awt.Color;
import java.awt.Container;
FeatureRenderer fr = getFeatureRenderer(null);
if (fr != null)
{
- fr.featuresAdded();
+ FeatureSettingsModelI colours = new Pdb().getFeatureColourScheme();
+ ((AppJmol) getViewer()).getAlignmentPanel().av
+ .applyFeaturesStyle(colours);
}
refreshGUI();
loadNotifiesHandled++;
}
/**
- * DOCUMENT ME!
+ * Calls AlignmentI.moveSelectedSequencesByOne with current sequence selection or the sequence under cursor in keyboard mode
*
* @param up
- * DOCUMENT ME!
+ * or down (if !up)
*/
public void moveSelectedSequences(boolean up)
{
if (sg == null)
{
- return;
+ if (viewport.cursorMode)
+ {
+ sg = new SequenceGroup();
+ sg.addSequence(viewport.getAlignment()
+ .getSequenceAt(alignPanel.getSeqPanel().seqCanvas.cursorY),false);
+ } else {
+ return;
+ }
+ }
+
+ if (sg.getSize() < 1)
+ {
+ return;
}
+
+ // TODO: JAL-3733 - add an event to the undo buffer for this !
+
viewport.getAlignment().moveSelectedSequencesByOne(sg,
viewport.getHiddenRepSequences(), up);
alignPanel.paintAlignment(true, false);
FeatureRenderer fr = getAlignPanel().getSeqPanel().seqCanvas
.getFeatureRenderer();
- List<String> origRenderOrder = new ArrayList(),
- origGroups = new ArrayList();
+ List<String> origRenderOrder = new ArrayList<>();
+ List<String> origGroups = new ArrayList<>();
// preserve original render order - allows differentiation between user configured colours and autogenerated ones
origRenderOrder.addAll(fr.getRenderOrder());
origGroups.addAll(fr.getFeatureGroups());
if (!mergeOnly)
{
// only clear displayed features if we are mergeing
- displayed.clear();
+ // displayed.clear();
}
// TODO this clears displayed.featuresRegistered - do we care?
//
{
displayed.setVisible(type);
}
+ else if (featureSettings.isFeatureHidden(type))
+ {
+ displayed.setHidden(type);
+ }
}
}
fr.orderFeatures(featureSettings);
}
fr.setTransparency(featureSettings.getTransparency());
+
+ fr.notifyFeaturesChanged();
}
public String getViewName()
AlignmentPanel ap = (alignment == null)
? appJmolWindow.getAlignmentPanel()
: (AlignmentPanel) alignment;
- if (ap.av.isShowSequenceFeatures())
- {
- return ap.av.getAlignPanel().getSeqPanel().seqCanvas.fr;
- }
-
- return null;
+ return ap.av.getAlignPanel().getFeatureRenderer();
}
}
/*
* ensure that any newly discovered features (e.g. RESNUM)
- * are added to any open feature settings dialog
+ * are notified to the FeatureRenderer (and added to any
+ * open feature settings dialog)
*/
FeatureRenderer fr = getBinding().getFeatureRenderer(null);
if (fr != null)
*/
if (viewport != null && viewport.getAlignment() != null)
{
- if (proxyColourScheme != null)
- {
- viewport.applyFeaturesStyle(proxyColourScheme);
- }
((AlignViewport) viewport).addAlignment(al, title);
+ viewport.applyFeaturesStyle(proxyColourScheme);
}
else
{
}
}
- if (preferredFeatureColours != null)
- {
- af.getViewport().applyFeaturesStyle(preferredFeatureColours);
- }
+ af.getViewport().applyFeaturesStyle(preferredFeatureColours);
if (Cache.getDefault("HIDE_INTRONS", true))
{
af.hideFeatureColumns(SequenceOntologyI.EXON, false);
.getFeatureColourScheme();
if (viewport != null)
{
- if (proxyColourScheme != null)
- {
- viewport.applyFeaturesStyle(proxyColourScheme);
- }
// append to existing alignment
viewport.addAlignment(al, title);
+ viewport.applyFeaturesStyle(proxyColourScheme);
}
else
{
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.api.FeatureSettingsModelI;
+import jalview.bin.Cache;
import jalview.util.MessageManager;
import java.io.BufferedInputStream;
}
return error;
}
-
+
/**
- * Recognise the 2-byte magic header for gzip streams
+ * Recognise the 2-byte magic header indicating a gzipped stream
*
+ * see
* https://recalll.co/ask/v/topic/java-How-to-check-if-InputStream-is-Gzipped/555aadd62bd27354438b90f6
*
- * @param bytes - at least two bytes
- * @return
+ * @param input
+ * - input stream that supports mark and contains at least two bytes
+ *
+ * @return false if mark not supported or no magic header found
+ *
+ * @throws IOException
*/
- private static boolean isGzipStream(byte[] bytes) {
- int head = ((int) bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
- return (GZIPInputStream.GZIP_MAGIC == head);
+ public static boolean isGzipStream(InputStream input) throws IOException
+ {
+ if (!input.markSupported())
+ {
+ Cache.log.error(
+ "FileParse.izGzipStream: input stream must support mark/reset");
+ return false;
+ }
+ input.mark(4);
+
+ // get first 2 bytes or return false
+ byte[] bytes = new byte[2];
+ int read = input.read(bytes);
+ input.reset();
+ if (read != bytes.length)
+ {
+ return false;
+ }
+
+ int header = (bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
+ return (GZIPInputStream.GZIP_MAGIC == header);
}
/**
// NB: stackoverflow https://stackoverflow.com/questions/4818468/how-to-check-if-inputstream-is-gzipped
// could use a PushBackInputStream rather than a BufferedInputStream
-
- BufferedInputStream bufinput;
+
if (!input.markSupported()) {
- bufinput= new BufferedInputStream(input,16);
- input = bufinput;
+ input = new BufferedInputStream(input,16);
}
- input.mark(4);
- byte[] bytes=input.readNBytes(2);
- input.reset();
- if (bytes.length==2 && isGzipStream(bytes)) {
+ if (isGzipStream(input)) {
return getGzipReader(input);
}
// return a buffered reader for the stream.
private static final String FEATURE_RES_NUM = PDBChain.RESNUM_FEATURE;
@Override
- public boolean isFeatureDisplayed(String type)
+ public boolean isFeatureHidden(String type)
{
- return type.equalsIgnoreCase(FEATURE_INSERTION)
- || type.equalsIgnoreCase(FEATURE_RES_NUM);
+ return type.equalsIgnoreCase(FEATURE_RES_NUM);
}
@Override
}
@Override
+ public boolean isFeatureHidden(String type)
+ {
+ return false;
+ }
+
+ @Override
public boolean isGroupDisplayed(String group)
{
return true;
Map<String, Float> featureOrder = null;
- protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(
- this);
-
protected AlignViewportI av;
+ private PropertyChangeSupport changeSupport = new PropertyChangeSupport(
+ this);
+
@Override
public AlignViewportI getViewport()
{
{
firing = Boolean.TRUE;
findAllFeatures(true); // add all new features as visible
- changeSupport.firePropertyChange("changeSupport", null, null);
+ notifyFeaturesChanged();
firing = Boolean.FALSE;
}
}
}
@Override
+ public void notifyFeaturesChanged()
+ {
+ changeSupport.firePropertyChange("changeSupport", null, null);
+ }
+
+ @Override
public List<SequenceFeature> findFeaturesAtColumn(SequenceI sequence, int column)
{
/*
public class FeaturesDisplayed implements FeaturesDisplayedI
{
- private Set<String> featuresDisplayed = new HashSet<String>();
+ private Set<String> featuresDisplayed = new HashSet<>();
- private Set<String> featuresRegistered = new HashSet<String>();
+ private Set<String> featuresRegistered = new HashSet<>();
public FeaturesDisplayed(FeaturesDisplayedI featuresDisplayed2)
{
}
@Override
+ public void setHidden(String featureType)
+ {
+ featuresDisplayed.remove(featureType);
+ featuresRegistered.add(featureType);
+ }
+
+ @Override
public boolean isRegistered(String type)
{
return featuresRegistered.contains(type);
/**
* Check behaviour of feature colour scheme for EnsemblGene sequences.
- * Currently coded to display exon and sequence_variant (or sub-types) only,
- * with sequence_variant in red above exon coloured by label.
+ * Currently coded to hide all except exon and sequence_variant (or sub-types)
+ * only, with sequence_variant in red above exon coloured by label.
*/
@Test(groups = "Functional")
public void testGetFeatureColourScheme()
{
FeatureSettingsModelI fc = new EnsemblGene().getFeatureColourScheme();
- assertTrue(fc.isFeatureDisplayed("exon"));
- assertTrue(fc.isFeatureDisplayed("coding_exon")); // subtype of exon
- assertTrue(fc.isFeatureDisplayed("sequence_variant"));
- assertTrue(fc.isFeatureDisplayed("feature_variant")); // subtype
- assertFalse(fc.isFeatureDisplayed("transcript"));
+ assertFalse(fc.isFeatureDisplayed("exon"));
+ assertFalse(fc.isFeatureHidden("exon"));
+ assertFalse(fc.isFeatureDisplayed("coding_exon")); // subtype of exon
+ assertFalse(fc.isFeatureHidden("coding_exon")); // subtype of exon
+ assertFalse(fc.isFeatureDisplayed("sequence_variant"));
+ assertFalse(fc.isFeatureHidden("sequence_variant"));
+ assertFalse(fc.isFeatureDisplayed("feature_variant")); // subtype
+ assertFalse(fc.isFeatureHidden("feature_variant")); // subtype
+ assertTrue(fc.isFeatureHidden("transcript"));
+ assertTrue(fc.isFeatureHidden("CDS"));
+
assertEquals(Color.RED, fc.getFeatureColour("sequence_variant")
.getColour());
assertEquals(Color.RED, fc.getFeatureColour("feature_variant")
*/
package jalview.io;
-import jalview.gui.JvOptionPane;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import java.io.BufferedInputStream;
import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStream;
import org.testng.AssertJUnit;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+import jalview.bin.Cache;
+import jalview.gui.JvOptionPane;
+
/**
* @author jimp
*
@BeforeClass(alwaysRun = true)
public static void setUpBeforeClass() throws Exception
{
+ Cache.initLogger();
}
/**
public void testStarsInFasta1() throws IOException
{
String uri;
- FileParse fp = new FileParse(uri = STARS_FA_FILE1.getAbsoluteFile()
- .toString(), DataSourceType.FILE);
+ FileParse fp = new FileParse(
+ uri = STARS_FA_FILE1.getAbsoluteFile().toString(),
+ DataSourceType.FILE);
assertValidFormat(FileFormat.Fasta, uri, fp);
}
public void testStarsInFasta2() throws IOException
{
String uri;
- FileParse fp = new FileParse(uri = STARS_FA_FILE2.getAbsoluteFile()
- .toString(), DataSourceType.FILE);
+ FileParse fp = new FileParse(
+ uri = STARS_FA_FILE2.getAbsoluteFile().toString(),
+ DataSourceType.FILE);
assertValidFormat(FileFormat.Fasta, uri, fp);
}
public void testGzipIo() throws IOException
{
String uri;
- FileParse fp = new FileParse(uri = ALIGN_FILE.getAbsoluteFile().toURI()
- .toString(), DataSourceType.URL);
+ FileParse fp = new FileParse(
+ uri = ALIGN_FILE.getAbsoluteFile().toURI().toString(),
+ DataSourceType.URL);
assertValidFormat(FileFormat.Fasta, uri, fp);
}
public void testGziplocalFileIO() throws IOException
{
String filepath;
- FileParse fp = new FileParse(filepath = ALIGN_FILE.getAbsoluteFile()
- .toString(), DataSourceType.FILE);
+ FileParse fp = new FileParse(
+ filepath = ALIGN_FILE.getAbsoluteFile().toString(),
+ DataSourceType.FILE);
assertValidFormat(FileFormat.Fasta, filepath, fp);
}
@Test(groups = { "Functional" })
+ public void testIsGzipInputStream() throws IOException
+ {
+ InputStream is = new FileInputStream(ALIGN_FILE);
+
+ /*
+ * first try fails - FileInputStream does not support mark/reset
+ */
+ assertFalse(FileParse.isGzipStream(is));
+
+ /*
+ * wrap in a BufferedInputStream and try again
+ */
+ is = new BufferedInputStream(is, 16);
+ assertTrue(FileParse.isGzipStream(is));
+ }
+
+ @Test(groups = { "Functional" })
public void testNonGzipURLIO() throws IOException
{
String uri;
- FileParse fp = new FileParse(uri = NOTGZALIGN_FILE.getAbsoluteFile()
- .toURI().toString(), DataSourceType.URL);
+ FileParse fp = new FileParse(
+ uri = NOTGZALIGN_FILE.getAbsoluteFile().toURI().toString(),
+ DataSourceType.URL);
assertValidFormat(FileFormat.Fasta, uri, fp);
}
public void testNonGziplocalFileIO() throws IOException
{
String filepath;
- FileParse fp = new FileParse(filepath = NOTGZALIGN_FILE
- .getAbsoluteFile().toString(), DataSourceType.FILE);
+ FileParse fp = new FileParse(
+ filepath = NOTGZALIGN_FILE.getAbsoluteFile().toString(),
+ DataSourceType.FILE);
assertValidFormat(FileFormat.Fasta, filepath, fp);
}
}