comparison main.py @ 0:d04fa5201f51 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/rna_commander/tools/rna_tools/rna_commender commit 7ad344d108076116e702e1c1e91cea73d8fcadc4
author rnateam
date Thu, 28 Jul 2016 05:56:54 -0400
parents
children 79c9b4b34b63
comparison
equal deleted inserted replaced
-1:000000000000 0:d04fa5201f51
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 __author__ = "Gianluca Corrado"
11 __copyright__ = "Copyright 2016, Gianluca Corrado"
12 __license__ = "MIT"
13 __maintainer__ = "Gianluca Corrado"
14 __email__ = "gianluca.corrado@unitn.it"
15 __status__ = "Production"
16
17
18 if __name__ == '__main__':
19 parser = argparse.ArgumentParser(
20 description=__doc__,
21 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
22 parser.add_argument('fasta', metavar='fasta', type=str,
23 help="""Fasta file containing the RBP \
24 sequences.""")
25
26 args = parser.parse_args()
27
28 v = RBPVectorizer(fasta=args.fasta)
29 rbp_fea = v.vectorize()
30
31 if rbp_fea is not None:
32 # Define and load dataset
33 D = PredictDataset(
34 fp=rbp_fea, fr="AURA_Human_data/RNA_features/HT_utrs.h5")
35 dataset = D.load()
36
37 model = "AURA_Human_data/model/trained_model.pkl"
38
39 # Define the Trainer and train the model
40 P = Predictor(predict_dataset=dataset,
41 trained_model=model,
42 serendipity_dic=model + '_',
43 output="output.txt")
44 P.predict()
45 else:
46 sys.stdout.write("""
47 The queried protein has no domain similarity with the proteins in the training dataset. It cannot be predicted.
48 """)