Skip to content

Commit

Permalink
addLabels can take a starting number
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Kerpedjiev committed Apr 14, 2015
1 parent 737dbf4 commit 7213f33
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/fornaf.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function FornaContainer(element, passedOptions) {

rnaJson = rnaJson.elementsToJson()
.addPositions("nucleotide", options.positions)
.addLabels(options.labelInterval)
.addLabels(1, options.labelInterval)
.reinforceStems()
.reinforceLoops()
.connectFakeNodes()
Expand Down Expand Up @@ -837,7 +837,7 @@ function FornaContainer(element, passedOptions) {
.addPseudoknots()
.addPositions('nucleotide', nucleotide_positions)
.addUids(uids)
.addLabels(self.options.labelInterval)
.addLabels(1, self.options.labelInterval)
.addPositions('label', label_positions)
.reinforceStems()
.reinforceLoops()
Expand Down
11 changes: 8 additions & 3 deletions src/rnagraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,9 +647,14 @@ function RNAGraph(seq, dotbracket, struct_name) {
return elements.concat(self.pt_to_elements(pt, level, i, j));
};

self.addLabels = function(labelInterval) {
if (arguments.length === 0)
self.addLabels = function(startNumber, labelInterval) {
if (arguments.length === 0) {
startNumber = 1;
labelInterval = 10;
}

if (arguments.length === 1)
startNumber = labelInterval = 10;

if (labelInterval === 0)
return self;
Expand Down Expand Up @@ -710,7 +715,7 @@ function RNAGraph(seq, dotbracket, struct_name) {
newX = self.nodes[i-1].x + offsetVec[0];
newY = self.nodes[i-1].y + offsetVec[1];

new_node = {'name': i,
new_node = {'name': i + startNumber - 1,
'num': -1,
'radius': 6,
'rna': self,
Expand Down

0 comments on commit 7213f33

Please sign in to comment.