Thanks - I knew it would be quite simple, as always with BioJava (once I've figuered out how to, that is)!
Martina

Simon Foote wrote:

Hi Martina,

To add a feature to a sequence stored in a BioSQL database, all you have to do is retrieve the sequence and then add a feature to it. The following simplified code shows you the steps:

// Retrieve the sequence from BioSQLSequenceDB
Sequence seq = bsd.getSequence(id);
// Create new stranded feature
StrandedFeature.Template templ = new StrandedFeature.Template();
templ.location = ...
templ.strand = ...
templ.type = ...
templ.source = ...
templ.annotation = [A created SimpleAnnotation object]
// Add feature to sequence
seq.createFeature(templ);
// Note: adding the feature like this will automatically persist the feature, so you don't have to worry about doing that.

Cheers,
Simon Foote

_______________________________________________
Biojava-l mailing list  -  Biojava-l@biojava.org
http://biojava.org/mailman/listinfo/biojava-l

Reply via email to