Models a single DNA strand. Methods of this class can be used to manipulate individual strands (extending, truncating, inserting, and deleting bases); to manipulate multiple strands (e.g. for ligation or cutting), you'll want to use the strands controller.
Access attributes with .get('name')
and .set('name', value)
.
String
Name of the strand
vox.dna.Base[]
Describes the path of the strand through helical coordinates on the lattice. Each element should have at least the following properties:
pos
: 4-element array giving the position of the base (X/Y/Z/Z'),
where Z' represents the position within a voxel.dir
: +1 for a base pointing 5' -> 3' along the Z-azis, -1 for a
base pointing 3' -> 5'seq
: string indicating how sequences should be assigned to the
base, or containing a single base sequence.String
Sequence of the strand; should be the same length as the routing
Call methods with.name()
,.name(arguments)
or just .name arguments
.
[options]
)
-> undefined
# Backbone.Model Removes all attributes from the model, including the id attribute. Fires a
"change" event unless silent
is passed as an option.
Object
(Optional)Backbone.Model
# Backbone.Model Returns a copy of the model.
Backbone.Model
copy of the model
value
, [dir]
, [options]
, [generator]
)
-> C3D.models.SST
#Extends the strand from the given end
:
Add the sequence 'ATAACAG' to the 3' end:
strand.extend 'ATAACAG'
Add 5 bases to the 5' end:
strand.extend 5, -1
String/Number/Array
Sequence to insert. If a String, inserts one base for each letter in the string (using that letter for the base). If a Number, inserts that many bases. If an Array, inserts one base for each element of the array.
Number
Which end to start from; +1 for 3', -1 for 5'
(Optional; defaults to1
)Object
Options to apply to each base
(Optional)Function
Optional function to modify each base.
(Optional)C3D.models.SST
strand
attribute
)
-> Mixed
# Backbone.Model Get the current value of an attribute from the model. For example: note.get("title")
String
Attribute to get
Mixed
value of the attribute
Array
#Gets the 4-component position of the 3' end of this strand
Array
3' end [x, y, z1, z2]
Array
#Gets the 4-component position of the 5' end of this strand
Array
5' end [x, y, z1, z2]
Number
vox.dna.Base
attribute
)
-> Boolean
# Backbone.Model Returns true if the attribute is set to a non-null or non-undefined value.
if (note.has("title")) {
...
}
String
Boolean
true
if the attribute is non-null or non-undefined, else false
index
, value
, [options]
, [generator]
)
-> C3D.models.SST
#Inserts some sequence or bases at the given index
:
Inserts 10 bases at the 5th base from the 5' end:
strand.insert(5, 10)
Inserts 4 T's at the 3rd base from the 3' end:
strand.insert(-3, 'TTTT')
Inserts 7 random bases at the 5' end, using a generator
function:
strand.insert 0, 7, {}, (opt, i) ->
opt.seq = chance.character({ pool: 'ATCG' })
opt
Number
Index at which to insert
String/Number/Array
Sequence to insert. If a String, inserts one base for each letter in the string (using that letter for the base). If a Number, inserts that many bases. If an Array, inserts one base for each element of the array.
Object
Options to apply to each base
(Optional)Function
Optional function to modify each base.
(Optional)C3D.models.SST
strand
Number
#Gets the length, in bases, of this strand
Number
Length
dx
, dy
, [dz1]
, [dz2]
)
-> C3D.models.SST
#Moves all bases in the given strand by this amount
Number
Number
Number
(Optional; defaults to 0
)Number
(Optional; defaults to 0
)C3D.models.SST
strand
index
, length
)
-> C3D.models.SST
#Removes bases from the strand
Remove 5 bases from the 5' end:
strand.remove 0, 5
Remove 7 bases from the 3' end:
strand.remove -1, -7
Remove 5 bases (3' -> 5') from the base before the 3' end:
strand.remove -2, -5
Number
Index at which to remove (0
= 5' end); use negative numbers to count
backwards from the 3' end of the strand (-1
= 3' end).
Number
Number of bases to remove. Use positive numbers to remove in the 5' -> 3' direction, negative numbers to remove in the 3' -> 5' direction.
C3D.models.SST
strand
vox.dna.Base[]
String
Routing string
attribute
, [options]
)
-> undefined
# Backbone.Model Set a hash of attributes (one or many) on the model. If any of the attributes
change the model's state, a change
event will be triggered on the model.
Change events for specific attributes are also triggered, and you can bind to
those as well, for example: change:title
, and change:content
. You may also
pass individual keys and values.
note.set({title: "March 20", content: "In his eyes she eclipses..."});
book.set("title", "A Scandal in Bohemia");
String/Object
(s)
Object
(Optional)length
, [dir]
)
-> C3D.models.SST
#Removes bases from the 5' or 3' end of the strand
Remove 2 bases from the 3' end:
strand.truncate 2
Remove 6 bases from the 5' end:
strand.truncate 6, -1
Number
Number of bases to remove
Number
Which end to remove from; +1
for 3', -1
for 5'
1
)C3D.models.SST
strand
attribute
, [options]
)
-> undefined
# Backbone.Model Remove an attribute by deleting it from the internal attributes hash. Fires a
"change" event unless silent
is passed as an option.
String
Object
(Optional)