import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import com.stevesoft.pat.Regex;
}
// BH TODO (what?)
- HashSet<String> srcs = new HashSet<String>();
+ HashSet<String> srcs = new HashSet<>();
for (String src : sources)
{
srcs.add(src.toUpperCase());
}
int nrefs = dbrefs.size();
- List<DBRefEntry> res = new ArrayList<DBRefEntry>();
+ List<DBRefEntry> res = new ArrayList<>();
for (int ib = 0; ib < nrefs; ib++)
{
DBRefEntry dbr = dbrefs.get(ib);
* @return
*/
public static List<DBRefEntry> searchRefs(List<DBRefEntry> refs, String accId) {
- List<DBRefEntry> rfs = new ArrayList<DBRefEntry>();
+ List<DBRefEntry> rfs = new ArrayList<>();
if (refs == null || accId == null) {
return rfs;
}
* @return
*/
static List<DBRefEntry> searchRefs(List<DBRefEntry> refs, DBRefEntry entry, DbRefComp comparator, int mode) {
- List<DBRefEntry> rfs = new ArrayList<DBRefEntry>();
+ List<DBRefEntry> rfs = new ArrayList<>();
if (refs == null || entry == null) {
return rfs;
}
return matches;
}
+ private static Regex PARSE_REGEX;
+
+ private static Regex getParseRegex()
+ {
+ return (PARSE_REGEX == null ? PARSE_REGEX = Platform.newRegex(
+ "([0-9][0-9A-Za-z]{3})\\s*(.?)\\s*;\\s*([0-9]+)-([0-9]+)", null)
+ : PARSE_REGEX);
+ }
/**
* Parses a DBRefEntry and adds it to the sequence, also a PDBEntry if the
* database is PDB.
/*
* Check for PFAM style stockhom PDB accession id citation e.g. "1WRI A; 7-80;"
*/
- Regex r = new com.stevesoft.pat.Regex("([0-9][0-9A-Za-z]{3})\\s*(.?)\\s*;\\s*([0-9]+)-([0-9]+)");
+ Regex r = getParseRegex();
if (r.search(acn.trim())) {
String pdbid = r.stringMatched(1);
String chaincode = r.stringMatched(2);
* @return
*/
public static List<DBRefEntry> searchRefsForSource(List<DBRefEntry> dbRefs, String source) {
- List<DBRefEntry> matches = new ArrayList<DBRefEntry>();
+ List<DBRefEntry> matches = new ArrayList<>();
if (dbRefs != null && source != null) {
for (DBRefEntry dbref : dbRefs) {
if (source.equalsIgnoreCase(dbref.getSource())) {
bsSelect.set(0, dbrefs.size());
if (!selectRefsBS(dbrefs, isProtein ? DBRefSource.PROTEIN_MASK : DBRefSource.DNA_CODING_MASK, bsSelect))
- return;
+ {
+ return;
+ }
// selfs.addAll(selfArray);
// }
DBRefEntry p = pr.get(ip);
for (int i = bsSelect.nextSetBit(0); i >= 0; i = bsSelect.nextSetBit(i + 1)) {
if (dbrefs.get(i) == p)
- bsSelect.clear(i);
+ {
+ bsSelect.clear(i);
+ }
}
// while (selfs.contains(p))
// {
// TODO: promote transcript refs ??
}
if (keys == 0 || !selectRefsBS(dbrefs, keys, bsSelect))
- return;
+ {
+ return;
+ }
// if (candidates != null)
{
for (int ic = bsSelect.nextSetBit(0); ic >= 0; ic = bsSelect.nextSetBit(ic + 1))