def redo_compare_all_releases(self): """ When problems in release comparisons are discovered, use this function in manual mode to recompute the release difference table. """ all_releases = self.list_all_releases(self.motif_type) for i in xrange(len(all_releases)): release = all_releases[i] c1 = MotifCollection(release=release,type=self.motif_type) for j in xrange((i+1),len(all_releases)): print '%s vs %s' % (all_releases[i], all_releases[j]) c2 = MotifCollection(release=all_releases[j],type=self.motif_type) logging.info('Comparing %s and %s' % (c1.release, c2.release)) A = Uploader(ensembles=MotifCollectionMerger(c1,c2), upload_mode='release_diff', motif_type=self.motif_type) A.import_release() # set direct parent flag if j == i+1: a = session.query(Release_diff).filter(Release_diff.release_id1==release)\ .filter(Release_diff.release_id2==all_releases[j])\ .first() a.direct_parent = 1; session.merge(a) session.commit()
def import_motif_release(self): """ """ c1 = MotifCollection(file=self.f['MotifList'], type=self.motif_type) c2 = MotifCollection(release='latest', type=self.motif_type) A = Uploader(ensembles=MotifCollectionMerger(c1,c2), mode=self.config['release_mode']['motifs'], #'minor', description=self.f['description'], files=self.f, motif_type=self.motif_type) A.import_release()
def compare_all_releases(self): """ """ all_releases = self.list_all_releases(self.motif_type) if len(all_releases) <= 2: return all_releases = all_releases[2:] c1 = MotifCollection(release='latest',type=self.motif_type) for release in all_releases: c2 = MotifCollection(release=release,type=self.motif_type) logging.info('Comparing %s and %s' % (c1.release, c2.release)) A = Uploader(ensembles=MotifCollectionMerger(c1,c2), upload_mode='release_diff', motif_type=self.motif_type) A.import_release()
def main(argv): """ """ try: opts, args = getopt.getopt(argv, "t:r:h", ['help','type']) except getopt.GetoptError: usage() sys.exit(2) motif_type = None release_to_remove = None for opt, arg in opts: if opt in ('-h', '--help'): usage() sys.exit() elif opt in ('-t', '--type'): motif_type = arg elif opt in ('-r'): release_to_remove = arg if motif_type is None: usage() print 'Please specify motif type: il, hl, j3, j4 etc' sys.exit(2) if release_to_remove is not None: print 'Are you sure you want to delete %s release %s?. Press c to continue or q to abort.' \ % (motif_type, release_to_remove) pdb.set_trace() U = Uploader(motif_type=motif_type) U.remove_release(release_to_remove) logging.info('Release %s removed successfully' % release_to_remove) return L = MotifLoader(motif_type=motif_type) L.start_logging() # L.redo_compare_all_releases() # use in manual mode only L.import_data() L.send_report()