Merge remote-tracking branch 'origin/features/JAL-2909_bamImport2_11' into features/JAL-2909_bamImport_2_11_2
Conflicts:
src/jalview/io/AlignmentFileReaderI.java
src/jalview/io/AppletFormatAdapter.java
src/jalview/io/FileFormat.java
src/jalview/io/FileLoader.java
label.most_polymer_residues = Most Polymer Residues
label.cached_structures = Cached Structures
label.free_text_search = Free Text Search
+label.annotation_name = Annotation Name
+label.annotation_description = Annotation Description
+label.edit_annotation_name_description = Edit Annotation Name/Description
+label.alignment = alignment
+label.pca = PCA
+label.create_image_of = Create {0} image of {1}
+label.click_to_edit = Click to edit, right-click for menu
+label.backupfiles_confirm_delete = Confirm delete
+label.backupfiles_confirm_delete_old_files = Delete the following older backup files? (see the Backups tab in Preferences for more options)
+label.backupfiles_confirm_save_file = Confirm save file
+label.backupfiles_confirm_save_file_backupfiles_roll_wrong = Something possibly went wrong with the backups of this file.
+label.backupfiles_confirm_save_new_saved_file_ok = The new saved file seems okay.
+label.backupfiles_confirm_save_new_saved_file_not_ok = The new saved file might not be okay.
+label.continue_operation = Continue operation?
+label.backups = Backups
+label.backup = Backup
+label.backup_files = Backup Files
+label.enable_backupfiles = Enable backup files
+label.backup_filename_strategy = Backup filename strategy
+label.append_to_filename = Append to filename (%n is replaced by the backup number)
+label.append_to_filename_tooltip = %n in the text will be replaced by the backup number. The text will appear after the filename. See the summary box above.
+label.index_digits = Number of digits to use for the backup number (%n)
+label.scheme_examples = Scheme examples
+label.increment_index = Increase appended text numbers - newest file has largest number.
+label.reverse_roll = "Roll" appended text numbers - newest backup file is always number 1.
+label.keep_files = Deleting old backup files
+label.keep_all_backup_files = Do not delete old backup files
+label.keep_only_this_number_of_backup_files = Keep only this number of most recent backup files
+label.autodelete_old_backup_files = Auto-delete old backup files:
+label.always_ask = Always ask
+label.auto_delete = Automatically delete
+label.filename = filename
+label.braced_oldest = (oldest)
+label.braced_newest = (most recent)
+label.configuration = Configuration
+label.configure_feature_tooltip = Click to configure variable colour or filters
+label.schemes = Schemes
+label.customise = Customise
+label.custom = Custom
+label.default = Default
+label.single_file = Single backup
+label.keep_all_versions = Keep all versions
+label.rolled_backups = Rolled backup files
+label.customise_description = Select Customise, make changes, and click on OK to save your own custom scheme
+label.custom_description = Your own saved scheme
+label.default_description = Keep the last three versions of the file
+label.single_file_description = Keep the last version of the file
+label.keep_all_versions_description = Keep all previous versions of the file
+label.rolled_backups_description = Keep the last nine versions of the file from _bak.1 (newest) to _bak.9 (oldest)
+label.cancel_changes_description = Cancel changes made to your last saved Custom scheme
+label.no_backup_files = NO BACKUP FILES
+label.include_backup_files = Include backup files
+label.cancel_changes = Cancel changes
+label.warning_confirm_change_reverse = Warning!\nIf you change the increment/decrement of the backup filename number, without changing the suffix or number of digits,\nthis may cause loss of backup files created with the previous backup filename scheme.\nAre you sure you wish to do this?
+label.change_increment_decrement = Change increment/decrement?
+label.newerdelete_replacement_line = Backup file\n''{0}''\t(modified {2}, size {4})\nis to be deleted and replaced by apparently older file\n''{1}''\t(modified {3}, size {5}).
+label.confirm_deletion_or_rename = Confirm deletion of ''{0}'' or rename to ''{1}''?
+label.newerdelete_line = Backup file\n''{0}''\t(modified {2}, size {4})\nis to be deleted but is newer than the oldest remaining backup file\n''{1}''\t(modified {3}, size {5}).
+label.confirm_deletion = Confirm deletion of ''{0}''?
+label.delete = Delete
+label.rename = Rename
+label.keep = Keep
+label.file_info = (modified {0}, size {1})
+label.annotation_name = Annotation Name
+label.annotation_description = Annotation Description
+label.edit_annotation_name_description = Edit Annotation Name/Description
+label.alignment = alignment
+label.pca = PCA
+label.create_image_of = Create {0} image of {1}
+label.click_to_edit = Click to edit, right-click for menu
+label.by_annotation_tooltip = Annotation Colour is configured from the main Colour menu
+label.show_linked_features = Show {0} features
+label.on_top = on top
+label.include_linked_features = Include {0} features
+label.include_linked_tooltip = Include visible {0} features<br>converted to local sequence coordinates
+label.features_not_shown = {0} feature(s) not shown
+label.no_features_to_sort_by = No features to sort by
+label.ignore_hidden = Ignore hidden columns
+label.ignore_hidden_tooltip = Ignore any characters in hidden columns when matching
+label.log_level = Log level
+label.log_level_tooltip = Temporarily set the log level for this console. The log level will revert to {0} when this Java console is closed.
+label.copy_to_clipboard = Copy to clipboard
+label.copy_to_clipboard_tooltip = Copy all of the log text in this console to the system clipboard
+ label.bam_file_options = BAM File Options
+ label.bam_chromosome = Chromosome to load:
+ label.bam_range = Region to load:
+ warn.bam_params_not_set = .bam file region parameters have not been set
public AlignmentI readFile(String file, DataSourceType sourceType,
FileFormatI fileFormat) throws IOException
{
- if (alignFile == null)
- {
- prepareFileReader(file, sourceType, fileFormat);
- }
- else
- {
- alignFile.parse();
- }
- return buildAlignmentFromFile();
+ return readFile(null, file, sourceType, fileFormat);
}
- public void prepareFileReader(String file, DataSourceType sourceType,
+ public AlignmentI readFile(File selectedFile, String file, DataSourceType sourceType,
FileFormatI fileFormat) throws IOException
{
+
++ if (alignFile == null)
++ {
++ prepareFileReader(selectedFile, file, sourceType, fileFormat);
++ }
++ else
++ {
++ alignFile.parse();
++ }
++ return buildAlignmentFromFile();
++ }
++ public void prepareFileReader(File selectedFile, String file, DataSourceType sourceType,
++ FileFormatI fileFormat) throws IOException
++ {
+ this.selectedFile = selectedFile;
+ if (selectedFile != null)
+ {
+ this.inFile = selectedFile.getPath();
+ }
this.inFile = file;
try
{
((StructureFile) alignFile).setDbRefType(
FileFormat.PDB.equals(fileFormat) ? Type.PDB : Type.MMCIF);
}
- else
+ else if (selectedFile != null) {
+ alignFile = fileFormat.getReader(new FileParse(selectedFile, sourceType));
+ } else
{
- // alignFile = fileFormat.getAlignmentFile(inFile, sourceType);
alignFile = fileFormat.getReader(new FileParse(inFile, sourceType));
}
- return buildAlignmentFromFile();
+ return;
} catch (Exception e)
{
e.printStackTrace();
return true;
}
},
+ Bam("bam", "bam", true, true)
+ {
+ @Override
+ public AlignmentFileReaderI getReader(FileParse source)
+ throws IOException
+ {
+ return new BamFile(source);
+ }
+
+ @Override
+ public AlignmentFileWriterI getWriter(AlignmentI al)
+ {
+ return new BamFile();
+ }
+
+ @Override
+ public boolean isStructureFile()
+ {
+ return false;
+ }
+ },
- Jalview("Jalview", "jar,jvp", true, true)
+ Jalview("Jalview", "jvp, jar", true, true)
{
@Override
public AlignmentFileReaderI getReader(FileParse source)
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
import jalview.gui.AlignViewport;
+ import jalview.gui.BamFileOptionsChooser;
import jalview.gui.Desktop;
-import jalview.gui.Jalview2XML;
import jalview.gui.JvOptionPane;
import jalview.json.binding.biojson.v1.ColourSchemeMapper;
+import jalview.project.Jalview2XML;
import jalview.schemes.ColourSchemeI;
import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
loadtime = -System.currentTimeMillis();
AlignmentI al = null;
+ if (FileFormat.Bam.equals(format))
+ {
+ FormatAdapter fa = new FormatAdapter();
+ if (source == null)
+ {
- fa.prepareFileReader(file, protocol, format);
++ fa.prepareFileReader(null, file, protocol, format);
+ source = fa.getAlignFile();
+ }
+ if (!((BamFile) source).parseSuffix())
+ {
+ // configure a window
+ BamFileOptionsChooser bamoptions = new BamFileOptionsChooser(
+ source);
+ // ask the user which bit of the bam they want to load
+ int confirm = JvOptionPane.showConfirmDialog(null, bamoptions,
+ MessageManager.getString("label.bam_file_options"),
+ JvOptionPane.OK_CANCEL_OPTION,
+ JvOptionPane.PLAIN_MESSAGE);
+
+ if (confirm == JvOptionPane.CANCEL_OPTION
+ || confirm == JvOptionPane.CLOSED_OPTION)
+ {
+ Desktop.instance.stopLoading();
+ return;
+ }
+ else
+ {
+ bamoptions.update(source);
+ if (file.indexOf("#") == -1)
+ {
+ file = file + "#" + ((BamFile) source).suffix;
+ }
+ }
+ }
+ al = fa.readFile(file, protocol, format);
+ }
+
if (FileFormat.Jalview.equals(format))
{
if (source != null)
}
else
{
-
- // open a new source and read from it
- FormatAdapter fa = new FormatAdapter();
- boolean downloadStructureFile = format.isStructureFile()
- && protocol.equals(DataSourceType.URL);
- if (downloadStructureFile)
- {
- String structExt = format.getExtensions().split(",")[0];
- String urlLeafName = file.substring(
- file.lastIndexOf(
- System.getProperty("file.separator")),
- file.lastIndexOf("."));
- String tempStructureFileStr = createNamedJvTempFile(
- urlLeafName, structExt);
- UrlDownloadClient.download(file, tempStructureFileStr);
- al = fa.readFile(tempStructureFileStr, DataSourceType.FILE,
- format);
- source = fa.getAlignFile();
- }
- else
- {
+ if (selectedFile == null) {
al = fa.readFile(file, protocol, format);
- source = fa.getAlignFile(); // keep reference for later if
- // necessary.
- }
+
+ } else {
+ al = fa.readFile(selectedFile, protocol, format);
+ }
- source = fa.getAlignFile(); // keep reference for later if
-
++ source = fa.getAlignFile(); // keep reference for later if
+ // necessary.
}
}
} catch (java.io.IOException ex)
{
// jar files are special - since they contain all sorts of random
// characters.
- if (source.inFile != null)
+ if (source.inFile != null || source.getDataName() != null)
{
- String fileStr = source.inFile.getName();
+ String fileStr = source.inFile == null ? source.getDataName()
+ : source.inFile.getName();
- // possibly a Jalview archive.
- if (fileStr.lastIndexOf(".jar") > -1
- || fileStr.lastIndexOf(".zip") > -1)
+ if (fileStr.contains(".jar")
+ || fileStr.contains(".zip") || fileStr.contains(".jvp"))
{
+ // possibly a Jalview archive (but check further)
reply = FileFormat.Jalview;
+ // TODO shouldn't there be a break here?
+ }
+ else if (fileStr.lastIndexOf(".bam") > -1)
+ {
+ reply = FileFormat.Bam;
+ break;
}
}
if (!lineswereskipped && data.startsWith("PK"))
<allow pkg="uk.ac.vamsas"/>
<allow pkg="fr.orsay.lri.varna"/>
<allow pkg="MCview"/>
++<<<<<<< HEAD
+ <subpackage name="vcf">
+ <allow pkg="htsjdk\.*" regex="true"/>
+ </subpackage>
++=======
+ <allow pkg="htsjdk.samtools"/>
++>>>>>>> origin/features/JAL-2909_bamImport2_11
</subpackage>
<subpackage name="javascript">