def test_trainer_struct(self): output_dir = 'output' args = [ '--train-pairs', get_data_path('train.txt'), '--test-pairs', get_data_path('test.txt'), '--valid-pairs', get_data_path('valid.txt'), '--output-directory', output_dir, '--epochs', '1', '--batch-size', '1', '--num-workers', '1', '--learning-rate', '1e-4', '--clip-ends', 'False', '--visualization-fraction', '1', '--gpus', '1' ] parser = argparse.ArgumentParser(add_help=False) parser = LightningAligner.add_model_specific_args(parser) parser.add_argument('--num-workers', type=int) parser.add_argument('--gpus', type=int) args = parser.parse_args(args) model = LightningAligner(args) trainer = Trainer( max_epochs=args.epochs, gpus=args.gpus, check_val_every_n_epoch=1, # profiler=profiler, fast_dev_run=True, # auto_scale_batch_size='power' ) trainer.fit(model)
def test_decoding2(self): X = 'HECDRKTCDESFSTKGNLRVHKLGH' Y = 'LKCSGCGKNFKSQYAYKRHEQTH' needle = NeedlemanWunschDecoder(self.operator) dm = torch.Tensor(np.loadtxt(get_data_path('dm.txt'))) decoded = needle.traceback(dm) pred_x, pred_y, pred_states = list(zip(*decoded)) states2alignment(np.array(pred_states), X, Y)
def setUp(self): hmm = get_data_path('ABC_tran.hmm') n_alignments = 100 align_df = hmm_alignments(n=40, seed=0, n_alignments=n_alignments, hmmfile=hmm) cols = [ 'chain1_name', 'chain2_name', 'tmscore1', 'tmscore2', 'rmsd', 'chain1', 'chain2', 'alignment' ] align_df.columns = cols parts = n_alignments // 10 train_df = align_df.iloc[:parts * 8] test_df = align_df.iloc[parts * 8:parts * 9] valid_df = align_df.iloc[parts * 9:] # save the files to disk. train_df.to_csv('train.txt', sep='\t', index=None, header=None) test_df.to_csv('test.txt', sep='\t', index=None, header=None) valid_df.to_csv('valid.txt', sep='\t', index=None, header=None)
def setUp(self): self.data_path = get_data_path('test_tm_align.tab') self.tokenizer = UniprotTokenizer(pad_ends=False)
def setUp(self): self.data_path = get_data_path('example.txt') self.pairs = pd.read_table(self.data_path, header=None)