Update htsworkflow.util.fctracker module to work with the newer django db
authorDiane Trout <diane@caltech.edu>
Wed, 6 May 2009 22:56:29 +0000 (22:56 +0000)
committerDiane Trout <diane@caltech.edu>
Wed, 6 May 2009 22:56:29 +0000 (22:56 +0000)
this was needed to support the make-library-tree script

htsworkflow/util/fctracker.py
scripts/make-library-tree

index 57b5dcfa647a1815a28c9cd0b08a216ecdef3302..5ba33892f741213bb1932292e5821551df379295 100644 (file)
@@ -81,8 +81,8 @@ class fctracker:
         attach the library dictionary to the instance
         """
         self.library = self._make_dict_from_table(
         attach the library dictionary to the instance
         """
         self.library = self._make_dict_from_table(
-                         'fctracker_library', 
-                         'library_id')
+                         'samples_library', 
+                         'id')
                                                   
         
     def _get_species(self):
                                                   
         
     def _get_species(self):
@@ -90,7 +90,7 @@ class fctracker:
         attach the species dictionary to the instance
         """
         self.species = self._make_dict_from_table(
         attach the species dictionary to the instance
         """
         self.species = self._make_dict_from_table(
-                         'fctracker_species',
+                         'samples_species',
                          'id'
                        )
         
                          'id'
                        )
         
@@ -106,7 +106,7 @@ class fctracker:
             where = ""
         self.flowcells = {}
         c = self.conn.cursor()
             where = ""
         self.flowcells = {}
         c = self.conn.cursor()
-        c.execute('select * from fctracker_flowcell %s;' % (where))
+        c.execute('select * from experiments_flowcell %s;' % (where))
         # extract just the field name
         description = [ f[0] for f in c.description ]
         for row in c:
         # extract just the field name
         description = [ f[0] for f in c.description ]
         for row in c:
index 1c3772efb9f6050086f79138dfae8e4c03ebb967..50ce7a932ef263300c70d2e9483f18431ced6f5d 100644 (file)
@@ -42,7 +42,9 @@ def parse_srf_directory(srf_dir):
         path, filename = os.path.split(pathname)
         basename, ext = os.path.splitext(filename)
         record = basename.split('_')
         path, filename = os.path.split(pathname)
         basename, ext = os.path.splitext(filename)
         record = basename.split('_')
-        assert len(record) == 6
+        if len(record) != 6:
+            logging.error("Unrecognized srf file: %s expected 6 fields got %d" % (pathname,len(record)))
+            continue
 
         site = record[0]
         date = record[1]
 
         site = record[0]
         date = record[1]
@@ -64,7 +66,7 @@ def carefully_make_hardlink(source, destination, dry_run=False):
     the same as the link we want to make.
     If the link already exists and is different, throw an error.
     """
     the same as the link we want to make.
     If the link already exists and is different, throw an error.
     """
-    logging.debug("%s -> %s", source, destination)
+    logging.debug("CHECKING: %s -> %s", source, destination)
 
     if not os.path.exists(source):
         logging.warning("%s doesn't exist", source)
 
     if not os.path.exists(source):
         logging.warning("%s doesn't exist", source)
@@ -72,6 +74,7 @@ def carefully_make_hardlink(source, destination, dry_run=False):
 
     if os.path.exists(destination):
         if os.path.samefile(source, destination):
 
     if os.path.exists(destination):
         if os.path.samefile(source, destination):
+            logging.debug('SAME: %s -> %s' % (source, destination))
             return
         else:
             raise IOError('%s and %s are different files' % \
             return
         else:
             raise IOError('%s and %s are different files' % \