Skip to content

Commit d582fa0

Browse files
foisysandreasprlic
authored andcommitted
/* Adding features to a RichSequence. */
1 parent ec7c60c commit d582fa0

File tree

2 files changed

+33
-23
lines changed

2 files changed

+33
-23
lines changed

_wikis/BioJava:BioJavaXDocs.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1709,24 +1709,24 @@ Features
17091709

17101710
The best way to create a new feature is like this:
17111711

1712-
<java> Feature.Template templ = new RichFeature.Template(); // create a
1713-
feature template templ.location = ...; // assign the feature template a
1714-
location, type, and source templ.typeTerm = ...; templ.sourceTerm = ...;
1715-
templ.annotation = new SimpleRichAnnotation(); // assign the rest of the
1716-
necessary stuff templ.featureRelationshipSet = new TreeSet();
1717-
templ.rankedCrossRefs = new TreeSet(); RichSequence rs = ...; // get a
1718-
sequence from somewhere RichFeature feat =
1719-
rs.createFeature(RichFeature.Template()); // make a new feature on that
1720-
sequence </java>
1712+
<java> // create a feature template Feature.Template templ = new
1713+
RichFeature.Template(); // assign the feature template a location, type,
1714+
and source templ.location = ...; templ.typeTerm = ...; templ.sourceTerm
1715+
= ...; // assign the rest of the necessary stuff templ.annotation = new
1716+
SimpleRichAnnotation(); templ.featureRelationshipSet = new TreeSet();
1717+
templ.rankedCrossRefs = new TreeSet(); // get a sequence from somewhere
1718+
RichSequence rs = ...; // make a new feature on that sequence
1719+
RichFeature feat = rs.createFeature(RichFeature.Template()); </java>
17211720

17221721
Alternatively, you can start with a completely empty dummy feature and
17231722
just customise the bits you need:
17241723

1725-
<java> RichSequence rs = ...; // get a sequence RichFeature feat =
1726-
RichFeature.Tools.makeEmptyFeature(); // make an empty feature
1727-
feat.setParent(rs): // associate sequence with feature
1728-
rs.getFeatureSet().add(feat); // associate feature with sequence //
1729-
customise the feature here, eg. location, type, source etc. </java>
1724+
<java> // get a sequence RichSequence rs = ...; // make an empty feature
1725+
RichFeature feat = RichFeature.Tools.makeEmptyFeature(); // associate
1726+
sequence with feature feat.setParent(rs): // associate feature with
1727+
sequence rs.getFeatureSet().add(feat);
1728+
1729+
// customise the feature here, eg. location, type, source etc. </java>
17301730

17311731
### Qualifiers as annotations.
17321732

_wikis/BioJava:BioJavaXDocs.mediawiki

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,24 +1669,34 @@ The sequences of locations on the negative strand will be reverse complemented b
16691669
The best way to create a new feature is like this:
16701670

16711671
<java>
1672-
Feature.Template templ = new RichFeature.Template(); // create a feature template
1673-
templ.location = ...; // assign the feature template a location, type, and source
1672+
// create a feature template
1673+
Feature.Template templ = new RichFeature.Template();
1674+
// assign the feature template a location, type, and source
1675+
templ.location = ...;
16741676
templ.typeTerm = ...;
16751677
templ.sourceTerm = ...;
1676-
templ.annotation = new SimpleRichAnnotation(); // assign the rest of the necessary stuff
1678+
// assign the rest of the necessary stuff
1679+
templ.annotation = new SimpleRichAnnotation();
16771680
templ.featureRelationshipSet = new TreeSet();
16781681
templ.rankedCrossRefs = new TreeSet();
1679-
RichSequence rs = ...; // get a sequence from somewhere
1680-
RichFeature feat = rs.createFeature(RichFeature.Template()); // make a new feature on that sequence
1682+
// get a sequence from somewhere
1683+
RichSequence rs = ...;
1684+
// make a new feature on that sequence
1685+
RichFeature feat = rs.createFeature(RichFeature.Template());
16811686
</java>
16821687

16831688
Alternatively, you can start with a completely empty dummy feature and just customise the bits you need:
16841689

16851690
<java>
1686-
RichSequence rs = ...; // get a sequence
1687-
RichFeature feat = RichFeature.Tools.makeEmptyFeature(); // make an empty feature
1688-
feat.setParent(rs): // associate sequence with feature
1689-
rs.getFeatureSet().add(feat); // associate feature with sequence
1691+
// get a sequence
1692+
RichSequence rs = ...;
1693+
// make an empty feature
1694+
RichFeature feat = RichFeature.Tools.makeEmptyFeature();
1695+
// associate sequence with feature
1696+
feat.setParent(rs):
1697+
// associate feature with sequence
1698+
rs.getFeatureSet().add(feat);
1699+
16901700
// customise the feature here, eg. location, type, source etc.
16911701
</java>
16921702

0 commit comments

Comments
 (0)