|
36 | 36 | import org.slf4j.LoggerFactory; |
37 | 37 |
|
38 | 38 | import java.io.*; |
39 | | -import java.util.ArrayList; |
40 | | -import java.util.LinkedHashMap; |
41 | | -import java.util.List; |
42 | | -import java.util.Map; |
| 39 | +import java.util.*; |
43 | 40 |
|
44 | 41 | import static org.hamcrest.CoreMatchers.is; |
45 | 42 | import static org.junit.Assert.*; |
@@ -333,6 +330,35 @@ public void readSequenceWithZeroSpanFeature() throws IOException, CompoundNotFou |
333 | 330 | assertEquals(Strand.NEGATIVE, fLocation.getStrand()); |
334 | 331 | } |
335 | 332 |
|
| 333 | + /** |
| 334 | + * Biojava fails to parse anticodon and transl_except feature qualifiers when they line wrap. |
| 335 | + * https://github.com/biojava/biojava/issues/843 |
| 336 | + */ |
| 337 | + @Test |
| 338 | + public void testGithub843() throws Exception { |
| 339 | + CheckableInputStream inStream = new CheckableInputStream(this.getClass().getResourceAsStream("/NC_018080.gb")); |
| 340 | + assertNotNull(inStream); |
| 341 | + |
| 342 | + GenbankReader<DNASequence, NucleotideCompound> genbankDNA |
| 343 | + = new GenbankReader<>( |
| 344 | + inStream, |
| 345 | + new GenericGenbankHeaderParser<>(), |
| 346 | + new DNASequenceCreator(DNACompoundSet.getDNACompoundSet()) |
| 347 | + ); |
| 348 | + |
| 349 | + LinkedHashMap<String, DNASequence> dnaSequences = genbankDNA.process(); |
| 350 | + assertNotNull(dnaSequences); |
| 351 | + |
| 352 | + DNASequence dna = new ArrayList<>(dnaSequences.values()).get(0); |
| 353 | + assertNotNull(dna); |
| 354 | + |
| 355 | + FeatureInterface<AbstractSequence<NucleotideCompound>, NucleotideCompound> tRNAFeature = dna.getFeaturesByType("tRNA").get(0); |
| 356 | + String anticodon = tRNAFeature.getQualifiers().get("anticodon").get(0).getValue(); |
| 357 | + assertEquals("(pos:complement(1123552..1123554),aa:Leu,seq:caa)", anticodon); |
| 358 | + String transl_except = tRNAFeature.getQualifiers().get("transl_except").get(0).getValue(); |
| 359 | + assertEquals("(pos:complement(1123552..1123554),aa:Leu)",transl_except); |
| 360 | + } |
| 361 | + |
336 | 362 | /** |
337 | 363 | * Helper class to be able to verify the closed state of the input stream. |
338 | 364 | */ |
|
0 commit comments