== Pervasives ==
=== out(text) ===
display text in result textarea
=== outln(text) ===
display text in result textarea with newline
=== clear() ===
clear result textarea
== Library functions ==
=== Lib.bases ===
"AGCU"
=== Lib.fold(sequence) ===
return folded structure with sequence
ex) Lib.fold("GGGGCCCC") = "((....))";
=== Lib.energyOfStruct(sequence, structure) ===
return energy of structure
=== Lib.EternaScript(script id) ===
return other user's script
ex) var func = Lib.EternaScript(script_id);
ex) func(parameters);
=== Lib.getStructure(puzzle id) ===
return structure of puzzle
ex) Lib.getStructure(1001759)
=== Lib.replace(sequence, index, target) ===
return sequence which character at index in sequence replaced to target
ex) Lib.replace("AGCU", 2, "A") = "AGAU";
=== Lib.nextSequence(sequence) ===
return next sequence of sequence in the order of default bases
ex) Lib.nextSequence("AAAA") = "GAAA";
=== Lib.nextSequenceWithBases(sequence, bases) ===
return next sequence of sequence in the order of bases
ex) Lib.nextSequenceWithBases("UUUU", "UCGA") = "CUUU";
ex) Lib.nextSequenceWithBases("AUAA", "UCGA") = "UCAA";
=== Lib.random(from, to) ===
return random number between from and to
=== Lib.randomSequence(size) ===
return random sequence with length of size
=== Lib.map(function, sequence) ===
applies function to each sequence bases
=== Lib.filter(function, sequence) ===
return sequences only satisfy the function
=== Lib.splitDefault(structure) ===
split structure into a structure array
ex) Lib.splitDefault("((..))") = ["((", "..", "))"];
=== Lib.join(array) ===
join array with each element to sequence
ex) Lib.join(Lib.split("((..))")) = "((..))";
=== Lib.distance(source structure, destination structure) ===
return differences between source structure and destination structure
if same then 0 else +1
if different length then just return -1
ex) Lib.distance("((..))", "((()))") = 2
ex) Lib.distance("(((())))", "(())") = -1
=== Lib.distanceCustom(function, source structure, destination structure) ===
return differences between source structure and destination structure with custom rule
ex) Lib.distanceCustom(function(index){ ... }, source, dest);
== Class RNA ==
<a href="http://kws.eternadev.org/web/script/">example code</a>
=== getPairmap(structure) ===
return the array of pair information
ex) getPairmap("((...))") = [6,5,,,,1,0]
=== getStructure() ===
return structure
=== getRootElement() ===
return root RNAElement class of rna object
=== map() ===
applies function to all RNAElement
== Class RNAElement ==
=== getParent() ===
return the parent RNAElement class
=== getChilds() ===
return the child RNAElement class array
=== getElements() ===
return the array of structure and index JSON objects
=== isPaired() ===
return boolean whether the stack element is paired or not
=== getBaseType() ===
return RNAElement.Stack or RNAElement.Loop if the element is stack or loop
=== getType() ===
return RNAElement.Hairpin, RNAElement.Bulge, RNAElement.Internal, RNAElement.Multiloop or RNAElement.Dangling if the element is hairpin, bulge, internal, multiloop or dangling
=== getIndices() ===
return the array of indices
=== isStack() / isLoop() / isHairpin() / isBulge() /
isInternal() / isMultiloop() / isDangling() ===
return boolean wheter the element is stack, loop, hairpin, bulge, internal, multiloop or dangling
=== getSegmentCount() ===
return how many structure segments included
if the multiloop consists of 2 branches then getSegmentCount() of multiloop returns 2