def test_data_model_make_01(example_data): model = DataModel(example_data) assert model is not None model.make() sectors_legend = model.make_sectors_legend() print(sectors_legend)
def test_data_model_make_01(example_data): model = DataModel(example_data) assert model is not None model.make() sector_model = SectorsDataModel(model) sector_model.make() print(sector_model.column_labels) print(sector_model.sector) print(np.argwhere(43 == model.Z['leaves'])) print(np.argmin(model.sector)) m = np.argmin(model.sector) print(m) print(model.sector[m]) print(model.column_labels[m]) print(m - 1) print(model.sector[m - 1]) print(model.column_labels[m - 1]) assert sector_model.sector[0] == 1 assert sector_model.column_labels[0] == model.column_labels[m]
def test_make_featuremat(example_data): model = DataModel(example_data) assert model is not None model.make() featuremat_model = FeaturematModel(model) featuremat_model.make()
def _build_model(self, filename, *args, **kwargs): try: model = DataModel(filename) model.make() return model except Exception: self._load_error() return None
def test_single_sector_subtree_experiments(example_data): model = DataModel(example_data) assert model is not None model.make() print(model.sector_mapping) single_sector_model = SingleSectorDataModel(model, 1) single_sector_model.make() lmat = np.array(single_sector_model.lmat) print(lmat[:, 0]) print(lmat[:, 1])
def model_fixture(example_data): model = DataModel(example_data) model.make() return model
def main(argv=None): if argv is None: argv = sys.argv else: argv.extend(sys.argv) program_name = os.path.basename(sys.argv[0]) program_shortdesc = "SCGV is an interacive graphical tool for " \ "single-cell genomics data, with emphasis on single-cell " \ "genomics of cancer" program_description = '''%s USAGE ''' % (program_shortdesc, ) program_version_message = "1.0.3" try: parser = ArgumentParser(description=program_description, formatter_class=RawDescriptionHelpFormatter) parser.add_argument('-V', '--version', action='version', version=program_version_message) parser.add_argument('-d', '--directory', type=str, dest='directory', metavar='<dir name>', help='load data from directory') parser.add_argument( '-o', '--output', type=str, dest='output', metavar='<output filename>', help='saves main view in a figure with specified filename') parser.add_argument('-t', '--title', type=str, dest='title', metavar='<figure title>', help='adds title to the saved figure') parser.add_argument('-r', '--resolution', type=int, dest='resolution', metavar='<resolution>', help='figure output resolution', default=300) args = parser.parse_args() print(args) if args.directory is not None and args.output is not None: assert os.path.exists(args.directory) model = DataModel(args.directory) model.make() canvas = Canvas() canvas.model = model canvas.redraw() if args.title is not None: canvas.fig.suptitle(args.title, fontsize=24) canvas.fig.savefig(args.output, dpi=args.resolution) return 0 app = QApplication(sys.argv) window = MainWindow() window.show() if args.directory is not None: window.open_buttons.load_model(args.directory) app.exec_() return 0 except KeyboardInterrupt: traceback.print_exc() return 0 except Exception as e: traceback.print_exc() indent = len(program_name) * " " sys.stderr.write(program_name + ": " + repr(e) + "\n") sys.stderr.write(indent + " for help use --help") sys.stderr.write('\n') return 2