public void testParse_noUniprotXref() throws IOException
{
// MN908947 cut down to 40BP, one CDS, length 5 peptide for test purposes
+ // plus an additional (invented) test case:
+ // - multi-line /product qualifier including escaped quotes
String data = "ID MN908947; SV 3; linear; genomic RNA; STD; VRL; 20 BP.\n"
+ "DE Severe acute respiratory syndrome coronavirus 2 isolate Wuhan-Hu-1,\n"
+ "FT CDS 3..17\n"
+ "FT /protein_id=\"QHD43415.1\"\n"
- + "FT /product=\"orf1ab polyprotein\"\n"
+ + "FT /product=\"orf1ab polyprotein\n"
+ + "FT \"\"foobar\"\" \"\n"
+ "FT /translation=\"MRKLD\n"
+ "SQ Sequence 7496 BP; 2450 A; 1290 C; 1434 G; 2322 T; 0 other;\n"
+ " ggatGcgtaa gttagacgaa attttgtctt tgcgcacaga 40\n";
mapping = dbref.getMap();
SequenceI mapTo = mapping.getTo();
assertEquals(mapTo.getName(), "QHD43415.1");
- assertEquals(mapTo.getDescription(), "orf1ab polyprotein");
+ // the /product qualifier transfers to protein product description
+ assertEquals(mapTo.getDescription(), "orf1ab polyprotein \"foobar\"");
assertEquals(mapTo.getSequenceAsString(), "MRKLD");
map = mapping.getMap();
assertEquals(map.getFromLowest(), 3);
truncated = EmblFlatFile.adjustForProteinLength(7, exons);
assertSame(exons, truncated);
}
+
+ @Test(groups = "Functional")
+ public void testRemoveQuotes()
+ {
+ assertNull(EmblFlatFile.removeQuotes(null));
+ assertEquals(EmblFlatFile.removeQuotes("No quotes here"), "No quotes here");
+ assertEquals(EmblFlatFile.removeQuotes("\"Enclosing quotes\""), "Enclosing quotes");
+ assertEquals(EmblFlatFile.removeQuotes("\"Escaped \"\"quotes\"\" example\""), "Escaped \"quotes\" example");
+ }
}