Skip to content

Commit 6fa0df9

Browse files
committed
Added List<String> of comments with getter and setter into AbstractSequence.java;
Added setComments into parseHeader() method in GenericGenbankHeaderParser.java; Add new assert statement in GenbankReaderTest to check the comments
1 parent 8fd2685 commit 6fa0df9

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderParser.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public void parseHeader(String header, S sequence) {
5252
sequence.setOriginalHeader(header);
5353
sequence.setAccession(new AccessionID(accession, DataSource.GENBANK, version, identifier));
5454
sequence.setDescription(description);
55+
sequence.setComments(comments);
5556
}
5657

5758
/**

biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractSequence.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public abstract class AbstractSequence<C extends Compound> implements Sequence<C
7373
new ArrayList<FeatureInterface<AbstractSequence<C>, C>>();
7474
private LinkedHashMap<String, ArrayList<FeatureInterface<AbstractSequence<C>, C>>> groupedFeatures =
7575
new LinkedHashMap<String, ArrayList<FeatureInterface<AbstractSequence<C>, C>>>();
76+
private List<String> comments = new ArrayList<>();
7677

7778
public AbstractSequence() {
7879
}
@@ -427,6 +428,22 @@ public List<FeatureInterface<AbstractSequence<C>, C>> getFeaturesByType(String t
427428
return features;
428429
}
429430

431+
/**
432+
*
433+
* @return comments
434+
*/
435+
public List<String> getComments() {
436+
return comments;
437+
}
438+
439+
/**
440+
* Set comments.
441+
* @param comments
442+
*/
443+
public void setComments(List<String> comments) {
444+
this.comments = comments;
445+
}
446+
430447
/**
431448
* @return the featuresKeyWord
432449
*/

biojava-core/src/test/java/org/biojava/nbio/core/sequence/io/GenbankReaderTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import org.slf4j.Logger;
4747
import org.slf4j.LoggerFactory;
4848

49+
import static org.hamcrest.CoreMatchers.is;
4950
import static org.junit.Assert.*;
5051

5152
/**
@@ -96,6 +97,19 @@ public void testProcess() throws Exception {
9697

9798
LinkedHashMap<String, ProteinSequence> proteinSequences = genbankProtein.process();
9899

100+
assertThat(proteinSequences.get("NP_000257").getComments().get(0),is(
101+
"VALIDATED REFSEQ: This record has undergone validation or\n" +
102+
"preliminary review. The reference sequence was derived from\n" +
103+
"AL034370.1, X65882.1 and BE139596.1.\n" +
104+
"Summary: NDP is the genetic locus identified as harboring mutations\n" +
105+
"that result in Norrie disease. Norrie disease is a rare genetic\n" +
106+
"disorder characterized by bilateral congenital blindness that is\n" +
107+
"caused by a vascularized mass behind each lens due to a\n" +
108+
"maldeveloped retina (pseudoglioma).\n" +
109+
"Publication Note: This RefSeq record includes a subset of the\n" +
110+
"publications that are available for this gene. Please see the\n" +
111+
"Entrez Gene record to access additional publications."));
112+
99113
assertNotNull(proteinSequences);
100114
assertEquals(1, proteinSequences.size());
101115

0 commit comments

Comments
 (0)