Index: liacs/dbdm/dbdm_4/README
===================================================================
--- liacs/dbdm/dbdm_4/README	(revision 66)
+++ liacs/dbdm/dbdm_4/README	(revision 66)
@@ -0,0 +1,5 @@
+ecoli_hmm.py                -   FASTA Hidden Markov Model 
+gene_detect.py              -   Parse CSV file for genes and match them in the FASTA file
+parse_fasta.py              -   Parse FASTA files and display results
+reading_frames.py           -   Detected reading frames
+unfair_casino_example.py    -   Hidden Markov Model example
Index: liacs/dbdm/dbdm_4/ecoli_hmm.py
===================================================================
--- liacs/dbdm/dbdm_4/ecoli_hmm.py	(revision 64)
+++ liacs/dbdm/dbdm_4/ecoli_hmm.py	(revision 66)
@@ -29,10 +29,11 @@
     }
 
+# Transform the state to something human readable
 dna_ascii_translate = {
-    '0' : '*',
+    '0' : '.',
     '1' : '<',
     '2' : '<',
     '3' : '<',
-    '4' : '-',
+    '4' : '|',
     '5' : '>',
     '6' : '>',
@@ -42,5 +43,5 @@
 dna_ascii = MultiReplace(dna_ascii_translate)
 
-def pretty_print(test_seq, ans_seq, v, length=70, parts=10, seperator=''):
+def pretty_print(test_seq, ans_seq, v, length=100, parts=10, seperator=''):
     """ Pretty printing of output for verification purposes """
     for i in range(0,len(v[0]),length):
@@ -54,7 +55,7 @@
             result.append(dna_ascii.replace(''.join(map(str,v[0][t:t+parts]))))
 
-        print seperator.join(seq)
-        print seperator.join(ans)
-        print seperator.join(result)
+        print "ORG: " + seperator.join(seq)
+        print "CSV: " + seperator.join(ans)
+        print "HMM: " + seperator.join(result)
         print ''
     print "fairness of test_seq: ", v[1]
@@ -79,12 +80,12 @@
     # 7) Stop-codon  : end of gene - part 3
     A = [
-            [0.8, 0.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 
-            [0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0], 
-            [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0], 
-            [0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0], 
-            [0.0, 0.0, 0.0, 0.0, 0.7, 0.3, 0.0, 0.0], 
-            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0], 
-            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0], 
-            [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0], 
+            [0.8, 0.2, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],   # 0
+            [0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0],   # 1
+            [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0],   # 2
+            [0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0],   # 3
+            [0.0, 0.0, 0.0, 0.0, 0.9, 0.1, 0.0, 0.0],   # 4
+            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0],   # 5
+            [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0],   # 6
+            [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],   # 7
         ]
 
@@ -94,12 +95,12 @@
     B = [
             # e.g. state 0 -> emission probability
-            [0.2, 0.2, 0.2, 0.2, 0.2] , 
-            [0.9, 0.0, 0.1, 0.0, 0.0] , 
-            [0.0, 0.0, 0.0, 1.0, 0.0] , 
-            [0.0, 0.0, 1.0, 0.0, 0.0] , 
-            [0.2, 0.2, 0.2, 0.2, 0.2] , 
-            [0.0, 0.0, 0.0, 1.0, 0.0] , 
-            [0.7, 0.0, 0.3, 0.0, 0.0] , 
-            [0.7, 0.0, 0.3, 0.0, 0.0] , 
+            [0.2, 0.2, 0.2, 0.2, 0.2] ,     # 0
+            [0.9, 0.0, 0.1, 0.0, 0.0] ,     # 1
+            [0.0, 0.0, 0.0, 1.0, 0.0] ,     # 2
+            [0.0, 0.0, 1.0, 0.0, 0.0] ,     # 3
+            [0.2, 0.2, 0.2, 0.2, 0.2] ,     # 4
+            [0.0, 0.0, 0.0, 1.0, 0.0] ,     # 5
+            [0.7, 0.0, 0.3, 0.0, 0.0] ,     # 6
+            [0.7, 0.0, 0.3, 0.0, 0.0] ,     # 7
         ]
     
@@ -109,5 +110,5 @@
     m = ghmm.HMMFromMatrices(sigma,ghmm.DiscreteDistribution(sigma),A ,B, pi)
     print "Initial HMM"
-    print m
+    print m.verboseStr()
 
     obs_seq = m.sampleSingle(20)
@@ -130,6 +131,7 @@
     handle.close()
 
-    test_seq = contig_seq['AE005174v2-2'][0:490]
-    ans_seq = answer['AE005174v2-2'][0:490]
+    test_size = 1000;
+    test_seq = contig_seq['AE005174v2-2'][0:test_size]
+    ans_seq = answer['AE005174v2-2'][0:test_size]
     test_eseq=ghmm.EmissionSequence(sigma,list(test_seq))
     v = m.viterbi(test_eseq)
@@ -139,7 +141,7 @@
     # Train sequence
     print "Training baumWelch"
-    train_seq = ghmm.EmissionSequence(sigma,list(contig_seq['AE005174v2-1']))
+    train_seq = ghmm.EmissionSequence(sigma,list(contig_seq['AE005174v2-1'][0:10000]))
     v = m.baumWelch(train_seq)
-    print m
+    print m.verboseStr()
     
 
Index: liacs/dbdm/dbdm_4/gene_detect.py
===================================================================
--- liacs/dbdm/dbdm_4/gene_detect.py	(revision 64)
+++ liacs/dbdm/dbdm_4/gene_detect.py	(revision 66)
@@ -58,5 +58,5 @@
                         handle = open(contig + ".raw","rU")
                         contig_seq[contig] = handle.read()
-                        abstract_contig[contig] = list('*' * len(contig_seq[contig]))
+                        abstract_contig[contig] = list('.' * len(contig_seq[contig]))
                         handle.close()
                     except IOError:
@@ -94,5 +94,5 @@
                     if start_pos < stop_pos:
                         abstract_contig[contig][start_pos:start_pos+3] = ['<'] * 3
-                        abstract_contig[contig][start_pos+3:stop_pos] = ['-'] * (stop_pos - (start_pos + 3))
+                        abstract_contig[contig][start_pos+3:stop_pos] = ['|'] * (stop_pos - (start_pos + 3))
                         abstract_contig[contig][stop_pos:stop_pos+3] = ['>'] * 3
                     break
