e20a35e721074e13760af5655e971192bcc89bbb
wong
  Thu Oct 20 12:39:03 2011 -0700
some minor changes and subId change status ability
diff --git python/programs/qaInit/qaInit.py python/programs/qaInit/qaInit.py
index 057c407..45200c2 100755
--- python/programs/qaInit/qaInit.py
+++ python/programs/qaInit/qaInit.py
@@ -171,55 +171,68 @@
 %s
 
 \tfrom hgwdev --> hgnfs1
 
 Reason: staging %s %s track on beta, http://redmine.soe.ucsc.edu/issues/%s
 
 Thank You!
 
 %s
 """ % (len(gbdbs), gbdbstr, args.composite, args.database, args.redmine, user)
 	f = open(qaDir + "/pushGbdbsMail", "w")
 	f.write(mail)
 	f.close()
 	return gbdbstr
 	
-def writeFileMail(files, args, user, qaDir, c):
+def writeFileMail(files, others, args, user, qaDir, c):
 	sep = ""
-	filestr = sep.join(list(sorted(files)))
+	filestr = sep.join(list(sorted(files | others)))
 	mail = """Hi Pushers,
 
 Please push these %s files:
 
 %s
 
 from hgwdev to hgdownload:
 %s
 
 Please note the destination on hgdownload is *one directory above the location on dev*
 
 Reason: releasing ENCODE %s on %s to the RR http://redmine.soe.ucsc.edu/issues/%s
 
 Thanks!
 
 %s
 """ % (len(files), filestr, c._rrHttpDir, args.composite, args.database, args.redmine, user)
 
 	f = open(qaDir + "/pushFilesMail", "w")
 	f.write(mail)
 	f.close()
-	return filestr
+	subIds = dict()
+	mdb = c.alphaMetaDb
+	p = re.compile('.*(wgE.*)')
+	for i in files:
+		m = p.match(i)
+		file = m.group(1)
+		filestanza = mdb.filter(lambda s: re.match(".*%s.*" % file,s['fileName']), lambda s: s)
+		if filestanza:
+			for j in filestanza:
+				if 'subId' in j:
+					if not j['subId'] in subIds:
+						subIds[j['subId']] = 1
+            
+	return filestr, set(sorted(subIds.keys()))
 
 def writeHtml(args, c, qaDir):
 	f = open(c._trackDbPath, "r")
 	lines = f.readlines()
 	f.close
 	short = ""
 	long = ""
 	for i in lines:
 		m = re.match('((long|short)Label)\s+(.*)', i)
 		
 		if m:
 			if m.group(1) == 'longLabel':
 				long = m.group(3)
 			if m.group(1) == 'shortLabel':
 				short = m.group(3)
@@ -327,30 +340,37 @@
 	
 	mail = """Hi Pushers,
 
 Please push the following file:
 
 /usr/local/apache/htdocs/ENCODE/%s
 
 from hgwbeta --> RR.
 Reason: added the newly released ENCODE %s %s
 
 Thanks!
 
 %s
 """ % (downloads, args.composite, args.database, user)
 
+def changeStatus(subIds):
+	for i in subIds:
+		cmd = "encodeStatus.pl %s reviewing 2>&1" % (i)
+		p = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
+		output = p.stdout.read()
+	return
+
 def main():
 	parser = argparse.ArgumentParser(
         prog='qaInit',
         formatter_class=argparse.RawDescriptionHelpFormatter,
         description='Initializes QA directory for claiming a release',
         epilog=
 """Example:
 qaInir hg19 wgEncodeSydhTfbs 1 69
 
 """
         )
 	parser.add_argument('database', help='The database, typically hg19 or mm9')
 	parser.add_argument('composite', help='The composite name, wgEncodeCshlLongRnaSeq for instance')
 	parser.add_argument('release', help='The new release to be released')
 	parser.add_argument('redmine', help='The Redmins issue number')
@@ -369,27 +389,29 @@
 	makeLinks(c, args, qaDir)
 	notesFile = makeLinks(c, args, qaDir)
 	writeClaimMail(args, user, qaDir)
 	
 	m = re.match('.*(kent/.*)', notesFile)
 	notes = m.group(1)
 	f = open(notesFile, "r")
 	lines = f.readlines()
 	if not re.match('mkChangeNotes v2', lines[0]):
 		print "notes files is not the correct version"
 		return
 	(tables, gbdbs, files, supplemental, others, size) = parseNotes(lines)
 	
 	tablestr = writeTableMail(tables, args, user, qaDir)
 	gbdbstr = writeGbdbMail(gbdbs, args, user, qaDir)
-	filestr = writeFileMail(files | supplemental | others, args, user, qaDir, c)
+	(filestr, subIds) = writeFileMail(files, supplemental | others, args, user, qaDir, c)
 	(short, long) = writeHtml(args, c, qaDir)
 	
 	writePushHtmlMail(args, user, qaDir)
 	writeSql(tablestr, filestr, gbdbstr, d, short, long, args, notes, size, user, qaDir)
 	
+	changeStatus(subIds)
+	
 	runScript(args, qaDir)
 
 
 
 if __name__ == "__main__":
 	main()
\ No newline at end of file