Skip to content

Commit 4dcfbed

Browse files
jamesmorrisjamesmorris
authored andcommitted
When writing out feature qualifiers if they are db_xref values handle
this differently because they don't have a value. Rather we need to use the database and ID values to create the output
1 parent df591fd commit 4dcfbed

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
package org.biojava.nbio.core.sequence.io;
2525

2626
import org.biojava.nbio.core.sequence.Strand;
27+
import org.biojava.nbio.core.sequence.features.DBReferenceInfo;
2728
import org.biojava.nbio.core.sequence.features.FeatureInterface;
2829
import org.biojava.nbio.core.sequence.features.Qualifier;
2930
import org.biojava.nbio.core.sequence.location.template.AbstractLocation;
@@ -127,7 +128,12 @@ protected String _write_feature(FeatureInterface<AbstractSequence<C>, C> feature
127128
//Now the qualifiers...
128129
for(List<Qualifier> qualifiers : feature.getQualifiers().values()) {
129130
for(Qualifier q : qualifiers){
130-
line += _write_feature_qualifier(q.getName().replaceAll("%","%%"), q.getValue().replaceAll("%","%%"), q.needsQuotes());
131+
if (q instanceof DBReferenceInfo) {
132+
DBReferenceInfo db = (DBReferenceInfo) q;
133+
line += _write_feature_qualifier(q.getName().replaceAll("%","%%"), db.getDatabase().replaceAll("%","%%") + ":" + db.getId().replaceAll("%","%%"), db.needsQuotes());
134+
} else {
135+
line += _write_feature_qualifier(q.getName().replaceAll("%","%%"), q.getValue().replaceAll("%","%%"), q.needsQuotes());
136+
}
131137
}
132138
}
133139
return line;

0 commit comments

Comments
 (0)