Mercurial > repos > bimib > marea
diff Marea/marea.py @ 53:7b57a93ac594 draft
Uploaded
author | bimib |
---|---|
date | Sun, 15 Mar 2020 11:19:36 -0400 |
parents | e4235b5231e4 |
children | 68375ead0ee4 |
line wrap: on
line diff
--- a/Marea/marea.py Fri Mar 13 14:26:31 2020 -0400 +++ b/Marea/marea.py Sun Mar 15 11:19:36 2020 -0400 @@ -537,36 +537,6 @@ warning('Warning: wrong format rule in ' + str(err_rules) + '\n') return (split_rules, list(set(tmp_gene_in_rule))) -def make_recon(data): - try: - import cobra as cb - import warnings - with warnings.catch_warnings(): - warnings.simplefilter('ignore') - recon = cb.io.read_sbml_model(data) - react = recon.reactions - rules = [react[i].gene_reaction_rule for i in range(len(react))] - ids = [react[i].id for i in range(len(react))] - except cb.io.sbml.CobraSBMLError: - try: - data = (pd.read_csv(data, sep = '\t', dtype = str, engine='python')).fillna('') - if len(data.columns) < 2: - sys.exit('Execution aborted: wrong format of '+ - 'custom datarules\n') - if not len(data.columns) == 2: - warning('Warning: more than 2 columns in custom datarules.\n' + - 'Extra columns have been disregarded\n') - ids = list(data.iloc[:, 0]) - rules = list(data.iloc[:, 1]) - except pd.errors.EmptyDataError: - sys.exit('Execution aborted: wrong format of custom datarules\n') - except pd.errors.ParserError: - sys.exit('Execution aborted: wrong format of custom datarules\n') - split_rules, tmp_genes = do_rules(rules) - gene_in_rule = {} - for i in tmp_genes: - gene_in_rule[i] = 'ok' - return (ids, split_rules, gene_in_rule) ############################ gene ############################################# @@ -812,9 +782,6 @@ if os.path.isdir('result') == False: os.makedirs('result') - - if args.custom_rules == 'true': - ids, rules, gene_in_rule = make_recon(args.custom_rule) class_pat = {}