- ssm.setProgressBar(MessageManager
- .getString("status.launching_3d_structure_viewer"));
- final StructureViewer sViewer = new StructureViewer(ssm);
-
- if (SiftsSettings.isMapWithSifts())
- {
- ArrayList<SequenceI> seqsWithoutSourceDBRef = new ArrayList<SequenceI>();
- int p = 0;
- // TODO: skip PDBEntry:Sequence pairs where PDBEntry doesn't look like a
- // real PDB ID. For moment, we can also safely do this if there is already
- // a known mapping between the PDBEntry and the sequence.
- for (SequenceI seq : sequences)
- {
- PDBEntry pdbe = pdbEntriesToView[p++];
- if (pdbe != null && pdbe.getFile() != null)
- {
- StructureMapping[] smm = ssm.getMapping(pdbe.getFile());
- if (smm != null && smm.length > 0)
- {
- for (StructureMapping sm : smm)
- {
- if (sm.getSequence() == seq)
- {
- continue;
- }
- }
- }
- }
- if (seq.getPrimaryDBRefs().size() == 0)
- {
- seqsWithoutSourceDBRef.add(seq);
- continue;
- }
- }
- if (!seqsWithoutSourceDBRef.isEmpty())
- {
- int y = seqsWithoutSourceDBRef.size();
- ssm.setProgressBar(null);
- ssm.setProgressBar(MessageManager.formatMessage(
- "status.fetching_dbrefs_for_sequences_without_valid_refs",
- y));
- SequenceI[] seqWithoutSrcDBRef = new SequenceI[y];
- int x = 0;
- for (SequenceI fSeq : seqsWithoutSourceDBRef)
- {
- seqWithoutSrcDBRef[x++] = fSeq;
- }
- new DBRefFetcher(seqWithoutSrcDBRef).fetchDBRefs(true);
- }
- }
- if (pdbEntriesToView.length > 1)
- {
- ArrayList<SequenceI[]> seqsMap = new ArrayList<SequenceI[]>();
- for (SequenceI seq : sequences)
- {
- seqsMap.add(new SequenceI[] { seq });
- }
- SequenceI[][] collatedSeqs = seqsMap.toArray(new SequenceI[0][0]);
- ssm.setProgressBar(null);
- ssm.setProgressBar(MessageManager
- .getString("status.fetching_3d_structures_for_selected_entries"));
- sViewer.viewStructures(pdbEntriesToView, collatedSeqs, alignPanel);
- }
- else
- {
- ssm.setProgressBar(null);
- ssm.setProgressBar(MessageManager.formatMessage(
- "status.fetching_3d_structures_for",
- pdbEntriesToView[0].getId()));
- sViewer.viewStructures(pdbEntriesToView[0], sequences, alignPanel);
- }