[Biojava-l] How to extract a Sub-sequence

Thomas Down thomas at derkholm.net
Tue Jul 8 14:13:14 EDT 2003


Once upon a time, Y D Sun wrote:
> Dear all,
> 
> Is there a method in BioJava that returns a sub-sequence using a
> Location parameter (not subStr() or subList() with two integers - start
> and end)? This consideration comes from my requirement to get the
> nucleotide sub-sequence corresponding to a CDS section. In such a case,
> the subStr(start, end) method cannot always return the sub-sequence
> correctly.

      Location cdsLocation = ...
      Sequence seq = ...
      SymbolList cdsSymbols = cdsLocation.symbols(seq);

Alternatively, if you've created a Feature for the CDS you're
interested in, you can just use the getSymbols() method on
that.

    Thomas.


More information about the Biojava-l mailing list