Mercurial > repos > rnateam > rnacommender
comparison main.py @ 0:8918de535391 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/rna_commander/tools/rna_tools/rna_commender commit 2fc7f3c08f30e2d81dc4ad19759dfe7ba9b0a3a1
| author | rnateam |
|---|---|
| date | Tue, 31 May 2016 05:41:03 -0400 |
| parents | |
| children | a609d6dc8047 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:8918de535391 |
|---|---|
| 1 #!/usr/bin/env python | |
| 2 """Recommendation.""" | |
| 3 | |
| 4 import argparse | |
| 5 import sys | |
| 6 from rbpfeatures import RBPVectorizer | |
| 7 from data import PredictDataset | |
| 8 from recommend import Predictor | |
| 9 | |
| 10 from theano import config | |
| 11 | |
| 12 __author__ = "Gianluca Corrado" | |
| 13 __copyright__ = "Copyright 2016, Gianluca Corrado" | |
| 14 __license__ = "MIT" | |
| 15 __maintainer__ = "Gianluca Corrado" | |
| 16 __email__ = "gianluca.corrado@unitn.it" | |
| 17 __status__ = "Production" | |
| 18 | |
| 19 config.floatX = 'float32' | |
| 20 | |
| 21 if __name__ == '__main__': | |
| 22 parser = argparse.ArgumentParser( | |
| 23 description=__doc__, | |
| 24 formatter_class=argparse.ArgumentDefaultsHelpFormatter) | |
| 25 parser.add_argument('fasta', metavar='fasta', type=str, | |
| 26 help="""Fasta file containing the RBP \ | |
| 27 sequences.""") | |
| 28 | |
| 29 args = parser.parse_args() | |
| 30 | |
| 31 v = RBPVectorizer(fasta=args.fasta) | |
| 32 rbp_fea = v.vectorize() | |
| 33 | |
| 34 if rbp_fea is not None: | |
| 35 # Define and load dataset | |
| 36 D = PredictDataset( | |
| 37 fp=rbp_fea, fr="AURA_Human_data/RNA_features/HT_utrs.h5") | |
| 38 dataset = D.load() | |
| 39 | |
| 40 model = "AURA_Human_data/model/trained_model.pkl" | |
| 41 | |
| 42 # Define the Trainer and train the model | |
| 43 P = Predictor(predict_dataset=dataset, | |
| 44 trained_model=model, | |
| 45 serendipity_dic=model + '_', | |
| 46 output="output.txt") | |
| 47 P.predict() | |
| 48 else: | |
| 49 sys.exit("""The queried protein has no domain similarity with the proteins in the training dataset. It cannot be predicted.""") |
