Skip to content

Commit

Permalink
Edited rna example to include indels, which prints out U nucleotides
Browse files Browse the repository at this point in the history
  • Loading branch information
zmertens committed Jan 19, 2018
1 parent 5435626 commit d001fc4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
15 changes: 14 additions & 1 deletion examples/rna.dawg
@@ -1,15 +1,28 @@
# Test rna evaluationary models

Output.Rna = 1
Output.lowercase = 1
Output.markins = 1
Output.keepempty = 1
Tree.Tree = "(A:0.3, B:0.2)C;"
Tree.Scale = 0.99999
Root.Length = 100
Root.Code = 2
Root.Seq = "AATGCTTTTTTTTTTGGCCAA"
Root.Seq = "AATGCTTTTTTTAAGCAAATGGCCAA"
Sim.Reps = 4
Sim.Seed = 42
Root.Seg = 0

[Indel]
Params.Ins = 1.039000, 50
Model.Ins = "GEO"
Rate.Ins = 0.01
Max.Ins = 50.0
Params.Del = 1.039000, 50
Model.Del = "POWER-LAW"
Rate.Del = 0.01
Max.Del = 50.0

Subst.Model = "gtr"
Subst.Freqs = 0.2, 0.3, 0.3, 0.2
Subst.Params = 2.0, 1.0, 3.0, 1.0, 1.0, 1.0
Expand Down
20 changes: 14 additions & 6 deletions src/include/dawg/residue.h
Expand Up @@ -110,14 +110,18 @@ class residue_exchange {

explicit residue_exchange(int m=DNA) { model(m,0,0,false,false,false); }

template <typename F, typename L>
void echo(F f, L l) const {
std::cout << "File: " << f << ", Line: " << l <<
", type: " << type_ <<
", code: " << code_ << ", rna: " << rna_ << ", lowercase: " <<
lowercase_ << ", markins: " << markins_ << ", keepempty: " << keepempty_ <<
", nuc: " << nuc_ << std::endl;
}

inline bool model(unsigned int type, unsigned int code, bool rna,
bool lowercase, bool markins, bool keepempty) {

std::cout << "type: " << type <<
", code: " << code << ", rna: " << rna << ", lowercase: " <<
lowercase << ", markins: " << markins << ", keepempty: " << keepempty << std::endl;


static constexpr char sIns[] = "-+";
// table for going from base->char
// TODO: Allow codons to be translated into aa
Expand Down Expand Up @@ -171,14 +175,18 @@ class residue_exchange {
39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1
};

echo(__FILE__, __LINE__);

markins_ = markins;
keepempty_ = keepempty;
lowercase_ = lowercase;
rna_ = rna;
type_ = type; // set sequence type DNA, AA, or CODON
nuc_ = ((rna) ? MODRNA : MODDNA) | static_cast<unsigned int>((lowercase) ? 1 : 0);
code_ = code;


echo(__FILE__, __LINE__);

if(MODCOD+code_ >= MODEND || mods[(MODCOD+code_)*64] == '!')
return DAWG_ERROR("invalid genetic code.");

Expand Down

0 comments on commit d001fc4

Please sign in to comment.