import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
+import java.util.Set;
import java.util.Vector;
import javax.swing.JCheckBox;
boolean isPDBRefsFound = false;
boolean isUniProtRefsFound = false;
StringBuilder queryBuilder = new StringBuilder();
- HashSet<String> seqRefs = new LinkedHashSet<String>();
+ Set<String> seqRefs = new LinkedHashSet<String>();
if (seq.getAllPDBEntries() != null)
{
{
if (isValidSeqName(entry.getId()))
{
- queryBuilder.append("pdb_id")
- .append(":")
-.append(entry.getId().toLowerCase())
+ queryBuilder.append("pdb_id:")
+ .append(entry.getId().toLowerCase())
.append(" OR ");
isPDBRefsFound = true;
// seqRefs.add(entry.getId());
{
if (dbRef.getSource().equalsIgnoreCase(DBRefSource.UNIPROT))
{
- queryBuilder
-.append("uniprot_accession").append(":")
+ queryBuilder.append("uniprot_accession:")
.append(getDBRefId(dbRef))
.append(" OR ");
- queryBuilder
-.append("uniprot_id")
- .append(":")
- .append(getDBRefId(dbRef)).append(" OR ");
+ queryBuilder.append("uniprot_id:").append(getDBRefId(dbRef))
+ .append(" OR ");
isUniProtRefsFound = true;
}
else if (dbRef.getSource().equalsIgnoreCase(DBRefSource.PDB))
{
- queryBuilder.append("pdb_id")
- .append(":").append(getDBRefId(dbRef).toLowerCase())
+ queryBuilder.append("pdb_id:")
+ .append(getDBRefId(dbRef).toLowerCase())
.append(" OR ");
isPDBRefsFound = true;
}
import static org.testng.AssertJUnit.assertTrue;
import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.DBRefSource;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceI;
seq.setDBRefs(null);
query = StructureChooser.buildQuery(seq);
assertEquals("text:4kqy", query);
+
+ DBRefEntry uniprotDBRef = new DBRefEntry();
+ uniprotDBRef.setAccessionId("P12345");
+ uniprotDBRef.setSource(DBRefSource.UNIPROT);
+ seq.addDBRef(uniprotDBRef);
+
+ DBRefEntry pdbDBRef = new DBRefEntry();
+ pdbDBRef.setAccessionId("1XYZ");
+ pdbDBRef.setSource(DBRefSource.PDB);
+ seq.addDBRef(pdbDBRef);
+
+ for (int x = 1; x < 5; x++)
+ {
+ DBRefEntry dbRef = new DBRefEntry();
+ dbRef.setAccessionId("XYZ_" + x);
+ seq.addDBRef(dbRef);
+ }
+ query = StructureChooser.buildQuery(seq);
+ assertEquals(
+ "uniprot_accession:P12345 OR uniprot_id:P12345 OR pdb_id:1xyz",
+ query);
}
@Test(groups = { "Functional" })