String toStockholm = af.formatSequences(FileFormat.Stockholm,
new Alignment(new SequenceI[]
{ sq }), false);
- assertTrue(toStockholm.indexOf("P00224") > -1,
+ System.out.println(toStockholm);
+ // bleh - java.util.Regex sucks
+ assertTrue(
+ Pattern.compile(
+ "^#=GS\\s+FER2_SPIOL(/\\d+-\\d+)?\\s+AC\\s+P00224$",
+ Pattern.MULTILINE).matcher(toStockholm)
+ .find(),
"Couldn't locate UNIPROT Accession in generated Stockholm file.");
AlignmentI fromStockholm = af.readFile(toStockholm,
DataSourceType.PASTE, FileFormat.Stockholm);
SequenceI importedSeq = fromStockholm.getSequenceAt(0);
+ assertTrue(importedSeq.getDBRefs().length == 1,
+ "Expected just one database reference to be added to sequence.");
+ assertTrue(
+ importedSeq.getDBRefs()[0].getAccessionId().indexOf(" ") == -1,
+ "Spaces were found in accession ID.");
List<DBRefEntry> dbrefs = DBRefUtils.searchRefs(importedSeq.getDBRefs(),
"P00224");
assertTrue(dbrefs.size() == 1,