src/hg/encode/encodeMkChangeNotes/encodeMkChangeNotes 1.2

1.2 2010/03/15 23:34:11 krish
added flag to output lists of files and tables
Index: src/hg/encode/encodeMkChangeNotes/encodeMkChangeNotes
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/encode/encodeMkChangeNotes/encodeMkChangeNotes,v
retrieving revision 1.1
retrieving revision 1.2
diff -b -B -U 4 -r1.1 -r1.2
--- src/hg/encode/encodeMkChangeNotes/encodeMkChangeNotes	15 Mar 2010 22:58:29 -0000	1.1
+++ src/hg/encode/encodeMkChangeNotes/encodeMkChangeNotes	15 Mar 2010 23:34:11 -0000	1.2
@@ -96,8 +96,10 @@
     parser.add_option("-t", "--track-name", dest="track_name",
         help="the name of the composite track by default this is the name of the current directory", metavar="N")
     parser.add_option("-n", "--name", dest="name",
         help="the English name of track", metavar="N", default="Untitled")
+    parser.add_option("--files", dest="files_path", help="dump list of new files to F", metavar="F")
+    parser.add_option("--tables", dest="tables_path", help="dump list of new tablesto F", metavar="F")
 
     global options
     (options, args) = parser.parse_args()
 
@@ -159,9 +161,9 @@
                 raise ValueError, "table %s does not exist, from filetype %s" % (name, type)
             unchanged_tables_list.append(name)
             unchanged_files_list.append(f)
             unchanged_wibs_list.append(wib_path)
-        elif type == "narrowPeak":
+        elif type == "narrowPeak" or type.startswith("bedGraph"):
             if not table_exists(database, name):
                 raise ValueError,  "table %s does not exist, from filetype %s" % (name, type)
             unchanged_tables_list.append(name)
             unchanged_files_list.append(f)
@@ -183,9 +185,9 @@
                 raise ValueError, "table %s does not exist, from filetype %s" % (name, type)
             removed_tables_list.append(name)
             removed_files_list.append(f)
             removed_wibs_list.append(wib_path)
-        elif type == "narrowPeak":
+        elif type == "narrowPeak" or type.startswith("bedGraph"):
             if not table_exists(database, name):
                 raise ValueError,  "table %s does not exist, from filetype %s" % (name, type)
             removed_tables_list.append(name)
             removed_files_list.append(f)
@@ -207,9 +209,9 @@
                 raise ValueError, "table %s does not exist, from filetype %s" % (name, type)
             new_tables_list.append(name)
             new_files_list.append(os.path.join("/usr/local/apache/htdocs/goldenPath/hg18/encodeDCC", options.track_name, current_release_dir, f))
             new_wibs_list.append(wib_path)
-        elif type == "narrowPeak":
+        elif type == "narrowPeak" or type.startswith("bedGraph"):
             if not table_exists(database, name):
                 raise ValueError,  "table %s does not exist, from filetype %s" % (name, type)
             new_tables_list.append(name)
             new_files_list.append(os.path.join("/usr/local/apache/htdocs/goldenPath/hg18/encodeDCC", options.track_name, current_release_dir, f))
@@ -230,10 +232,31 @@
         print >>sys.stderr, "  new tables: %d" % len(new_tables_list)
         print >>sys.stderr, "  new files: %d" % len(new_files_list)
         print >>sys.stderr, "  new wibs: %d" % len(new_wibs_list)
 
+    # if asked, save the list of new files
+    if options.files_path:
+        new_files_file = open(options.files_path, "w")
+        new_files_list.sort()
+        for i in new_files_list:
+            print >>new_files_file, i
+        print >>new_files_file
+        new_wibs_list.sort()
+        for i in new_wibs_list:
+            print >>new_files_file, i
+        new_files_file.close()
+
+    # if asked, generate list of new tables
+    if options.tables_path:
+        new_tables_file = open(options.tables_path, "w")
+        new_tables_list.sort()
+        for i in new_tables_list:
+            print >>new_tables_file, i
+        print >>new_tables_file
+        new_tables_file.close()
+
     # generate the header
-    print "# Generated with %s %s" % (os.path.basename(sys.argv[0]), options.get_version())
+    print "# generated with %s" % parser.get_version()
     print "This is a %s of the \"%s\"" % (current_release_dir, options.name)
     print "The composite track is %s" % options.track_name
     print """
 Categories of tables and files('):
@@ -247,9 +270,10 @@
     # untouched list
     print "A) Untouched Tables (%d):" % len(unchanged_tables_list)
     unchanged_tables_list.sort()
     for i in unchanged_tables_list:
-        print "    %s" %i
+        print i
+    print
 
     print "A') Untouched Files (%d downloadables, %d wibs):" % (len(unchanged_files_list),
                                                            len(unchanged_wibs_list))
     print "   current location on alpha:"
@@ -258,21 +282,22 @@
     print "     {...}/goldenPath/encodeDCC/%s/" % options.track_name
     print
     unchanged_files_list.sort()
     for i in unchanged_files_list:
-        print "    %s" %i
+        print i
     print
     unchanged_wibs_list.sort()
     for i in unchanged_wibs_list:
-        print "    %s" %i
+        print i
 
     print
 
     # eliminated list
     print "B) Deprecated tables (%d):" % len(removed_tables_list)
     removed_tables_list.sort()
     for i in removed_tables_list:
-        print "    %s" %i
+        print i
+    print
 
     print "B') Deprecated files (%d downloadables, %d wibs):" %(len(removed_files_list),
                                                                 len(removed_wibs_list))
     print "   NOTE: NO FILES SHOULD BE REMOVED from the downloads directory on hgdownloads (RR)."
@@ -284,21 +309,22 @@
     print
 
     removed_files_list.sort()
     for i in removed_files_list:
-        print "    %s" %i
+        print i
     print
     removed_wibs_list.sort()
     for i in removed_wibs_list:
-        print "    %s" %i
+        print i
 
     print
 
     # new list
     print "C) New tables (%d):" % len(new_tables_list)
     new_tables_list.sort()
     for i in new_tables_list:
-        print "    %s" %i
+        print i
+    print
 
     print "C') New files (%d downloadables, %d wibs):" % (len(new_files_list),
                                                          len(new_wibs_list))
     print "   current location on alpha:"
@@ -308,13 +334,13 @@
     print
 
     new_files_list.sort()
     for i in new_files_list:
-        print "    %s" %i
+        print i
     print
     new_wibs_list.sort()
     for i in new_wibs_list:
-        print "    %s" %i
+        print i
 
     print
 
     print "D) Additional items:"
@@ -322,11 +348,11 @@
     print "     /usr/local/apache/htdocs/goldenPath/hg18/encodeDCC/%s/%s/" % (options.track_name, current_release_dir)
     print "   should be placed on the RR in (overwritting any existing copy):"
     print "     {...}/goldenPath/encodeDCC/%s/" % options.track_name
     print
-    print "    index.html"
-    print "    files.txt"
-    print "    md5sum.txt"
+    print "index.html"
+    print "files.txt"
+    print "md5sum.txt"
 
 #### Module ####################################################################
 
 if __name__ == "__main__":