Browse Source

added most-present/less-present to list

epsylon 4 years ago
parent
commit
cd386e30cb
1 changed files with 21 additions and 12 deletions
  1. 21 12
      diana.py

+ 21 - 12
diana.py

@@ -661,25 +661,34 @@ def list_genomes_on_database():
     print("-"*15 + "\n")
     f=open(genomes_list_path, 'w')
     for k, v in genomes.items():
-        print ("*"+str(k)+ " -> [ "+str(len(v))+" bp linear RNA ]")
-        print ("  + [A] Adenine  :", str(v.count("A")))
-        print ("  + [G] Guanine  :", str(v.count("G")))
-        print ("  + [C] Cytosine :", str(v.count("C")))
-        print ("  + [T] Thymine  :", str(v.count("T")))
-        f.write(str("*"+ str(k)+ " -> [ "+str(len(v))+"bp linear RNA ]\n"))
-        f.write(str("  + [A] Adenine  : " + str(v.count("A"))+"\n"))
-        f.write(str("  + [G] Guanine  : " + str(v.count("G"))+"\n"))
-        f.write(str("  + [C] Cytosine : " + str(v.count("C"))+"\n"))
-        f.write(str("  + [T] Thymine  : " + str(v.count("T"))+"\n"))
+        print ("* "+str(k))
+        print ("\n  + Total [NUCLEOTIDS]: [ "+str(len(v)-1)+" bp linear RNA ]\n")
+        print ("    - [A] Adenine  :", str(v.count("A")))
+        print ("    - [G] Guanine  :", str(v.count("G")))
+        print ("    - [C] Cytosine :", str(v.count("C")))
+        print ("    - [T] Thymine  :", str(v.count("T")))
+        f.write(str("* "+str(k)+"\n"))
+        f.write(str("\n  + Total [NUCLEOTIDS]: [ "+str(len(v)-1)+" bp linear RNA ]\n"))
+        f.write(str("    - [A] Adenine  : " + str(v.count("A"))+"\n"))
+        f.write(str("    - [G] Guanine  : " + str(v.count("G"))+"\n"))
+        f.write(str("    - [C] Cytosine : " + str(v.count("C"))+"\n"))
+        f.write(str("    - [T] Thymine  : " + str(v.count("T"))+"\n"))
         if v.count("N") > 0:
             print ("  + [N]  *ANY*   :", str(v.count("N")))
             f.write(str("  + [N]  *ANY*   : "+ str(v.count("N"))+"\n"))
+        time.sleep(2)
+        total_codons = 0
+        for c in codons:
+            codon_counter = v.count(str(c.split(":")[0]))
+            total_codons = total_codons +  codon_counter
+        print ("\n  + Total [PATTERN CODONS]: [ "+str(total_codons)+" ] time(s)\n")
+        f.write(str("\n  + Total [PATTERN CODONS]: [ "+str(total_codons)+" ] time(s)\n"))
         for c in codons:
             codon_sec = str(c.split(":")[0])
             codon_name = str(c.split(":")[1].replace("\n",""))
             codon_counter = str(v.count(str(c.split(":")[0])))
-            print ("  + ["+codon_sec+"] "+codon_name+" :", codon_counter)
-            f.write(str("  + ["+codon_sec+"] "+codon_name+" : "+ codon_counter)+"\n")
+            print ("    - ["+codon_sec+"] "+codon_name+" :", codon_counter)
+            f.write(str("    - ["+codon_sec+"] "+codon_name+" : "+ codon_counter)+"\n")
         print ("")
         f.write("\n")
     print("-"*15 + "\n")