From: Ben Soares Date: Fri, 6 Mar 2020 10:33:42 +0000 (+0000) Subject: JAL-3529 improved regex in Stockholm UNIPROT accession id test X-Git-Tag: Develop-2_11_2_0-d20201215~35^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6a33e605b75ae727af5420d9b90d86768ca3dc63;p=jalview.git JAL-3529 improved regex in Stockholm UNIPROT accession id test --- diff --git a/test/jalview/io/StockholmFileTest.java b/test/jalview/io/StockholmFileTest.java index 85ccdcb..74825cf 100644 --- a/test/jalview/io/StockholmFileTest.java +++ b/test/jalview/io/StockholmFileTest.java @@ -107,9 +107,9 @@ public class StockholmFileTest // sequences retrieved in a Pfam domain alignment also have a PFAM database // reference SequenceI sq = new Sequence("FER2_SPIOL", "AASSDDDFFF"); + sq.addDBRef(new DBRefEntry("PFAM", "1", "PF00111")); sq.addDBRef(new DBRefEntry("UNIPROT", "1", "P00224")); sq.addDBRef(new DBRefEntry("PFAM", "1", "P00224.1")); - sq.addDBRef(new DBRefEntry("PFAM", "1", "PF00111")); AppletFormatAdapter af = new AppletFormatAdapter(); String toStockholm = af.formatSequences(FileFormat.Stockholm, new Alignment(new SequenceI[] @@ -117,9 +117,10 @@ public class StockholmFileTest System.out.println(toStockholm); // bleh - java.util.Regex sucks assertTrue( - Pattern.compile(".*\\s+AC\\s+P00224.*", - java.util.regex.Pattern.DOTALL).matcher(toStockholm) - .matches(), + 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);