X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FSequenceFeatureFetcher.java;h=b3de0f3843346cd303d1cb4c7996881ecd021e1c;hb=32ce9ddb7ce1a68add53dd81785ae428ca136a83;hp=108fe08bb700ef980db56006230f09e80dbe5bc1;hpb=bc2ce1cf981d29d65f44cfcfa7bc4c8f00ee2354;p=jalview.git diff --git a/src/jalview/io/SequenceFeatureFetcher.java b/src/jalview/io/SequenceFeatureFetcher.java index 108fe08..b3de0f3 100755 --- a/src/jalview/io/SequenceFeatureFetcher.java +++ b/src/jalview/io/SequenceFeatureFetcher.java @@ -57,7 +57,7 @@ public class SequenceFeatureFetcher implements Runnable { // 1. Load the mapping information from the file Mapping map = new Mapping(uni.getClass().getClassLoader()); - java.net.URL url = uni.getClass().getResource("/uniprot_mapping.xml"); + java.net.URL url = getClass().getResource("/uniprot_mapping.xml"); map.loadMapping(url); // 2. Unmarshal the data @@ -112,7 +112,7 @@ public class SequenceFeatureFetcher implements Runnable if(!ids.contains(sequence.getName())) { ids.add(sequence.getName()); - unknownSequences.add(sequence.getName()); + unknownSequences.add(sequence); } } @@ -156,19 +156,28 @@ public class SequenceFeatureFetcher implements Runnable } - if (unknownSequences.size() > 0) - { - int reply = javax.swing.JOptionPane.showInternalConfirmDialog( - Desktop.desktop, "Couldn't find a match for "+unknownSequences.size()+" sequences." - +"\nPerform blast for unknown sequences?", - "Blast for Unidentified Sequences", - javax.swing.JOptionPane.YES_NO_OPTION, javax.swing.JOptionPane.QUESTION_MESSAGE); - - if(reply == javax.swing.JOptionPane.YES_OPTION) - new WSWUBlastClient(ap, align, unknownSequences); - } - else - ((Alignment)dataset).featuresAdded = true; + promptBeforeBlast(); + + } + + + void promptBeforeBlast() + { + // This must be outside the run() body as java 1.5 + // will not return any value from the OptionPane to the expired thread. + if (unknownSequences.size() > 0) + { + int reply = javax.swing.JOptionPane.showConfirmDialog( + Desktop.desktop, "Couldn't find a match for "+unknownSequences.size()+" sequences." + +"\nPerform blast for unknown sequences?", + "Blast for Unidentified Sequences", + javax.swing.JOptionPane.YES_NO_OPTION, javax.swing.JOptionPane.QUESTION_MESSAGE); + + if(reply == javax.swing.JOptionPane.YES_OPTION) + new WSWUBlastClient(ap, align, unknownSequences); + } + else + ((Alignment)dataset).featuresAdded = true; ap.repaint(); @@ -187,7 +196,6 @@ public class SequenceFeatureFetcher implements Runnable return; SequenceI sequence = null; - // String pdb = null; Vector entries = getUniprotEntries(file); @@ -202,25 +210,24 @@ public class SequenceFeatureFetcher implements Runnable if (sequence == null) { //Sequence maybe Name, not Accession - idmatch = entry.getName().elementAt(0).toString();; + idmatch = entry.getName().elementAt(0).toString(); sequence = dataset.findName(idmatch); } if (sequence == null) { - System.out.println("not found"); + System.out.println(idmatch+" not found"); continue; } ids.remove(sequence.getName()); - unknownSequences.remove(sequence.getName()); + unknownSequences.remove(sequence); String nonGapped = AlignSeq.extractGaps("-. ", sequence.getSequence()); int absStart = entry.getUniprotSequence().getContent().indexOf( nonGapped.toString()); - int residueOffset = 0; if (absStart == -1) { // Is UniprotSequence contained in dataset sequence? @@ -235,9 +242,9 @@ public class SequenceFeatureFetcher implements Runnable } else { - if(entry.getFeatures()!=null) + if(entry.getFeature()!=null) { - Enumeration e = entry.getFeatures().elements(); + Enumeration e = entry.getFeature().elements(); while (e.hasMoreElements()) { SequenceFeature sf = (SequenceFeature) e.nextElement(); @@ -257,7 +264,19 @@ public class SequenceFeatureFetcher implements Runnable int absEnd = absStart + nonGapped.toString().length(); absStart += 1; - sequence.setSequenceFeatures(entry.getFeatures()); + Enumeration e = entry.getDbReference().elements(); + Vector onlyPdbEntries = new Vector(); + while(e.hasMoreElements()) + { + PDBEntry pdb = (PDBEntry)e.nextElement(); + if(!pdb.getType().equals("PDB")) + continue; + + onlyPdbEntries.addElement(pdb); + } + + sequence.setPDBId(onlyPdbEntries); + sequence.setSequenceFeatures(entry.getFeature()); sequence.setStart(absStart); sequence.setEnd(absEnd);