throw new IllegalArgumentException(spec);
}
- String chainId = dotPos == -1 ? "" : residueChain.substring(dotPos + 1);
-
+ String chainId = dotPos == -1 ? " " : residueChain
+ .substring(dotPos + 1);
+ if (chainId.length() == 0)
+ {
+ chainId = " ";
+ }
return new AtomSpec(modelId, chainId, resNum, 0);
}
public class StructureMapping
{
+ /**
+ * Space character constant, recommended for consistent representation when no
+ * chain specified
+ */
+ public static String NO_CHAIN = " ";
+
String mappingDetails;
SequenceI sequence;
return mappingDetails;
}
- public HashMap<Integer, int[]> getMapping()
- {
- return mapping;
- }
}
{
if (targetChainId.trim().length() == 0)
{
- targetChainId = " ";
+ targetChainId = StructureMapping.NO_CHAIN;
}
else
{
*/
int max = -10;
AlignSeq maxAlignseq = null;
- String maxChainId = " ";
+ String maxChainId = StructureMapping.NO_CHAIN; // space
PDBChain maxChain = null;
boolean first = true;
for (PDBChain chain : pdb.getChains())
.getString("status.obtaining_mapping_with_phyre2_template_alignment"));
String fastaFile = getPhyre2FastaFileFor(pdbFile);
StructureMapping phyre2ModelMapping = new Phyre2Client(pdb)
- .getStructureMapping(seq, pdbFile, fastaFile, " ");
+ .getStructureMapping(seq, pdbFile, fastaFile,
+ StructureMapping.NO_CHAIN);
seqToStrucMapping.add(phyre2ModelMapping);
maxChain.makeExactMapping(maxAlignseq, seq);
maxChain.transferRESNUMFeatures(seq, null);
as = AtomSpec.fromChimeraAtomspec("#3.2:15");
assertEquals(as.getModelNumber(), 3);
assertEquals(as.getPdbResNum(), 15);
- assertEquals(as.getChain(), "");
+ assertEquals(as.getChain(), StructureMapping.NO_CHAIN); // space
assertNull(as.getPdbFile());
String spec = "3:12.B";
import java.util.Iterator;
import java.util.Map;
+import junit.extensions.PA;
+
import org.testng.Assert;
import org.testng.FileAssert;
import org.testng.annotations.AfterTest;
// Can't do Assert.assertEquals(strucMapping.getMapping(), expectedMapping);
// because this fails in our version of TestNG
- Assert.assertEquals(strucMapping.getMapping().size(),
+ Map<Integer, int[]> mapping = (Map<Integer, int[]>) PA.getValue(
+ strucMapping, "mapping");
+ Assert.assertEquals(
+ mapping.size(),
expectedMapping.size());
Iterator<Map.Entry<Integer, int[]>> it = expectedMapping.entrySet()
.iterator();
while (it.hasNext())
{
Map.Entry<Integer, int[]> pair = it.next();
- Assert.assertTrue(strucMapping.getMapping()
+ Assert.assertTrue(mapping
.containsKey(pair.getKey()));
- Assert.assertEquals(strucMapping.getMapping().get(pair.getKey()),
+ Assert.assertEquals(mapping.get(pair.getKey()),
pair.getValue());
}
}