package jalview.ws.dbsources;
import java.util.Locale;
-
import jalview.bin.Cache;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
private static final String DEFAULT_UNIPROT_DOMAIN = "https://www.uniprot.org";
private static final String BAR_DELIMITER = "|";
+ private static Regex ACCESSION_REGEX;
/**
* Constructor
@Override
public Regex getAccessionValidator()
{
- return new Regex("([A-Z]+[0-9]+[A-Z0-9]+|[A-Z0-9]+_[A-Z0-9]+)");
+ if (ACCESSION_REGEX == null)
+ {
+ ACCESSION_REGEX = Platform
+ .newRegex("([A-Z]+[0-9]+[A-Z0-9]+|[A-Z0-9]+_[A-Z0-9]+)");
+ }
+ return ACCESSION_REGEX;
}
/*
// use/backoff logic to retry when the server tells us to go away
if (urlconn.getResponseCode() == 200)
{
- InputStream istr = urlconn.getInputStream();
- List<Entry> entries = getUniprotEntries(istr);
- if (entries != null)
+ List<SequenceI> seqs = new ArrayList<>();
+ for (Entry entry : entries)
{
- List<SequenceI> seqs = new ArrayList<>();
- for (Entry entry : entries)
- {
- seqs.add(uniprotEntryToSequence(entry));
- }
- al = new Alignment(seqs.toArray(new SequenceI[seqs.size()]));
+ seqs.add(uniprotEntryToSequence(entry));
}
+ al = new Alignment(seqs.toArray(new SequenceI[seqs.size()]));
}
+
stopQuery();
return al;