changeset 2:772b977ac9a1 draft

Uploaded
author trinity_ctat
date Mon, 30 Apr 2018 08:46:43 -0400
parents 8f5e700757f3
children 4fa8238660cc
files data_manager/add_ctat_centrifuge_index.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/data_manager/add_ctat_centrifuge_index.py	Fri Apr 27 10:29:42 2018 -0400
+++ b/data_manager/add_ctat_centrifuge_index.py	Mon Apr 30 08:46:43 2018 -0400
@@ -300,9 +300,16 @@
     print "\nThe location of the Centrifuge Index is {:s}.\n".format(index_directory)
     files_in_index_directory = set(os.listdir(index_directory))
     index_file_found = False
+    index_file_path = index_directory
     for filename in files_in_index_directory:
+        # The current index is split into 3 files.
+        # filenames are in the form: index_root_name.#.cf,
+        # where # is a numeral (1, 2, or 3)
+        # indicating the order of the files.
         if filename.split(".")[-1] == _CentrifugeIndexFileExtension:
             index_file_found = True
+            # The centrifuge program wants the root name of the files to be final part of the path.
+            index_file_path = "{:s}/{:s}".format(index_directory, filename.split(".")[0])
     if not index_file_found:
         raise ValueError("Cannot find any Centrifuge Index files.\n" + \
             "The contents of the directory {:s} are:\n\t".format(index_directory) + \
@@ -329,12 +336,12 @@
 
     print "The Index's display_name will be set to: {:s}\n".format(display_name)
     print "Its unique_id will be set to: {:s}\n".format(unique_id)
-    print "Its dir_path will be set to: {:s}\n".format(index_directory)
+    print "Its dir_path will be set to: {:s}\n".format(index_file_path)
 
     data_manager_dict = {}
     data_manager_dict['data_tables'] = {}
     data_manager_dict['data_tables'][_CTAT_CentrifugeIndexTableName] = []
-    data_table_entry = dict(value=unique_id, name=display_name, path=index_directory)
+    data_table_entry = dict(value=unique_id, name=display_name, path=index_file_path)
     data_manager_dict['data_tables'][_CTAT_CentrifugeIndexTableName].append(data_table_entry)
 
     # Temporarily the output file's dictionary is written for debugging: