Assembly: BioSharp.Core (in BioSharp.Core.dll) Version: 0.1.3191.26120 (0.1.0.0)
Syntax
C# |
---|
public void Edit( Edit edit ) |
Parameters
- edit
- Type: BioSharp.Core.Bio.Symbol..::.Edit
the Edit to perform
Implements
ISymbolList..::.Edit(Edit)Remarks
Description
All edits can be broken down into a series of operations that change contiguous blocks of the sequence. This represent a one of those operations.
When applied, this Edit will replace 'length' number of symbols starting a position 'pos' by the SymbolList 'replacement'. This allow to do insertions (length=0), deletions (replacement=SymbolList.EMPTY_LIST) and replacements (length>=1 and replacement.length()>=1).
The pos and pos+length should always be valid positions on the SymbolList to:
- be edited (between 0 and symL.length()+1).
- To append to a sequence, pos=symL.length()+1, pos=0.
- To insert something at the beginning of the sequence, set pos=1 and length=0.
Examples
ISymbolList seq = DNATools.CreateDNA("atcaaaaacgctagc");
Console.WriteLine(seq.seqString());
// delete 5 bases from position 4
Edit ed = new Edit(4, 5, SymbolList.EMPTY_LIST);
seq.Edit(ed);
Console.WriteLine(seq.SeqString());
// delete one base from the start
ed = new Edit(1, 1, SymbolList.EMPTY_LIST);
seq.Edit(ed);
// delete one base from the end
ed = new Edit(seq.Length, 1, SymbolList.EMPTY_LIST);
seq.Edit(ed);
Console.WriteLine(seq.SeqString);
// overwrite 2 bases from position 3 with "tt"
ed = new Edit(3, 2, DNATools.CreateDNA("tt"));
seq.Edit(ed);
Console.WriteLine(seq.SeqString);
// add 6 bases to the start
ed = new Edit(1, 0, DNATools.CreateDNA("aattgg");
seq.Edit(ed);
Console.WriteLine(seq.SeqString);
// add 4 bases to the end
ed = new Edit(seq.length() + 1, 0, DNATools.CreateDNA("tttt"));
seq.Edit(ed);
Console.WriteLine(seq.SeqString);
// full edit
ed = new Edit(3, 2, DNATools.CreateDNA("aatagaa");
seq.Edit(ed);
Console.WriteLine(seq.SeqString);