Commit 7f1f8827 authored by BELCOUR Arnaud's avatar BELCOUR Arnaud

Add verbose to dendrogram script.

parent 5d5d422a
......@@ -9,12 +9,13 @@ From the matrix absence/presence of reactions in different species computes a Ja
Then create a dendrogram using these distances.
usage:
dendrogram_reactions_distance.py --reactions=FILE --output=FILE
dendrogram_reactions_distance.py --reactions=FILE --output=FILE [-v]
option:
-h --help Show help.
-r --reactions=FILE pathname of the file containing reactions in each species of the comparison.
-o --output=FOLDER path to the output folder.
-v verbose mode.
"""
......@@ -36,6 +37,20 @@ from sklearn.metrics.pairwise import pairwise_distances
from fastcluster import linkage
from scipy.spatial.distance import squareform, pdist
def main():
global verbose
args = docopt.docopt(__doc__)
reaction_pathname = args["--reactions"]
output_pathname = args["--output"]
if args['-v']:
verbose = args["-v"]
else:
verbose = None
reaction_figure_creation(reaction_pathname, output_pathname)
def reaction_figure_creation(reaction_file, output_folder):
# Check if output_folder exists, if not create it.
output_folder_data = output_folder + '/data'
......@@ -165,13 +180,10 @@ def reaction_figure_creation(reaction_file, output_folder):
df.to_csv(temp_data_folder+'/'+'_'.join(cluster_classes[cluster])+'.tsv', sep='\t', index=None, header=None)
cmd = '{0} upset -i {1}/*.tsv --type list -o {2} --figtype svg'.format(path_to_intervene, temp_data_folder, output_folder_upset)
subprocess.call(cmd, shell=True)
def main():
args = docopt.docopt(__doc__)
reaction_pathname = args["--reactions"]
output_pathname = args["--output"]
reaction_figure_creation(reaction_pathname, output_pathname)
if verbose:
subprocess.call(cmd, shell=True)
else:
FNULL = open(os.devnull, 'w')
subprocess.call(cmd, shell=True, stdout=FNULL, stderr=subprocess.STDOUT)
main()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment