[Biojava-l] Re: [BioSQL-l] How to add a feature?

Martina boehme at mpiib-berlin.mpg.de
Mon Jun 6 10:18:54 EDT 2005


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
> 


More information about the Biojava-l mailing list