changeset 6:7973201f23e7 draft

Uploaded
author greg
date Tue, 22 May 2018 10:10:15 -0400
parents f2e91be20b43
children 82822d1e5119
files add_scaffold.py
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/add_scaffold.py	Tue May 22 10:06:28 2018 -0400
+++ b/add_scaffold.py	Tue May 22 10:10:15 2018 -0400
@@ -64,7 +64,8 @@
             self.stop_err(msg)
         return cur
 
-    def check_scaffold(self):
+    @property
+    def can_add_scaffold(self):
         """
         Make sure the scaffold has not already been added.
         """
@@ -75,17 +76,18 @@
         try:
             cur.fetchone()[0]
             self.stop_err("The scaffold %s has already been added to the database." % scaffold_id)
+            return False
         except:
             # The scaffold has not yet been added.
-            pass
+            return True
 
     def run(self):
-        self.check_scaffold()
-        self.process_annot_dir()
-        self.process_scaffold_config_files()
-        self.process_orthogroup_fasta_files()
-        self.fh.flush()
-        self.fh.close()
+        if self.can_add_scaffold:
+            self.process_annot_dir()
+            self.process_scaffold_config_files()
+            self.process_orthogroup_fasta_files()
+            self.fh.flush()
+            self.fh.close()
 
     def process_annot_dir(self):
         """