JAL-2344: Refactor file format options as interfaces instead of text strings

Activity

CR-JAL-8 13

Keyboard shortcuts  
  • Summarize the review outcomes (optional)
     
    #permalink

    Details

    Warning: no files are visible, they have all been filtered.
    Participant Role Time Spent Comments Latest Comment
    Author 48m 6 1) AlignFrame.outputFeatures() - format parameter here is...
    Reviewer - Complete 2m 7 Needs to be resolved
    Total   50m 13  
    #permalink

    Objectives

    Currently, supported file formats are handled as text strings (constants in AppletFormatAdapter).
    This is fragile (updates needed in several places for a new format), verbose (if-then-else statements), not type safe, does not support plug-in of additional formats.

    Enhance the code to use interfaces that describe file formats, with file format types as implementors of these interfaces.

    Branches in review

    #permalink

    Issues Raised From Comments

    Key Summary State Assignee
    JAL-2391
    #permalink

    General Comments

    Kira Mourão

    There are a few places in the code where I think strings could have been repl...

    There are a few places in the code where I think strings could have been replaced with IFileFormat. See:
    jalview.appletgui.AlignFrame::outputFeatures
    jalview.datamodel.PDBEntry::format
    jalview.gui.AlignFrame::saveAs_actionPerformed
    jalview.ws.ebi.EbiFetchClient::fetch*, buildUrl
    jalview.ws.rest.params.AnnotationFile::formatForInput

    Also jalview.bin.JalviewLite and jalview.javascript.JalviewLiteJsApi but not sure if these are used?

    Mungo Carstairs

    1) AlignFrame.outputFeatures() - format parameter here is a choice of Jalview...

    1) AlignFrame.outputFeatures() - format parameter here is a choice of Jalview or GFF, not a FileFormat in our sense - leave as is
    2) PDBEntry$Type.format - part of raised issue JAL-2391
    3) gui.AlignFrame.saveAs_actionPerformed: this uses FileFormatI where it can, or the string representation in user preferences, not sure what more can be done here
    4) EBIFetchClient - format here is to specify format of returned data, and service dependent (and could change!)

    • e.g. something like "display=xml" or "pdb" or "mmcif" or "uniprotxml" or "xml"
    • sometimes relate to a Jalview FileFormatI but strictly should be decoupled from it - covered in JAL-2391 also
      5) AnnotationFile.format is a choice of "JalviewAnnotation" or "CsvAnnotationRow" - I think out of scope of the current changes
      6) JalviewLiteJsApi provides a Javascript-to-Java bridge - see jalviewLiteJs.html and the 'Jalview Lite embedded' launch configuration / embedded.html - has to work in strings
    /examples/groovy/fileFormat.groovy Added
    Open in IDE #permalink
    /src/MCview/PDBViewer.java Changed
    /src/jalview/appletgui/APopupMenu.java Changed
    /src/jalview/appletgui/AlignFrame.java Changed
    /src/.../appletgui/CutAndPasteTransfer.java Changed
    /src/jalview/bin/JalviewLite.java Changed
    Open in IDE #permalink
    /src/.../bin/JalviewLiteURLRetrieve.java Changed
    /src/jalview/datamodel/PDBEntry.java Changed 1
    /src/jalview/gui/AlignFrame.java Changed
    /src/jalview/gui/CutAndPasteTransfer.java Changed
    /src/jalview/gui/Desktop.java Changed
    /src/jalview/gui/FeatureSettings.java Changed
    /src/jalview/gui/PopupMenu.java Changed
    /src/jalview/gui/Preferences.java Changed
    Open in IDE #permalink
    /src/jalview/gui/TreePanel.java Changed
    /src/jalview/gui/UserDefinedColours.java Changed
    /src/jalview/gui/WsParamSetManager.java Changed
    /src/jalview/io/AlignFile.java Changed
    /src/jalview/io/AlignmentFileI.java Deleted
    Open in IDE #permalink
    /src/jalview/io/AlignmentFileReaderI.java Added
    Open in IDE #permalink
    /src/jalview/io/AlignmentFileWriterI.java Added
    Open in IDE #permalink
    /src/jalview/io/AppletFormatAdapter.java Changed
    /src/jalview/io/FileFormat.java Changed
    /src/jalview/io/FileFormatI.java Changed
    /src/jalview/io/FileFormats.java Added
    /src/jalview/io/FileLoader.java Changed
    /src/jalview/io/FormatAdapter.java Changed
    /src/jalview/io/HTMLOutput.java Changed
    /src/jalview/io/HtmlSvgOutput.java Changed
    /src/jalview/io/IdentifyFile.java Changed
    /src/jalview/io/JalviewFileChooser.java Changed 4
    /src/jalview/io/JalviewFileView.java Changed
    /src/jalview/io/StructureFile.java Changed
    /src/jalview/jbgui/GAlignFrame.java Changed
    /src/jalview/util/ImageMaker.java Changed
    /src/jalview/.../dbsources/EmblXmlSource.java Changed
    /src/jalview/ws/dbsources/Pdb.java Changed 2
    /src/jalview/ws/dbsources/Uniprot.java Changed
    /src/jalview/ws/ebi/EBIFetchClient.java Changed
    /src/jalview/ws/jws1/JPredThread.java Changed
    /src/jalview/ws/rest/params/Alignment.java Changed 2
    /test/jalview/io/FileFormatsTest.java Added 2
    /test/jalview/io/FormatAdapterTest.java Changed
    Open in IDE #permalink
    /test/.../jabaws/DisorderAnnotExportImport.java Changed
    /test/.../jabaws/JpredJabaStructExportImport.java Changed
    /test/.../jabaws/RNAStructExportImport.java Changed

    Review updated: Reload | Ignore | Collapse

    You cannot reload the review while writing a comment.

    Log time against