/*
* for each distinct value recorded for this feature type,
* add a command to set the attribute on the mapped residues
+ * Put values in single quotes, encoding any embedded single quotes
*/
StringBuilder sb = new StringBuilder(128);
- sb.append("setattr r ").append(attributeName).append(" \"")
- .append(value.toString()).append("\" ");
+ String featureValue = value.toString();
+ featureValue.replaceAll("'", "'");
+ sb.append("setattr r ").append(attributeName).append(" '")
+ .append(featureValue).append("' ");
sb.append(values.get(value).getAtomSpec());
commands.add(sb.toString());
}