in progress...
authorcmzmasek <chris.zma@outlook.com>
Tue, 19 Sep 2017 17:34:51 +0000 (10:34 -0700)
committercmzmasek <chris.zma@outlook.com>
Tue, 19 Sep 2017 17:34:51 +0000 (10:34 -0700)
forester/python/clad_sum.py [new file with mode: 0644]

diff --git a/forester/python/clad_sum.py b/forester/python/clad_sum.py
new file mode 100644 (file)
index 0000000..93132b7
--- /dev/null
@@ -0,0 +1,41 @@
+from sys import argv
+import re
+
+infile = argv[ 1 ]
+
+print( 'Infile: ', infile )
+
+match = 0
+lessspecific = 0
+qu = 0
+na = 0
+no_match = 0
+
+with open( infile ) as f:
+    for line in f:
+        line = line.strip()
+        if not line.startswith('#'):
+            elements = line.split('\t')
+            if elements[ 1 ] == 'Matching Clades':
+                if (elements[ 0 ].endswith(elements[ 2 ])):
+                    match+=1
+                else:
+                    my_regex = r".+\|" + re.escape(elements[ 2 ]) + r"\."
+                    if  re.search(my_regex, elements[ 0 ]): 
+                        lessspecific+=1
+                    elif elements[ 2 ] == '?':
+                        qu+=1
+                        print('?       :  ', line)    
+                    elif elements[ 0 ].endswith( 'NA' ):
+                        na+=1
+                        print('NA      :  ', line)
+                    else:
+                        no_match+=1
+                        print('no match:  ', line)
+                        
+print()
+print( 'Match                            :', match )
+print( 'Less specific match              :', lessspecific )
+print( 'No match: result undeceided ("?"):',  qu )
+print( 'No match: target is "NA"         :',  na )
+print( 'No match                         :',  no_match )