private SequenceI[][] sequence;
/*
- * array of target chains for sequences - tied to pdbentry and sequence[]
+ * array of list of target chains for sequences - tied to pdbentry and sequence[]
*/
- private String[][] chains;
+ private List<String>[][] chains;
/*
* datasource protocol for access to PDBEntrylatest
* final count of chain mappings discovered
*/
int chainmaps = 0;
- String[][] newchains = new String[pdbEntry.length][];
+ // JBPNote: JAL-2693 - this should be a list of chain mappings per
+ // [pdbentry][sequence]
+ List<String>[][] newchains = new List[pdbEntry.length][];
int pe = 0;
for (PDBEntry pdb : pdbEntry)
{
SequenceI[] seqsForPdb = sequence[pe];
if (seqsForPdb != null)
{
- newchains[pe] = new String[seqsForPdb.length];
+ newchains[pe] = new List[seqsForPdb.length];
int se = 0;
for (SequenceI asq : seqsForPdb)
{
- String chain = (chains != null && chains[pe] != null)
+ List<String> chain = (chains != null && chains[pe] != null)
? chains[pe][se]
: null;
- SequenceI sq = asq.getDatasetSequence();
+ if (chain == null)
+ {
+ chain = new ArrayList<>();
+ }
+ newchains[pe][se] = chain;
+
+ SequenceI sq = (asq.getDatasetSequence() == null) ? asq
+ : asq.getDatasetSequence();
if (sq.getAllPDBEntries() != null)
{
for (PDBEntry pdbentry : sq.getAllPDBEntries())
String chaincode = pdbentry.getChainCode();
if (chaincode != null && chaincode.length() > 0)
{
- chain = chaincode;
+ newchains[pe][se].add(chaincode);
chainmaps++;
- break;
}
}
}
}
- newchains[pe][se] = chain;
se++;
}
pe++;
return sequence;
}
- public String[][] getChains()
+ public List<String>[][] getChains()
{
return chains;
}
this.sequence = sequence;
}
- protected void setChains(String[][] chains)
+ protected void setChains(List<String>[][] chains)
{
this.chains = chains;
}
new Object[]
{ Integer.valueOf(pe).toString() }));
}
- final String nullChain = "TheNullChain";
- List<SequenceI> s = new ArrayList<SequenceI>();
- List<String> c = new ArrayList<String>();
+ List<SequenceI> s = new ArrayList<>();
+ List<List<String>> c = new ArrayList<>();
if (getChains() == null)
{
- setChains(new String[getPdbCount()][]);
+ setChains(new List[getPdbCount()][]);
}
if (getSequence()[pe] != null)
{
}
else
{
- c.add(nullChain);
+ c.add(new ArrayList());
}
}
else
{
if (tchain != null && tchain.length > 0)
{
- c.add(nullChain);
+ c.add(new ArrayList());
}
}
}
s.add(seq[i]);
if (tchain != null && i < tchain.length)
{
- c.add(tchain[i] == null ? nullChain : tchain[i]);
+ List<String> clist = new ArrayList();
+ c.add(clist);
+ if (tchain[i] != null)
+ {
+ clist.add(tchain[i]);
+ }
}
}
}
getSequence()[pe] = tmp;
if (c.size() > 0)
{
- String[] tch = c.toArray(new String[c.size()]);
- for (int i = 0; i < tch.length; i++)
- {
- if (tch[i] == nullChain)
- {
- tch[i] = null;
- }
- }
+ List<String>[] tch = c.toArray(new List[c.size()]);
getChains()[pe] = tch;
}
else
public synchronized PDBEntry[] addSequenceAndChain(PDBEntry[] pdbe,
SequenceI[][] seq, String[][] chns)
{
- List<PDBEntry> v = new ArrayList<PDBEntry>();
- List<int[]> rtn = new ArrayList<int[]>();
+ List<PDBEntry> v = new ArrayList<>();
+ List<int[]> rtn = new ArrayList<>();
for (int i = 0; i < getPdbCount(); i++)
{
v.add(getPdbEntry(i));
{
// expand the tied sequence[] and string[] arrays
SequenceI[][] sqs = new SequenceI[getPdbCount()][];
- String[][] sch = new String[getPdbCount()][];
+ List<String>[][] sch = new List[getPdbCount()][];
System.arraycopy(getSequence(), 0, sqs, 0, getSequence().length);
System.arraycopy(getChains(), 0, sch, 0, this.getChains().length);
setSequence(sqs);