9a49290fedc8b4f9c7a631dedcfe8ac3aa2b4cee chinhli Thu Oct 20 14:10:43 2011 -0700 merge conflict resolved diff --git python/lib/ucscgenomics/track.py python/lib/ucscgenomics/track.py index 778244e..8f3e787 100644 --- python/lib/ucscgenomics/track.py +++ python/lib/ucscgenomics/track.py @@ -117,78 +117,98 @@ return self._database @property def name(self): """The composite name""" return self._name @property def downloadsDirectory(self): """The location of files in downloads""" if not os.path.isdir(self._downloadsDirectory): raise KeyError(self._downloadsDirectory + ' does not exist') return self._downloadsDirectory @property + def httpDownloadsPath(self): + """The location of the downloadable files path in apache form""" + if not os.path.isdir(self._httpDownloadsPath): + raise KeyError(self._httpDownloadsPath + ' does not exist') + return self._httpDownloadsPath + + @property def files(self): """A list of all files in the downloads directory of this composite""" try: return self._files except AttributeError: md5sums = readMd5sums(self._md5path) radict = dict() for stanza in self.alphaMetaDb: if 'fileName' in stanza: for file in stanza['fileName'].split(','): radict[file] = stanza self._files = dict() for file in os.listdir(self.downloadsDirectory): if os.path.isfile(self.downloadsDirectory + file): stanza = None if file in radict: stanza = radict[file] if file in md5sums: self._files[file] = TrackFile(self.downloadsDirectory + file, md5sums[file], stanza) else: self._files[file] = TrackFile(self.downloadsDirectory + file, None, stanza) return self._files @property + def qaInitDir(self): + qaDir = '/hive/groups/encode/encodeQa/test/' + self._database + '/' + self._name + '/' + if os.path.exists(qaDir) and os.path.isdir(qaDir): + pass + else: + os.makedirs(qaDir) + self._qaDir = qaDir + return qaDir + + @property def releases(self): """A list of all files in the release directory of this composite""" try: return self._releaseFiles except AttributeError: self._releaseFiles = list() count = 1 while os.path.exists(self.downloadsDirectory + 'release' + str(count)): releasepath = self.downloadsDirectory + 'release' + str(count) + '/' md5s = readMd5sums(releasepath + 'md5sum.txt') releasefiles = dict() for file in os.listdir(releasepath): - if file != 'md5sum.txt' and md5s != None and file in md5s: + if file != 'md5sum.txt' and md5s != None and file in md5s and not os.path.isdir(releasepath + file): releasefiles[file] = TrackFile(releasepath + file, md5s[file]) - else: + elif not os.path.isdir(releasepath + file): releasefiles[file] = TrackFile(releasepath + file, None) - + elif os.path.isdir(releasepath + file): + for innerfile in os.listdir(releasepath + file): + pathfile = file + "/" + innerfile + releasefiles[pathfile] = TrackFile(releasepath + pathfile, None) #releasefiles.sort() self._releaseFiles.append(releasefiles) count = count + 1 return self._releaseFiles @property def alphaMetaDb(self): """The Ra file in the metaDb for this composite""" try: return self._alphaMetaDb except AttributeError: if not os.path.isfile(self._alphaMdbPath): raise KeyError(self._alphaMdbPath + ' does not exist') self._alphaMetaDb = ra.RaFile(self._alphaMdbPath) @@ -257,20 +277,23 @@ self._organism = organisms[database] else: raise KeyError(database + ' is not a valid database') if not self._trackPath.endswith('/'): self._trackPath = self._trackPath + '/' self._trackDbPath = self._trackPath + self._organism + '/' + database + '/' + compositeName + '.ra' if not os.path.isfile(self._trackDbPath): raise KeyError(self._trackDbPath + ' does not exist') self._alphaMdbPath = self._trackPath + self._organism + '/' + database + '/metaDb/alpha/' + compositeName + '.ra' self._betaMdbPath = self._trackPath + self._organism + '/' + database + '/metaDb/beta/' + compositeName + '.ra' self._publicMdbPath = self._trackPath + self._organism + '/' + database + '/metaDb/public/' + compositeName + '.ra' self._downloadsDirectory = '/hive/groups/encode/dcc/analysis/ftp/pipeline/' + database + '/' + compositeName + '/' + self._httpDownloadsPath = '/usr/local/apache/htdocs-hgdownload/goldenPath/' + database + '/encodeDCC/' + compositeName + '/' + self._rrHttpDir = '/usr/local/apache/htdocs/goldenPath/' + database + '/encodeDCC/' + compositeName + '/' + self._notesDirectory = os.path.expanduser("~/kent/src/hg/makeDb/doc/encodeDcc%s" % database.capitalize()) + '/' self._url = 'http://genome.ucsc.edu/cgi-bin/hgTrackUi?db=' + database + '&g=' + compositeName self._database = database self._name = compositeName self._md5path = '/hive/groups/encode/dcc/analysis/ftp/pipeline/' + database + '/' + compositeName + '/md5sum.txt'