X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FDBRefUtils.java;h=50a34fc9b5017cc4000f6d28c018b8d8a93f9a43;hb=6c118f968f6e8f726fdbb6ce6c24d870b22419bb;hp=757fc4d73fa1d27d727059d7120bc3f61b18fe66;hpb=08f51db72b37addca7babd1582bfe5c6eaab2f2c;p=jalview.git diff --git a/src/jalview/util/DBRefUtils.java b/src/jalview/util/DBRefUtils.java index 757fc4d..50a34fc 100755 --- a/src/jalview/util/DBRefUtils.java +++ b/src/jalview/util/DBRefUtils.java @@ -29,7 +29,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; -import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.Set; @@ -101,14 +100,14 @@ public class DBRefUtils HashSet srcs = new HashSet(); for (String src : sources) { - srcs.add(src); + srcs.add(src.toUpperCase()); } List res = new ArrayList(); for (DBRefEntry dbr : dbrefs) { String source = getCanonicalName(dbr.getSource()); - if (srcs.contains(source)) + if (srcs.contains(source.toUpperCase())) { res.add(dbr); } @@ -141,8 +140,8 @@ public class DBRefUtils return false; } String coordsys = dasCoordinateSystemsLookup.get(string.toLowerCase()); - return coordsys == null ? false : coordsys.equals(dBRefEntry - .getSource()); + return coordsys == null ? false + : coordsys.equals(dBRefEntry.getSource()); } /** @@ -258,9 +257,8 @@ public class DBRefUtils if (refa.getAccessionId() == null || refb.getAccessionId().equals(refa.getAccessionId())) { - if (refa.getMap() == null - || (refb.getMap() != null && refb.getMap().equals( - refa.getMap()))) + if (refa.getMap() == null || (refb.getMap() != null + && refb.getMap().equals(refa.getMap()))) { return true; } @@ -302,19 +300,18 @@ public class DBRefUtils @Override public boolean matches(DBRefEntry refa, DBRefEntry refb) { - if (refa.getSource() != null - && refb.getSource() != null + if (refa.getSource() != null && refb.getSource() != null && DBRefUtils.getCanonicalName(refb.getSource()).equals( DBRefUtils.getCanonicalName(refa.getSource()))) { // We dont care about version if (refa.getAccessionId() != null && refb.getAccessionId() != null - // FIXME should be && not || here? + // FIXME should be && not || here? || refb.getAccessionId().equals(refa.getAccessionId())) { if ((refa.getMap() == null || refb.getMap() == null) - || (refa.getMap() != null && refb.getMap() != null && refb - .getMap().equals(refa.getMap()))) + || (refa.getMap() != null && refb.getMap() != null + && refb.getMap().equals(refa.getMap()))) { return true; } @@ -335,8 +332,7 @@ public class DBRefUtils @Override public boolean matches(DBRefEntry refa, DBRefEntry refb) { - if (refa.getSource() != null - && refb.getSource() != null + if (refa.getSource() != null && refb.getSource() != null && DBRefUtils.getCanonicalName(refb.getSource()).equals( DBRefUtils.getCanonicalName(refa.getSource()))) { @@ -347,11 +343,12 @@ public class DBRefUtils if ((refa.getMap() == null && refb.getMap() == null) || (refa.getMap() != null && refb.getMap() != null)) { - if ((refb.getMap().getMap() == null && refa.getMap().getMap() == null) + if ((refb.getMap().getMap() == null + && refa.getMap().getMap() == null) || (refb.getMap().getMap() != null - && refa.getMap().getMap() != null && refb - .getMap().getMap().getInverse() - .equals(refa.getMap().getMap()))) + && refa.getMap().getMap() != null + && refb.getMap().getMap().getInverse() + .equals(refa.getMap().getMap()))) { return true; } @@ -373,8 +370,7 @@ public class DBRefUtils @Override public boolean matches(DBRefEntry refa, DBRefEntry refb) { - if (refa.getSource() != null - && refb.getSource() != null + if (refa.getSource() != null && refb.getSource() != null && DBRefUtils.getCanonicalName(refb.getSource()).equals( DBRefUtils.getCanonicalName(refa.getSource()))) { @@ -389,12 +385,13 @@ public class DBRefUtils { return true; } - if (refa.getMap() != null - && refb.getMap() != null - && ((refb.getMap().getMap() == null && refa.getMap() - .getMap() == null) || (refb.getMap().getMap() != null - && refa.getMap().getMap() != null && refb - .getMap().getMap().equals(refa.getMap().getMap())))) + if (refa.getMap() != null && refb.getMap() != null + && ((refb.getMap().getMap() == null + && refa.getMap().getMap() == null) + || (refb.getMap().getMap() != null + && refa.getMap().getMap() != null + && refb.getMap().getMap() + .equals(refa.getMap().getMap())))) { return true; } @@ -414,8 +411,7 @@ public class DBRefUtils @Override public boolean matches(DBRefEntry refa, DBRefEntry refb) { - if (refa.getSource() != null - && refb.getSource() != null + if (refa.getSource() != null && refb.getSource() != null && DBRefUtils.getCanonicalName(refb.getSource()).equals( DBRefUtils.getCanonicalName(refa.getSource()))) { @@ -429,11 +425,12 @@ public class DBRefUtils return true; } if ((refa.getMap() != null && refb.getMap() != null) - && (refb.getMap().getMap() == null && refa.getMap() - .getMap() == null) + && (refb.getMap().getMap() == null + && refa.getMap().getMap() == null) || (refb.getMap().getMap() != null - && refa.getMap().getMap() != null && (refb - .getMap().getMap().equals(refa.getMap().getMap())))) + && refa.getMap().getMap() != null + && (refb.getMap().getMap() + .equals(refa.getMap().getMap())))) { return true; } @@ -508,9 +505,7 @@ public class DBRefUtils PDBEntry pdbr = new PDBEntry(); pdbr.setId(pdbid); pdbr.setType(PDBEntry.Type.PDB); - pdbr.setProperty(new Hashtable()); pdbr.setChainCode(chaincode); - // pdbr.getProperty().put("CHAIN", chaincode); seq.addPDBId(pdbr); } else @@ -564,8 +559,8 @@ public class DBRefUtils { return true; } - return DBRefUtils.getCanonicalName(o1).equals( - DBRefUtils.getCanonicalName(o2)); + return DBRefUtils.getCanonicalName(o1) + .equals(DBRefUtils.getCanonicalName(o2)); } /** @@ -581,8 +576,8 @@ public class DBRefUtils public static DBRefEntry[] selectDbRefs(boolean selectDna, DBRefEntry[] refs) { - return selectRefs(refs, selectDna ? DBRefSource.DNACODINGDBS - : DBRefSource.PROTEINDBS); + return selectRefs(refs, + selectDna ? DBRefSource.DNACODINGDBS : DBRefSource.PROTEINDBS); // could attempt to find other cross // refs here - ie PDB xrefs // (not dna, not protein seq) @@ -618,21 +613,21 @@ public class DBRefUtils * sequences if they have an appropriate primary ref * * - * - * - * + * + * + * * - * + * * * * * - * + * * * * * - * + * * * * @@ -696,8 +691,7 @@ public class DBRefUtils } // collate candidates and promote them - DBRefEntry[] candidates = selectRefs( - selfs.toArray(new DBRefEntry[0]), + DBRefEntry[] candidates = selectRefs(selfs.toArray(new DBRefEntry[0]), promType.toArray(new String[0])); if (candidates != null) { @@ -727,9 +721,9 @@ public class DBRefUtils toPromote.add(cand); if (!cand.isPrimaryCandidate()) { - System.out.println("Warning: Couldn't promote dbref " - + cand.toString() + " for sequence " - + sequence.toString()); + System.out.println( + "Warning: Couldn't promote dbref " + cand.toString() + + " for sequence " + sequence.toString()); } } }
Seq TypePrimary DBDirect which will be promotedSeq TypePrimary DBDirect which will be promoted
peptidesEnsemblUniprot
peptidesEnsemblUniprot
dnaEnsemblENA