annotate fsd.py @ 4:5bae51dc7fa1 draft

planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit 84c5a0c42a666f70c4328e7ed85523a036d52e17
author mheinzl
date Wed, 09 May 2018 09:09:26 -0400
parents 648d5df50ca8
children 69f47e0b804e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
1 #!/usr/bin/env python
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
2
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
3 # Family size distribution of SSCSs
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
4 #
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
5 # Author: Monika Heinzl, Johannes-Kepler University Linz (Austria)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
6 # Contact: monika.heinzl@edumail.at
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
7 #
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
8 # Takes at least one TABULAR file with tags before the alignment to the SSCS, but up to 4 files can be provided, as input.
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
9 # The program produces a plot which shows the distribution of family sizes of the all SSCSs from the input files and
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
10 # a CSV file with the data of the plot, as well as a TXT file with all tags of the DCS and their family sizes.
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
11 # If only one file is provided, then a family size distribution, which is separated after SSCSs without a partner and DCSs, is produced.
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
12 # Whereas a family size distribution with multiple data in one plot is produced, when more than one file (up to 4) is given.
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
13
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
14 # USAGE: python FSD_Galaxy_1.4_commandLine_FINAL.py filename --inputFile2 filename2 --inputFile3 filename3 --inputFile4 filename4 /
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
15 # --title_file outputFileName --sep "characterWhichSeparatesCSVFile"
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
16
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
17 import numpy
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
18 import matplotlib.pyplot as plt
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
19 from matplotlib.backends.backend_pdf import PdfPages
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
20 import argparse
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
21 import sys
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
22 import os
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
23 import re
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
24
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
25 def readFileReferenceFree(file):
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
26 with open(file, 'r') as dest_f:
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
27 data_array = numpy.genfromtxt(dest_f, skip_header=0, delimiter='\t', comments='#', dtype='string')
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
28 return(data_array)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
29
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
30 def make_argparser():
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
31 parser = argparse.ArgumentParser(description='Family Size Distribution of duplex sequencing data')
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
32 parser.add_argument('inputFile',
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
33 help='Tabular File with three columns: ab or ba, tag and family size.')
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
34 parser.add_argument('--inputName1')
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
35 parser.add_argument('--inputFile2',default=None,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
36 help='Tabular File with three columns: ab or ba, tag and family size.')
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
37 parser.add_argument('--inputName2')
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
38 parser.add_argument('--inputFile3',default=None,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
39 help='Tabular File with three columns: ab or ba, tag and family size.')
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
40 parser.add_argument('--inputName3')
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
41 parser.add_argument('--inputFile4',default=None,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
42 help='Tabular File with three columns: ab or ba, tag and family size.')
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
43 parser.add_argument('--inputName4')
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
44 parser.add_argument('--sep', default=",",
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
45 help='Separator in the csv file.')
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
46 parser.add_argument('--output_csv', default="data.csv",type=str,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
47 help='Name of the pdf and csv file.')
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
48 parser.add_argument('--output_pdf', default="data.pdf",type=str,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
49 help='Name of the pdf and csv file.')
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
50 return parser
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
51
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
52 def compare_read_families(argv):
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
53 parser = make_argparser()
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
54 args=parser.parse_args(argv[1:])
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
55
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
56 firstFile = args.inputFile
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
57 name1 = args.inputName1
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
58 secondFile = args.inputFile2
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
59 name2 = args.inputName2
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
60 thirdFile = args.inputFile3
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
61 name3 = args.inputName3
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
62 fourthFile = args.inputFile4
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
63 name4 = args.inputName4
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
64
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
65 title_file = args.output_csv
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
66 title_file2 = args.output_pdf
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
67 sep = args.sep
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
68
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
69 if type(sep) is not str or len(sep)>1:
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
70 print("Error: --sep must be a single character.")
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
71 exit(4)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
72
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
73 plt.rc('figure', figsize=(11.69, 8.27)) # A4 format
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
74 plt.rcParams['patch.edgecolor'] = "black"
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
75 plt.rcParams['axes.facecolor'] = "E0E0E0" # grey background color
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
76 plt.rcParams['xtick.labelsize'] = 12
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
77 plt.rcParams['ytick.labelsize'] = 12
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
78
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
79 list_to_plot = []
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
80 label = []
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
81 data_array_list = []
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
82
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
83 with open(title_file, "w") as output_file, PdfPages(title_file2) as pdf:
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
84 fig = plt.figure()
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
85 plt.subplots_adjust(bottom=0.25)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
86 if firstFile != str(None):
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
87 file1 = readFileReferenceFree(firstFile)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
88 integers = numpy.array(file1[:, 0]).astype(int) ## keep original family sizes
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
89
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
90 # for plot: replace all big family sizes by 22
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
91 data1 = numpy.array(file1[:, 0]).astype(int)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
92 bigFamilies = numpy.where(data1 > 20)[0]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
93 data1[bigFamilies] = 22
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
94
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
95 name1 = name1.split(".tabular")[0]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
96 list_to_plot.append(data1)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
97 label.append(name1)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
98 data_array_list.append(file1)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
99
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
100 legend = "\n\n\n{}".format(name1)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
101 plt.text(0.1, 0.11, legend, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
102 legend1 = "singletons:\nabsolute nr.\n{:,}".format(numpy.bincount(data1)[1])
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
103 plt.text(0.4, 0.11, legend1, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
104
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
105 legend3 = "rel. freq\n{:.3f}".format(float(numpy.bincount(data1)[1]) / len(data1))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
106 plt.text(0.5, 0.11, legend3, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
107
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
108 legend4 = "family size > 20:\nabsolute nr.\n{:,}".format(
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
109 numpy.bincount(data1)[len(numpy.bincount(data1)) - 1].astype(int))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
110 plt.text(0.6, 0.11, legend4, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
111
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
112 legend5 = "rel. freq\n{:.3f}".format(float(numpy.bincount(data1)[len(numpy.bincount(data1)) - 1]) / len(data1))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
113 plt.text(0.7, 0.11, legend5, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
114
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
115 legend6 = "total length\n{:,}".format(len(data1))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
116 plt.text(0.8, 0.11, legend6, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
117
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
118 if secondFile != str(None):
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
119 file2 = readFileReferenceFree(secondFile)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
120 data2 = numpy.asarray(file2[:, 0]).astype(int)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
121 bigFamilies2 = numpy.where(data2 > 20)[0]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
122 data2[bigFamilies2] = 22
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
123
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
124 list_to_plot.append(data2)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
125 name2 = name2.split(".tabular")[0]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
126 label.append(name2)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
127 data_array_list.append(file2)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
128
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
129 plt.text(0.1, 0.09, name2, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
130
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
131 legend1 = "{:,}".format(numpy.bincount(data2)[1])
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
132 plt.text(0.4, 0.09, legend1, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
133
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
134 legend3 = "{:.3f}".format(float(numpy.bincount(data2)[1]) / len(data2))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
135 plt.text(0.5, 0.09, legend3, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
136
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
137 legend4 = "{:,}".format(numpy.bincount(data2)[len(numpy.bincount(data2)) - 1].astype(int))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
138 plt.text(0.6, 0.09, legend4, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
139
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
140 legend5 = "{:.3f}".format(float(numpy.bincount(data2)[len(numpy.bincount(data2)) - 1]) / len(data2))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
141 plt.text(0.7, 0.09, legend5, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
142
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
143 legend6 = "{:,}".format(len(data2))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
144 plt.text(0.8, 0.09, legend6, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
145
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
146 if thirdFile != str(None):
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
147 file3 = readFileReferenceFree(thirdFile)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
148
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
149 data3 = numpy.asarray(file3[:, 0]).astype(int)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
150 bigFamilies3 = numpy.where(data3 > 20)[0]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
151 data3[bigFamilies3] = 22
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
152
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
153 list_to_plot.append(data3)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
154 name3 = name3.split(".tabular")[0]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
155 label.append(name3)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
156 data_array_list.append(file3)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
157
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
158 plt.text(0.1, 0.07, name3, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
159
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
160 legend1 = "{:,}".format(numpy.bincount(data3)[1])
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
161 plt.text(0.4, 0.07, legend1, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
162
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
163 legend3 = "{:.3f}".format(float(numpy.bincount(data3)[1]) / len(data3))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
164 plt.text(0.5, 0.07, legend3, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
165
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
166 legend4 = "{:,}".format(numpy.bincount(data3)[len(numpy.bincount(data3)) - 1].astype(int))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
167 plt.text(0.6, 0.07, legend4, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
168
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
169 legend5 = "{:.3f}".format(float(numpy.bincount(data3)[len(numpy.bincount(data3)) - 1]) / len(data3))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
170 plt.text(0.7, 0.07, legend5, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
171
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
172 legend6 = "{:,}".format(len(data3))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
173 plt.text(0.8, 0.07, legend6, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
174
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
175 if fourthFile != str(None):
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
176 file4 = readFileReferenceFree(fourthFile)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
177
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
178 data4 = numpy.asarray(file4[:, 0]).astype(int)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
179 bigFamilies4 = numpy.where(data4 > 20)[0]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
180 data4[bigFamilies4] = 22
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
181
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
182 list_to_plot.append(data4)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
183 name4 = name4.split(".tabular")[0]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
184 label.append(name4)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
185 data_array_list.append(file4)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
186
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
187 plt.text(0.1, 0.05, name4, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
188
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
189 legend1 = "{:,}".format(numpy.bincount(data4)[1])
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
190 plt.text(0.4, 0.05, legend1, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
191
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
192 legend4 = "{:.3f}".format(float(numpy.bincount(data4)[1]) / len(data4))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
193 plt.text(0.5, 0.05, legend4, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
194
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
195 legend4 = "{:,}".format(numpy.bincount(data4)[len(numpy.bincount(data4)) - 1].astype(int))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
196 plt.text(0.6, 0.05, legend4, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
197
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
198 legend5 = "{:.3f}".format(float(numpy.bincount(data4)[len(numpy.bincount(data4)) - 1]) / len(data4))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
199 plt.text(0.7, 0.05, legend5, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
200
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
201 legend6 = "{:,}".format(len(data4))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
202 plt.text(0.8, 0.05, legend6, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
203
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
204 maximumX = numpy.amax(numpy.concatenate(list_to_plot))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
205 minimumX = numpy.amin(numpy.concatenate(list_to_plot))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
206
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
207 counts = plt.hist(list_to_plot, bins=range(minimumX, maximumX + 1), stacked=False, edgecolor="black",
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
208 linewidth=1, label=label, align="left", alpha=0.7, rwidth=0.8)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
209
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
210 ticks = numpy.arange(minimumX - 1, maximumX, 1)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
211 ticks1 = map(str, ticks)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
212 ticks1[len(ticks1) - 1] = ">20"
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
213 plt.xticks(numpy.array(ticks), ticks1)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
214
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
215 plt.legend(loc='upper right', fontsize=14, frameon=True, bbox_to_anchor=(0.9, 1))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
216 plt.title("Family Size Distribution", fontsize=14)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
217 plt.xlabel("No. of Family Members", fontsize=14)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
218 plt.ylabel("Absolute Frequency", fontsize=14)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
219 plt.margins(0.01, None)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
220 plt.grid(b=True, which="major", color="#424242", linestyle=":")
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
221 pdf.savefig(fig)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
222 plt.close()
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
223
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
224 # write data to CSV file
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
225 output_file.write("Values from family size distribution with all datasets\n")
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
226 output_file.write("\nFamily size")
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
227 for i in label:
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
228 output_file.write("{}{}".format(sep, i))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
229 output_file.write("{}sum".format(sep))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
230 output_file.write("\n")
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
231 j = 0
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
232 for fs in counts[1][0:len(counts[1]) - 1]:
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
233 if fs == 21:
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
234 fs = ">20"
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
235 else:
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
236 fs = "={}".format(fs)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
237 output_file.write("FS{}{}".format(fs, sep))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
238 values_of_fs = []
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
239 if len(label) == 1:
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
240 output_file.write("{}{}".format(int(counts[0][j]), sep))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
241 values_of_fs.append(int(counts[0][j]))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
242 else:
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
243 for n in range(len(label)):
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
244 output_file.write("{}{}".format(int(counts[0][n][j]), sep))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
245 values_of_fs.append(int(counts[0][n][j]))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
246 output_file.write("{}\n".format(sum(values_of_fs)))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
247 j += 1
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
248 output_file.write("sum{}".format(sep))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
249 values_for_sum = []
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
250 if len(label) == 1:
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
251 output_file.write("{}{}".format(int(sum(counts[0])), sep))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
252 values_for_sum.append(int(sum(counts[0])))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
253 else:
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
254 for i in counts[0]:
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
255 output_file.write("{}{}".format(int(sum(i)), sep))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
256 values_for_sum.append(int(sum(i)))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
257
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
258 output_file.write("{}\n".format(sum(values_for_sum)))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
259
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
260 ### Family size distribution after DCS and SSCS
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
261 for dataset, data, name_file in zip(list_to_plot, data_array_list, label):
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
262 maximumX = numpy.amax(dataset)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
263 minimumX = numpy.amin(dataset)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
264
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
265 tags = numpy.array(data[:, 2])
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
266 seq = numpy.array(data[:, 1])
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
267 data = numpy.array(dataset)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
268
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
269 # find all unique tags and get the indices for ALL tags, but only once
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
270 u, index_unique, c = numpy.unique(numpy.array(seq), return_counts=True, return_index=True)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
271 d = u[c > 1]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
272
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
273 # get family sizes, tag for duplicates
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
274 duplTags_double = data[numpy.in1d(seq, d)]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
275 duplTags = duplTags_double[0::2] # ab of DCS
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
276 duplTagsBA = duplTags_double[1::2] # ba of DCS
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
277
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
278 duplTags_double_tag = tags[numpy.in1d(seq, d)]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
279 duplTags_double_seq = seq[numpy.in1d(seq, d)]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
280
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
281 # get family sizes for SSCS with no partner
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
282 ab = numpy.where(tags == "ab")[0]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
283 abSeq = seq[ab]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
284 ab = data[ab]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
285 ba = numpy.where(tags == "ba")[0]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
286 baSeq = seq[ba]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
287 ba = data[ba]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
288
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
289 dataAB = ab[numpy.in1d(abSeq, d, invert=True)]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
290 dataBA = ba[numpy.in1d(baSeq, d, invert=True)]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
291
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
292 # write DCS tags to file
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
293 # with open("DCS information_{}.txt".format(firstFile), "w") as file:
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
294 # for t, s, f in zip(duplTags_double_tag, duplTags_double_seq, duplTags_double):
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
295 # file.write("{}\t{}\t{}\n".format(t, s, f))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
296
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
297 list1 = [duplTags_double, dataAB, dataBA] # list for plotting
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
298
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
299 ## information for family size >= 3
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
300 dataAB_FS3 = dataAB[dataAB >= 3]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
301 dataBA_FS3 = dataBA[dataBA >= 3]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
302 ab_FS3 = ab[ab >= 3]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
303 ba_FS3 = ba[ba >= 3]
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
304
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
305 duplTags_FS3 = duplTags[(duplTags >= 3) & (duplTagsBA >= 3)] # ab+ba with FS>=3
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
306 duplTags_FS3_BA = duplTagsBA[(duplTags >= 3) & (duplTagsBA >= 3)] # ba+ab with FS>=3
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
307 duplTags_double_FS3 = len(duplTags_FS3)+len(duplTags_FS3_BA) # both ab and ba strands with FS>=3
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
308
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
309 fig = plt.figure()
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
310
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
311 plt.subplots_adjust(bottom=0.3)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
312 counts = plt.hist(list1, bins=range(minimumX, maximumX + 1), stacked=True,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
313 label=["duplex", "ab", "ba"], edgecolor="black", linewidth=1,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
314 align="left", color=["#FF0000", "#5FB404", "#FFBF00"])
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
315 # tick labels of x axis
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
316 ticks = numpy.arange(minimumX - 1, maximumX, 1)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
317 ticks1 = map(str, ticks)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
318 ticks1[len(ticks1) - 1] = ">20"
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
319 plt.xticks(numpy.array(ticks), ticks1)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
320 singl = counts[0][2][0] # singletons
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
321 last = counts[0][2][len(counts[0][0]) - 1] # large families
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
322
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
323 plt.legend(loc='upper right', fontsize=14, bbox_to_anchor=(0.9, 1), frameon=True)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
324 plt.title(name1, fontsize=14)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
325 plt.xlabel("No. of Family Members", fontsize=14)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
326 plt.ylabel("Absolute Frequency", fontsize=14)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
327 plt.margins(0.01, None)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
328 plt.grid(b=True, which="major", color="#424242", linestyle=":")
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
329
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
330 ## extra information beneath the plot
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
331 legend = "SSCS ab= \nSSCS ba= \nDCS (total)= \nlength of dataset="
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
332 plt.text(0.1, 0.09, legend, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
333
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
334 legend = "absolute numbers\n\n{:,}\n{:,}\n{:,} ({:,})\n{:,}" \
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
335 .format(len(dataAB), len(dataBA), len(duplTags), len(duplTags_double),
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
336 (len(dataAB) + len(dataBA) + len(duplTags)))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
337 plt.text(0.35, 0.09, legend, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
338
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
339 legend = "relative frequencies\nunique\n{:.3f}\n{:.3f}\n{:.3f}\n{:,}" \
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
340 .format(float(len(dataAB)) / (len(dataAB) + len(dataBA) + len(duplTags)),
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
341 float(len(dataBA)) / (len(dataAB) + len(dataBA) + len(duplTags)),
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
342 float(len(duplTags)) / (len(dataAB) + len(dataBA) + len(duplTags)),
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
343 (len(dataAB) + len(dataBA) + len(duplTags)))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
344 plt.text(0.54, 0.09, legend, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
345
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
346 legend = "total\n{:.3f}\n{:.3f}\n{:.3f} ({:.3f})\n{:,}" \
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
347 .format(float(len(dataAB)) / (len(ab) + len(ba)), float(len(dataBA)) / (len(ab) + len(ba)),
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
348 float(len(duplTags)) / (len(ab) + len(ba)),
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
349 float(len(duplTags_double)) / (len(ab) + len(ba)), (len(ab) + len(ba)))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
350 plt.text(0.64, 0.09, legend, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
351
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
352 legend1 = "\nsingletons:\nfamily size > 20:"
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
353 plt.text(0.1, 0.03, legend1, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
354
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
355 legend4 = "{:,}\n{:,}".format(singl.astype(int), last.astype(int))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
356 plt.text(0.35, 0.03, legend4, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
357
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
358 legend3 = "{:.3f}\n{:.3f}".format(singl / len(data),last / len(data))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
359 plt.text(0.54, 0.03, legend3, size=12, transform=plt.gcf().transFigure)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
360
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
361 pdf.savefig(fig)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
362 plt.close()
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
363
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
364 # write same information to a csv file
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
365 count = numpy.bincount(integers) # original counts of family sizes
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
366 output_file.write("\nDataset:{}{}\n".format(sep, name_file))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
367 output_file.write("max. family size:{}{}\n".format(sep, max(integers)))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
368 output_file.write("absolute frequency:{}{}\n".format(sep, count[len(count) - 1]))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
369 output_file.write("relative frequency:{}{:.3f}\n\n".format(sep, float(count[len(count) - 1]) / sum(count)))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
370
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
371 output_file.write("{}singletons:{}{}family size > 20:\n".format(sep, sep, sep))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
372 output_file.write(
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
373 "{}absolute nr.{}rel. freq{}absolute nr.{}rel. freq{}total length\n".format(sep, sep, sep, sep, sep))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
374 output_file.write("{}{}{}{}{:.3f}{}{}{}{:.3f}{}{}\n\n".format(name_file, sep, singl.astype(int), sep,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
375 singl / len(data), sep,last.astype(int), sep,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
376 last / len(data), sep, len(data)))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
377
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
378 ## information for FS >= 1
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
379 output_file.write(
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
380 "The unique frequencies were calculated from the dataset where the tags occured only once (=ab without DCS, ba without DCS)\n" \
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
381 "Whereas the total frequencies were calculated from the whole dataset (=including the DCS).\n\n")
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
382 output_file.write("FS >= 1{}{}unique:{}total:\n".format(sep, sep, sep))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
383 output_file.write("nr./rel. freq of ab={}{}{}{:.3f}{}{:.3f}\n".format(sep, len(dataAB), sep,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
384 float(len(dataAB)) / (len(dataAB) + len(dataBA) + len( duplTags)), sep,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
385 float(len(dataAB)) / (len(ab) + len(ba))))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
386 output_file.write("nr./rel. freq of ba={}{}{}{:.3f}{}{:.3f}\n".format(sep, len(dataBA), sep,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
387 float(len(dataBA)) / (len(dataBA) + len(dataBA) + len(duplTags)), sep,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
388 float(len(dataBA)) / (len(ba) + len(ba))))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
389 output_file.write(
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
390 "nr./rel. freq of DCS (total)={}{} ({}){}{:.3f}{}{:.3f} ({:.3f})\n".format(sep, len(duplTags), len(duplTags_double), sep,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
391 float(len(duplTags)) / ( len(dataAB) + len( dataBA) + len(duplTags)),
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
392 sep, float(len(duplTags)) / ( len(ab) + len(ba)),
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
393 float( len(duplTags_double)) / (len(ab) + len(ba))))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
394 output_file.write(
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
395 "length of dataset={}{}{}{}{}{}\n".format(sep, (len(dataAB) + len(dataBA) + len(duplTags)), sep,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
396 (len(dataAB) + len(dataBA) + len(duplTags)), sep,(len(ab) + len(ba))))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
397 ## information for FS >= 3
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
398 output_file.write("FS >= 3{}{}unique:{}total:\n".format(sep, sep, sep))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
399 output_file.write("nr./rel. freq of ab={}{}{}{:.3f}{}{:.3f}\n".format(sep, len(dataAB_FS3), sep,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
400 float(len(dataAB_FS3)) / (len(dataAB_FS3) + len(dataBA_FS3) + len(duplTags_FS3)),
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
401 sep, float(len(dataAB_FS3)) / ( len(ab_FS3) + len(ba_FS3))))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
402 output_file.write("nr./rel. freq of ba={}{}{}{:.3f}{}{:.3f}\n".format(sep, len(dataBA_FS3), sep,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
403 float(len(dataBA_FS3)) / ( len(dataBA_FS3) + len(dataBA_FS3) + len(duplTags_FS3)),
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
404 sep,float(len(dataBA_FS3)) / (len(ba_FS3) + len(ba_FS3))))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
405 output_file.write(
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
406 "nr./rel. freq of DCS (total)={}{} ({}){}{:.3f}{}{:.3f} ({:.3f})\n".format(sep, len(duplTags_FS3),duplTags_double_FS3,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
407 sep, float(len( duplTags_FS3)) / (len(dataBA_FS3) + len(duplTags_FS3)),
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
408 sep, float(len(duplTags_FS3)) / (len(ab_FS3) + len(ba_FS3)),
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
409 float(duplTags_double_FS3) / (len(ab_FS3) + len(ba_FS3))))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
410 output_file.write(
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
411 "length of dataset={}{}{}{}{}{}\n".format(sep, (len(dataAB_FS3) + len(dataBA_FS3) + len(duplTags_FS3)), sep,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
412 (len(dataAB_FS3) + len(dataBA_FS3) + len(duplTags_FS3)), sep,
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
413 (len(ab_FS3) + len(ba_FS3))))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
414
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
415 output_file.write("\nValues from family size distribution\n")
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
416 output_file.write("{}duplex{}ab{}ba{}sum\n".format(sep, sep, sep, sep))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
417 for dx, ab, ba, fs in zip(counts[0][0], counts[0][1], counts[0][2], counts[1]):
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
418 if fs == 21:
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
419 fs = ">20"
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
420 else:
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
421 fs = "={}".format(fs)
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
422 ab1 = ab - dx
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
423 ba1 = ba - ab
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
424 output_file.write(
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
425 "FS{}{}{}{}{}{}{}{}{}\n".format(fs, sep, int(dx), sep, int(ab1), sep, int(ba1), sep, int(ba)))
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
426
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
427 print("Files successfully created!")
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
428
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
429 if __name__ == '__main__':
9736b9d04a0b planemo upload for repository https://github.com/monikaheinzl/galaxyProject/tree/master/tools/fsd commit f674213e798956531c935e7b9eb7f444286d0a5e-dirty
mheinzl
parents:
diff changeset
430 sys.exit(compare_read_families(sys.argv))