[Biojava-l] Re: update seqfeature

Simon Foote simon.foote at nrc-cnrc.gc.ca
Wed Jun 22 08:51:11 EDT 2005


Hi Martina,

Biojava should handle that correctly.  I haven't done it by changing a 
feature source, but I have with changing a feature's location and 
strand.  For changing a location:

// Get the Feature you wish to edit
StrandedFeature sf = ex. use a feature filter to grab the feature by it's ID
Location loc = new Location(100, 1100);
sf.setLocation(loc);

Since you have already retrieved the feature to edit, biojava will 
automatically do this as an update and not an insert.  Or it should in 
all cases where you are modifying a pre-existing feature.

Simon

Martina wrote:

> Hi Simon,
>
> I'm changing the FeatureSource and in setFeatureSource an update on 
> the source_term_id happens. In the case the combination is already 
> there, I get an Exception. The proper way to deal with that would be 
> to get the seqfeature_id of the entry already there and use that, or 
> try to update the rank unless its a unique combination? Or should I 
> rather not mess with the BioJava and delete that entry and insert it 
> as new to let BioJava handle the rank increase?
>
> Thanks for any advise
>
> Martina
>
> Simon Foote wrote:
>
>> Hi Martina,
>>
>> In fact you can, as rank is the field that allows this to happen.  In 
>> Biojava, currently it's just a linearily incremented number such that 
>> you can have the same type and source IDs for a given bioentry.
>>
>> For example, adding a Genbank entry with 10 CDS features for 1 
>> bioentry will give you identical keys for bioentry_id, type_term_id 
>> and source_term_id, but will have a rank of 1 - 10 for each.
>>
>> Simon
>>

-- 
Bioinformatics Programmer
Pathogen Genomics
Institute for Biological Sciences
National Research Council of Canada
[T] 613-990-0561  [F] 613-952-9092
simon.foote at nrc-cnrc.gc.ca



More information about the Biojava-l mailing list