annotate ipfp_normalisation.py @ 0:031cf9d49c51 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
author iuc
date Tue, 04 Feb 2025 09:11:04 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
1 #!/usr/bin/env python
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
2 """
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
3 IPFP Normalisation
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
4 """
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
5 import argparse
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
6 import sys
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
7
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
8 import numpy as np
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
9
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
10
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
11 def throw_error(msg, exit_code=1):
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
12 sys.stderr.write(msg)
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
13 sys.exit(exit_code)
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
14
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
15
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
16 def ipfp(data, precision=1e-5, maxIterations=50):
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
17 """
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
18 Return the normalized version of the input data (matrix) as an ndarray
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
19 :param data: np.ndArray
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
20 :param precision: float combined allowed deviation (residual error) of col and row means from TARGET (=1)
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
21 :param maxIterations: int maximum amount of iterations (1x row and 1x col per iteration)
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
22 :return normalizedData: np.ndArray normalized data
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
23 """
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
24 try:
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
25 assert isinstance(data, np.ndarray) and data.dtype in ['float64', 'int64']
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
26 assert precision > 0
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
27 assert isinstance(maxIterations, int) and maxIterations > 0
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
28 except AssertionError:
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
29 throw_error("Invalid input parameters. Please check that the input data consists of floats or integers, precision > 0 and maxIterations is a positive integer.")
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
30 # replace zeros with nan
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
31 if (data < 0).any():
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
32 throw_error("Negative values detected, only use positive values.")
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
33
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
34 zeros = (data == 0)
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
35 if zeros.any():
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
36 print("Zero values detected; replacing with NA.")
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
37 data = data.astype(float)
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
38 data[zeros] = np.nan
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
39
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
40 # initialize variables
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
41 Nrows, Ncols = data.shape
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
42 convergenceTrail = np.asarray([np.nan] * (2 * maxIterations))
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
43 convergence = np.inf
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
44 normalized_data = data
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
45 TARGET = 1
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
46
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
47 i = 0 # number of current iteration
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
48 # without reshaping the ndarrays, they have shape (x,) (no second value) and the procedure fails.
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
49 # main loop; iterates until convergence is reached (i.e., L1-norm below variable <h>) or the maximum number of
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
50 # iteration cycles is surpassed.
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
51 while convergence > precision and i < maxIterations:
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
52 # fit the rows
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
53 Ri = TARGET * np.asarray(1 / np.nanmean(normalized_data, 1)).reshape(Nrows,)
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
54 normalized_data = (normalized_data.T * Ri).T
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
55
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
56 # calculate deviation from column marginals; row deviation is zero at even indices. (index start = 0)
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
57 convergenceTrail[2 * i] = Nrows * 0.5 * np.nansum(np.abs(np.nanmean(normalized_data, 0) - TARGET))
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
58
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
59 # fit the columns
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
60 Si = TARGET * np.asarray(1 / np.nanmean(normalized_data, 0)).reshape(Ncols,)
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
61 normalized_data *= Si
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
62 # calculate deviation from row marginals; column deviation is zero at odd indices. (index start = 0)
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
63 convergenceTrail[2 * i + 1] = Ncols * 0.5 * np.nansum(np.abs(np.nanmean(normalized_data, 1) - TARGET))
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
64
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
65 convergence = convergenceTrail[2 * i + 1]
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
66 i += 1
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
67
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
68 if i == maxIterations:
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
69 throw_error(f"Max number of IPFP iterations ({maxIterations}) reached. Attained precision: {convergence}.")
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
70
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
71 return normalized_data
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
72
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
73
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
74 def main():
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
75 parser = argparse.ArgumentParser(description="IPFP Normalisation")
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
76 parser.add_argument('-i', '--input', help="Input file", required=True, metavar="FILE")
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
77 parser.add_argument('-p', '--precision', help="Precision", default=1e-5, type=float)
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
78 parser.add_argument('-m', '--maxIterations', help="Max iterations", default=50, type=int)
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
79 parser.add_argument('-s', '--skipHeaders', help="Skip headers, skips the first n lines", default=0, type=int)
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
80
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
81 args = parser.parse_args()
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
82
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
83 try:
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
84 data = np.genfromtxt(args.input, skip_header=args.skipHeaders, filling_values=np.nan, delimiter='\t')
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
85 normalized_data = ipfp(data, args.precision, args.maxIterations)
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
86 np.savetxt("output.tsv", normalized_data, delimiter='\t')
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
87
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
88 except Exception as e:
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
89 throw_error(str(e))
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
90
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
91
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
92 if __name__ == "__main__":
031cf9d49c51 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ipfp_normalisation commit 1facbf5b9d74f0f7cd1f9346acb405a2e327c639
iuc
parents:
diff changeset
93 main()