annotate fsd.py @ 46:901827154779 draft

planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
author mheinzl
date Tue, 27 Aug 2019 07:51:03 -0400
parents 6651e76baca1
children 1ed4a127c41a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
1 #!/usr/bin/env python
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
2
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
3 # Family size distribution of SSCSs
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
4 #
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
5 # Author: Monika Heinzl, Johannes-Kepler University Linz (Austria)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
6 # Contact: monika.heinzl@edumail.at
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
7 #
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
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.
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
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
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
10 # a tabular file with the data of the plot, as well as a TXT file with all tags of the DCS and their family sizes.
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
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.
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
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.
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
13
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
14 # USAGE: python FSD_Galaxy_1.4_commandLine_FINAL.py --inputFile1 filename --inputName1 filename --inputFile2 filename2 --inputName2 filename2 --inputFile3 filename3 --inputName3 filename3 --inputFile4 filename4 --inputName4 filename4 --log_axis --output_tabular outptufile_name_tabular --output_pdf outptufile_name_pdf
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
15
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
16 import argparse
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
17 import sys
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
18 import os
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
19
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
20 import matplotlib.pyplot as plt
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
21 import numpy
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
22 from matplotlib.backends.backend_pdf import PdfPages
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
23
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
24 plt.switch_backend('agg')
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
25
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
26
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
27 def readFileReferenceFree(file):
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
28 with open(file, 'r') as dest_f:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
29 data_array = numpy.genfromtxt(dest_f, skip_header=0, delimiter='\t', comments='#', dtype='string')
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
30 return(data_array)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
31
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
32
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
33 def make_argparser():
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
34 parser = argparse.ArgumentParser(description='Family Size Distribution of duplex sequencing data')
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
35 parser.add_argument('--inputFile1', help='Tabular File with three columns: ab or ba, tag and family size.')
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
36 parser.add_argument('--inputName1')
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
37 parser.add_argument('--inputFile2', default=None, help='Tabular File with three columns: ab or ba, tag and family size.')
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
38 parser.add_argument('--inputName2')
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
39 parser.add_argument('--inputFile3', default=None, help='Tabular File with three columns: ab or ba, tag and family size.')
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
40 parser.add_argument('--inputName3')
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
41 parser.add_argument('--inputFile4', default=None, help='Tabular File with three columns: ab or ba, tag and family size.')
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
42 parser.add_argument('--inputName4')
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
43 parser.add_argument('--log_axis', action="store_false", help='Transform y axis in log scale.')
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
44 parser.add_argument('--rel_freq', action="store_false", help='If False, the relative frequencies are displayed.')
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
45 parser.add_argument('--output_pdf', default="data.pdf", type=str, help='Name of the pdf file.')
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
46 parser.add_argument('--output_tabular', default="data.tabular", type=str, help='Name of the tabular file.')
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
47 return parser
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
48
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
49
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
50 def compare_read_families(argv):
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
51
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
52 parser = make_argparser()
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
53 args = parser.parse_args(argv[1:])
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
54
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
55 firstFile = args.inputFile1
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
56 name1 = args.inputName1
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
57
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
58 secondFile = args.inputFile2
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
59 name2 = args.inputName2
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
60 thirdFile = args.inputFile3
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
61 name3 = args.inputName3
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
62 fourthFile = args.inputFile4
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
63 name4 = args.inputName4
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
64 log_axis = args.log_axis
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
65 rel_freq = args.rel_freq
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
66
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
67 title_file = args.output_tabular
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
68 title_file2 = args.output_pdf
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
69
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
70 sep = "\t"
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
71
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
72 plt.rc('figure', figsize=(11.69, 8.27)) # A4 format
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
73 plt.rcParams['patch.edgecolor'] = "black"
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
74 plt.rcParams['axes.facecolor'] = "E0E0E0" # grey background color
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
75 plt.rcParams['xtick.labelsize'] = 14
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
76 plt.rcParams['ytick.labelsize'] = 14
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
77
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
78 list_to_plot = []
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
79 label = []
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
80 data_array_list = []
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
81 list_to_plot_original = []
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
82 colors = []
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
83 bins = numpy.arange(1, 22)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
84 with open(title_file, "w") as output_file, PdfPages(title_file2) as pdf:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
85 fig = plt.figure()
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
86 fig.subplots_adjust(left=0.12, right=0.97, bottom=0.23, top=0.94, hspace=0)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
87 fig2 = plt.figure()
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
88 fig2.subplots_adjust(left=0.12, right=0.97, bottom=0.23, top=0.94, hspace=0)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
89
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
90 # plt.subplots_adjust(bottom=0.25)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
91 if firstFile != str(None):
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
92 file1 = readFileReferenceFree(firstFile)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
93 integers = numpy.array(file1[:, 0]).astype(int) # keep original family sizes
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
94 list_to_plot_original.append(integers)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
95 colors.append("#0000FF")
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
96
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
97 # for plot: replace all big family sizes by 22
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
98 # data1 = numpy.array(file1[:, 0]).astype(int)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
99 # bigFamilies = numpy.where(data1 > 20)[0]
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
100 # data1[bigFamilies] = 22
20
64f0362c974e planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 19
diff changeset
101 data1 = numpy.clip(integers, bins[0], bins[-1])
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
102 name1 = name1.split(".tabular")[0]
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
103 if len(name1) > 40:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
104 name1 = name1[:40]
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
105 list_to_plot.append(data1)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
106 label.append(name1)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
107 data_array_list.append(file1)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
108
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
109 legend = "\n\n\n{}".format(name1)
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
110 fig.text(0.05, 0.11, legend, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
111 fig2.text(0.05, 0.11, legend, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
112
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
113 legend1 = "singletons:\nnr. of tags\n{:,} ({:.3f})".format(numpy.bincount(data1)[1],
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
114 float(numpy.bincount(data1)[1]) / len(data1))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
115 fig.text(0.32, 0.11, legend1, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
116 fig2.text(0.32, 0.11, legend1, size=10, transform=plt.gcf().transFigure)
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
117
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
118 legend3b = "PE reads\n{:,} ({:.3f})".format(numpy.bincount(data1)[1],
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
119 float(numpy.bincount(data1)[1]) / sum(integers))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
120 fig.text(0.45, 0.11, legend3b, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
121 fig2.text(0.45, 0.11, legend3b, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
122
41
54f0dac1c834 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 39
diff changeset
123 legend4 = "family size > 20:\nnr. of tags\n{:,} ({:.3f})".format(len(integers[integers > 20]),
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
124 float(len(integers[integers > 20]))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
125 / len(integers))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
126 fig.text(0.58, 0.11, legend4, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
127 fig2.text(0.58, 0.11, legend4, size=10, transform=plt.gcf().transFigure)
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
128
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
129 legend5 = "PE reads\n{:,} ({:.3f})".format(sum(integers[integers > 20]),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
130 float(sum(integers[integers > 20])) / sum(integers))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
131 fig.text(0.70, 0.11, legend5, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
132 fig2.text(0.70, 0.11, legend5, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
133
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
134 legend6 = "total nr. of\ntags\n{:,}".format(len(data1))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
135 fig.text(0.82, 0.11, legend6, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
136 fig2.text(0.82, 0.11, legend6, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
137
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
138 legend6b = "PE reads\n{:,}".format(sum(integers))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
139 fig.text(0.89, 0.11, legend6b, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
140 fig2.text(0.89, 0.11, legend6b, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
141
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
142 if secondFile != str(None):
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
143 file2 = readFileReferenceFree(secondFile)
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
144 integers2 = numpy.array(file2[:, 0]).astype(int) # keep original family sizes
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
145 list_to_plot_original.append(integers2)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
146 colors.append("#298A08")
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
147
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
148 # data2 = numpy.asarray(file2[:, 0]).astype(int)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
149 # bigFamilies2 = numpy.where(data2 > 20)[0]
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
150 # data2[bigFamilies2] = 22
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
151
20
64f0362c974e planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 19
diff changeset
152 data2 = numpy.clip(integers2, bins[0], bins[-1])
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
153 list_to_plot.append(data2)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
154 name2 = name2.split(".tabular")[0]
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
155 if len(name2) > 40:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
156 name2 = name2[:40]
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
157 label.append(name2)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
158 data_array_list.append(file2)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
159
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
160 fig.text(0.05, 0.09, name2, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
161 fig2.text(0.05, 0.09, name2, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
162
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
163 legend1 = "{:,} ({:.3f})".format(numpy.bincount(data2)[1], float(numpy.bincount(data2)[1]) / len(data2))
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
164 fig.text(0.32, 0.09, legend1, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
165 fig2.text(0.32, 0.09, legend1, size=10, transform=plt.gcf().transFigure)
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
166
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
167 legend3 = "{:,} ({:.3f})".format(numpy.bincount(data2)[1], float(numpy.bincount(data2)[1]) / sum(integers2))
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
168 fig.text(0.45, 0.09, legend3, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
169 fig2.text(0.45, 0.09, legend3, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
170
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
171 legend4 = "{:,} ({:.3f})".format(len(integers2[integers2 > 20]),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
172 float(len(integers2[integers2 > 20])) / len(integers2))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
173 fig.text(0.58, 0.09, legend4, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
174 fig2.text(0.58, 0.09, legend4, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
175
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
176 legend5 = "{:,} ({:.3f})".format(sum(integers2[integers2 > 20]),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
177 float(sum(integers2[integers2 > 20])) / sum(integers2))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
178 fig.text(0.70, 0.09, legend5, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
179 fig2.text(0.70, 0.09, legend5, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
180
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
181 legend6 = "{:,}".format(len(data2))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
182 fig.text(0.82, 0.09, legend6, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
183 fig2.text(0.82, 0.09, legend6, size=10, transform=plt.gcf().transFigure)
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
184
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
185 legend6b = "{:,}".format(sum(integers2))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
186 fig.text(0.89, 0.09, legend6b, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
187 fig2.text(0.89, 0.09, legend6b, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
188
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
189 if thirdFile != str(None):
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
190 file3 = readFileReferenceFree(thirdFile)
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
191 integers3 = numpy.array(file3[:, 0]).astype(int) # keep original family sizes
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
192 list_to_plot_original.append(integers3)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
193 colors.append("#DF0101")
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
194
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
195 # data3 = numpy.asarray(file3[:, 0]).astype(int)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
196 # bigFamilies3 = numpy.where(data3 > 20)[0]
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
197 # data3[bigFamilies3] = 22
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
198
20
64f0362c974e planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 19
diff changeset
199 data3 = numpy.clip(integers3, bins[0], bins[-1])
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
200 list_to_plot.append(data3)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
201 name3 = name3.split(".tabular")[0]
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
202 if len(name3) > 40:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
203 name3 = name3[:40]
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
204 label.append(name3)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
205 data_array_list.append(file3)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
206
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
207 fig.text(0.05, 0.07, name3, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
208 fig2.text(0.05, 0.07, name3, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
209
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
210 legend1 = "{:,} ({:.3f})".format(numpy.bincount(data3)[1], float(numpy.bincount(data3)[1]) / len(data3))
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
211 fig.text(0.32, 0.07, legend1, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
212 fig2.text(0.32, 0.07, legend1, size=10, transform=plt.gcf().transFigure)
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
213
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
214 legend3b = "{:,} ({:.3f})".format(numpy.bincount(data3)[1],
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
215 float(numpy.bincount(data3)[1]) / sum(integers3))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
216 fig.text(0.45, 0.07, legend3b, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
217 fig2.text(0.45, 0.07, legend3b, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
218
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
219 legend4 = "{:,} ({:.3f})".format(len(integers3[integers3 > 20]),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
220 float(len(integers3[integers3 > 20])) / len(integers3))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
221 fig.text(0.58, 0.07, legend4, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
222 fig2.text(0.58, 0.07, legend4, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
223
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
224 legend5 = "{:,} ({:.3f})".format(sum(integers3[integers3 > 20]),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
225 float(sum(integers3[integers3 > 20])) / sum(integers3))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
226 fig.text(0.70, 0.07, legend5, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
227 fig2.text(0.70, 0.07, legend5, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
228
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
229 legend6 = "{:,}".format(len(data3))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
230 fig.text(0.82, 0.07, legend6, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
231 fig2.text(0.82, 0.07, legend6, size=10, transform=plt.gcf().transFigure)
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
232
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
233 legend6b = "{:,}".format(sum(integers3))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
234 fig.text(0.89, 0.07, legend6b, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
235 fig2.text(0.89, 0.07, legend6b, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
236
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
237 if fourthFile != str(None):
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
238 file4 = readFileReferenceFree(fourthFile)
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
239 integers4 = numpy.array(file4[:, 0]).astype(int) # keep original family sizes
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
240 list_to_plot_original.append(integers4)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
241 colors.append("#04cec7")
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
242
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
243 # data4 = numpy.asarray(file4[:, 0]).astype(int)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
244 # bigFamilies4 = numpy.where(data4 > 20)[0]
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
245 # data4[bigFamilies4] = 22
20
64f0362c974e planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 19
diff changeset
246 data4 = numpy.clip(integers4, bins[0], bins[-1])
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
247 list_to_plot.append(data4)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
248 name4 = name4.split(".tabular")[0]
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
249 if len(name4) > 40:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
250 name4 = name4[:40]
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
251 label.append(name4)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
252 data_array_list.append(file4)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
253
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
254 fig.text(0.05, 0.05, name4, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
255 fig2.text(0.05, 0.05, name4, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
256
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
257 legend1 = "{:,} ({:.3f})".format(numpy.bincount(data4)[1], float(numpy.bincount(data4)[1]) / len(data4))
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
258 fig.text(0.32, 0.05, legend1, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
259 fig2.text(0.32, 0.05, legend1, size=10, transform=plt.gcf().transFigure)
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
260
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
261 legend3b = "{:,} ({:.3f})".format(numpy.bincount(data4)[1],
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
262 float(numpy.bincount(data4)[1]) / sum(integers4))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
263 fig.text(0.45, 0.05, legend3b, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
264 fig2.text(0.45, 0.05, legend3b, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
265
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
266 legend4 = "{:,} ({:.3f})".format(len(integers4[integers4 > 20]),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
267 float(len(integers4[integers4 > 20])) / len(integers4))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
268 fig.text(0.58, 0.05, legend4, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
269 fig2.text(0.58, 0.05, legend4, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
270
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
271 legend5 = "{:,} ({:.3f})".format(sum(integers4[integers4 > 20]),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
272 float(sum(integers4[integers4 > 20])) / sum(integers4))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
273 fig.text(0.70, 0.05, legend5, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
274 fig2.text(0.70, 0.05, legend5, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
275
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
276 legend6 = "{:,}".format(len(data4))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
277 fig.text(0.82, 0.05, legend6, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
278 fig2.text(0.82, 0.05, legend6, size=10, transform=plt.gcf().transFigure)
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
279
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
280 legend6b = "{:,}".format(sum(integers4))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
281 fig.text(0.89, 0.05, legend6b, size=10, transform=plt.gcf().transFigure)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
282 fig2.text(0.89, 0.05, legend6b, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
283
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
284 maximumX = numpy.amax(numpy.concatenate(list_to_plot))
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
285 minimumX = numpy.amin(numpy.concatenate(list_to_plot))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
286 list_to_plot2 = list_to_plot
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
287
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
288 if rel_freq:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
289 ylab = "Relative Frequency"
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
290 else:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
291 ylab = "Absolute Frequency"
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
292
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
293 # PLOT FSD based on tags
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
294 fig.suptitle('Family Size Distribution (FSD) based on families', fontsize=14)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
295 ax = fig.add_subplot(1, 1, 1)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
296 ticks = numpy.arange(1, 22, 1)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
297 ticks1 = map(str, ticks)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
298 ticks1[len(ticks1) - 1] = ">20"
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
299 ax.set_xticks([], [])
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
300 if rel_freq:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
301 w = [numpy.zeros_like(data) + 1. / len(data) for data in list_to_plot2]
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
302 counts = ax.hist(list_to_plot2, weights=w,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
303 bins=numpy.arange(1, 23), stacked=False, edgecolor="black", color=colors,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
304 linewidth=1, label=label, align="left", alpha=0.7, rwidth=0.8)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
305 ax.set_ylim(0, 1.07)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
306 else:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
307 counts = ax.hist(list_to_plot2, bins=numpy.arange(1, 23), stacked=False, edgecolor="black", linewidth=1,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
308 label=label, align="left", alpha=0.7, rwidth=0.8, color=colors)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
309 ax.set_xticks(numpy.array(ticks))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
310 ax.set_xticklabels(ticks1)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
311 ax.legend(loc='upper right', fontsize=14, frameon=True, bbox_to_anchor=(0.9, 1))
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
312
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
313 ax.set_ylabel(ylab, fontsize=14)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
314 ax.set_xlabel("Family size", fontsize=14)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
315 if log_axis:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
316 ax.set_yscale('log')
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
317 ax.grid(b=True, which="major", color="#424242", linestyle=":")
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
318 ax.margins(0.01, None)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
319 pdf.savefig(fig)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
320 #plt.close()
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
321
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
322 # PLOT FSD based on PE reads
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
323 fig2.suptitle('Family Size Distribution (FSD) based on PE reads', fontsize=14)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
324 ax2 = fig2.add_subplot(1, 1, 1)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
325 ticks = numpy.arange(1, 22)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
326 ticks1 = map(str, ticks)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
327 ticks1[len(ticks1) - 1] = ">20"
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
328 reads = []
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
329 reads_rel = []
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
330
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
331 barWidth = 0 - (len(list_to_plot) + 1) / 2 * 1. / (len(list_to_plot) + 1)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
332 ax2.set_xticks([], [])
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
333
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
334 for i in range(len(list_to_plot2)):
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
335 x = list(numpy.arange(1, 22).astype(float))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
336 unique, c = numpy.unique(list_to_plot2[i], return_counts=True)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
337 y = unique * c
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
338 if sum(list_to_plot_original[i] > 20) > 0:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
339 y[len(y) - 1] = sum(list_to_plot_original[i][list_to_plot_original[i] > 20])
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
340 y = [y[x[idx] == unique][0] if x[idx] in unique else 0 for idx in range(len(x))]
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
341 reads.append(y)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
342 reads_rel.append(list(numpy.float_(y)) / sum(y))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
343
22
5e650e66e058 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 21
diff changeset
344 if len(list_to_plot2) == 1:
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
345 x = [xi * 0.5 for xi in x]
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
346 w = 0.4
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
347 else:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
348 x = [xi + barWidth for xi in x]
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
349 w = 1. / (len(list_to_plot) + 1)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
350 if rel_freq:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
351 counts2_rel = ax2.bar(x, list(numpy.float_(y)) / numpy.sum(y), align="edge", width=w,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
352 edgecolor="black", label=label[i], linewidth=1, alpha=0.7, color=colors[i])
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
353 ax2.set_ylim(0, 1.07)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
354 else:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
355 counts2 = ax2.bar(x, y, align="edge", width=w, edgecolor="black", label=label[i], linewidth=1,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
356 alpha=0.7, color=colors[i])
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
357
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
358 if i == len(list_to_plot2) - 1:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
359 barWidth += 1. / (len(list_to_plot) + 1) + 1. / (len(list_to_plot) + 1)
22
5e650e66e058 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 21
diff changeset
360 else:
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
361 barWidth += 1. / (len(list_to_plot) + 1)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
362
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
363 ax2.legend(loc='upper right', fontsize=14, frameon=True, bbox_to_anchor=(0.9, 1))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
364
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
365 if len(list_to_plot2) == 1:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
366 ax2.set_xticks(numpy.array([xi + 0.2 for xi in x]))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
367 else:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
368 ax2.set_xticks(numpy.array(ticks))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
369 ax2.set_xticklabels(ticks1)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
370 ax2.set_xlabel("Family size", fontsize=14)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
371 ax2.set_ylabel(ylab, fontsize=14)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
372 if log_axis:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
373 ax2.set_yscale('log')
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
374 ax2.grid(b=True, which="major", color="#424242", linestyle=":")
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
375 ax2.margins(0.01, None)
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
376
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
377 pdf.savefig(fig2)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
378 plt.close()
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
379
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
380 # write data to CSV file tags
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
381 counts = [numpy.bincount(d, minlength=22)[1:] for d in list_to_plot2] # original counts of family sizes
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
382 output_file.write("Values from family size distribution with all datasets based on families\n")
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
383 output_file.write("\nFamily size")
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
384 for i in label:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
385 output_file.write("{}{}".format(sep, i))
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
386 output_file.write("\n")
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
387 j = 0
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
388 for fs in bins:
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
389 if fs == 21:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
390 fs = ">20"
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
391 else:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
392 fs = "={}".format(fs)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
393 output_file.write("FS{}{}".format(fs, sep))
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
394 for n in range(len(label)):
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
395 output_file.write("{}{}".format(int(counts[n][j]), sep))
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
396 output_file.write("\n")
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
397 j += 1
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
398 output_file.write("sum{}".format(sep))
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
399 for i in counts:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
400 output_file.write("{}{}".format(int(sum(i)), sep))
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
401
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
402 # write data to CSV file PE reads
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
403 output_file.write("\n\nValues from family size distribution with all datasets based on PE reads\n")
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
404 output_file.write("\nFamily size")
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
405 for i in label:
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
406 output_file.write("{}{}".format(sep, i))
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
407 output_file.write("\n")
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
408 j = 0
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
409
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
410 for fs in bins:
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
411 if fs == 21:
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
412 fs = ">20"
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
413 else:
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
414 fs = "={}".format(fs)
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
415 output_file.write("FS{}{}".format(fs, sep))
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
416 if len(label) == 1:
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
417 output_file.write("{}{}".format(int(reads[0][j]), sep))
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
418 else:
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
419 for n in range(len(label)):
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
420 output_file.write("{}{}".format(int(reads[n][j]), sep))
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
421 output_file.write("\n")
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
422 j += 1
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
423 output_file.write("sum{}".format(sep))
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
424 if len(label) == 1:
22
5e650e66e058 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 21
diff changeset
425 output_file.write("{}{}".format(int(sum(numpy.concatenate(reads))), sep))
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
426 else:
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
427 for i in reads:
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
428 output_file.write("{}{}".format(int(sum(i)), sep))
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
429 output_file.write("\n")
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
430
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
431 # Family size distribution after DCS and SSCS
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
432 for dataset, data_o, name_file in zip(list_to_plot, data_array_list, label):
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
433 maximumX = numpy.amax(dataset)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
434 minimumX = numpy.amin(dataset)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
435
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
436 tags = numpy.array(data_o[:, 2])
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
437 seq = numpy.array(data_o[:, 1])
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
438 data = numpy.array(dataset)
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
439 data_o = numpy.array(data_o[:, 0]).astype(int)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
440 # find all unique tags and get the indices for ALL tags, but only once
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
441 u, index_unique, c = numpy.unique(numpy.array(seq), return_counts=True, return_index=True)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
442 d = u[c > 1]
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
443
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
444 # get family sizes, tag for duplicates
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
445 duplTags_double = data[numpy.in1d(seq, d)]
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
446 duplTags_double_o = data_o[numpy.in1d(seq, d)]
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
447
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
448 duplTags = duplTags_double[0::2] # ab of DCS
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
449 duplTags_o = duplTags_double_o[0::2] # ab of DCS
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
450
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
451 duplTagsBA = duplTags_double[1::2] # ba of DCS
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
452 duplTagsBA_o = duplTags_double_o[1::2] # ba of DCS
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
453
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
454 # duplTags_double_tag = tags[numpy.in1d(seq, d)]
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
455 # duplTags_double_seq = seq[numpy.in1d(seq, d)]
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
456
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
457 # get family sizes for SSCS with no partner
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
458 ab = numpy.where(tags == "ab")[0]
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
459 abSeq = seq[ab]
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
460 ab_o = data_o[ab]
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
461 ab = data[ab]
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
462
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
463 ba = numpy.where(tags == "ba")[0]
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
464 baSeq = seq[ba]
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
465 ba_o = data_o[ba]
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
466 ba = data[ba]
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
467
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
468 dataAB = ab[numpy.in1d(abSeq, d, invert=True)]
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
469 dataAB_o = ab_o[numpy.in1d(abSeq, d, invert=True)]
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
470
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
471 dataBA = ba[numpy.in1d(baSeq, d, invert=True)]
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
472 dataBA_o = ba_o[numpy.in1d(baSeq, d, invert=True)]
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
473
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
474 list1 = [duplTags_double, dataAB, dataBA] # list for plotting
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
475 list1_o = [duplTags_double_o, dataAB_o, dataBA_o] # list for plotting
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
476
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
477 # information for family size >= 3
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
478 dataAB_FS3 = dataAB[dataAB >= 3]
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
479 dataAB_FS3_o = dataAB_o[dataAB_o >= 3]
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
480 dataBA_FS3 = dataBA[dataBA >= 3]
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
481 dataBA_FS3_o = dataBA_o[dataBA_o >= 3]
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
482 # ab_FS3 = ab[ab >= 3]
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
483 # ba_FS3 = ba[ba >= 3]
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
484 # ab_FS3_o = ab_o[ab_o >= 3]
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
485 # ba_FS3_o = ba_o[ba_o >= 3]
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
486
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
487 duplTags_FS3 = duplTags[(duplTags >= 3) & (duplTagsBA >= 3)] # ab+ba with FS>=3
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
488 duplTags_FS3_BA = duplTagsBA[(duplTags >= 3) & (duplTagsBA >= 3)] # ba+ab with FS>=3
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
489 duplTags_double_FS3 = len(duplTags_FS3) + len(duplTags_FS3_BA) # both ab and ba strands with FS>=3
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
490
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
491 # original FS
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
492 duplTags_FS3_o = duplTags_o[(duplTags_o >= 3) & (duplTagsBA_o >= 3)] # ab+ba with FS>=3
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
493 duplTags_FS3_BA_o = duplTagsBA_o[(duplTags_o >= 3) & (duplTagsBA_o >= 3)] # ba+ab with FS>=3
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
494 duplTags_double_FS3_o = sum(duplTags_FS3_o) + sum(duplTags_FS3_BA_o) # both ab and ba strands with FS>=3
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
495
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
496 fig = plt.figure()
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
497 plt.subplots_adjust(left=0.12, right=0.97, bottom=0.3, top=0.94, hspace=0)
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
498
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
499 if rel_freq:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
500 w = [numpy.zeros_like(d) + 1. / len(numpy.concatenate(list1)) for d in list1]
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
501 counts = plt.hist(list1, bins=numpy.arange(1, 23), stacked=True, label=["duplex", "ab", "ba"], weights=w,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
502 edgecolor="black", linewidth=1, align="left", color=["#FF0000", "#5FB404", "#FFBF00"],
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
503 rwidth=0.8)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
504 plt.ylim(0, 1.07)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
505 else:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
506 counts = plt.hist(list1, bins=numpy.arange(1, 23), stacked=True, label=["duplex", "ab", "ba"],
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
507 edgecolor="black", linewidth=1, align="left", color=["#FF0000", "#5FB404", "#FFBF00"],
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
508 rwidth=0.8)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
509
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
510 # tick labels of x axis
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
511 ticks = numpy.arange(1, 22, 1)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
512 ticks1 = map(str, ticks)
42
321a4871564b planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 41
diff changeset
513 ticks1[len(ticks1) - 1] = ">20"
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
514 plt.xticks(numpy.array(ticks), ticks1)
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
515 # singl = counts[0][2][0] # singletons
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
516 singl = len(data_o[data_o == 1])
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
517 last = len(data_o[data_o > 20]) # large families
18
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
518 if log_axis:
c825a29a7d9f planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 17
diff changeset
519 plt.yscale('log')
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
520 plt.legend(loc='upper right', fontsize=14, bbox_to_anchor=(0.9, 1), frameon=True)
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
521 plt.title("{}: FSD based on families".format(name_file), fontsize=14)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
522 plt.xlabel("Family size", fontsize=14)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
523 plt.ylabel("Absolute Frequency", fontsize=14)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
524 plt.margins(0.01, None)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
525 plt.grid(b=True, which="major", color="#424242", linestyle=":")
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
526
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
527 # extra information beneath the plot
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
528 legend = "SSCS ab= \nSSCS ba= \nDCS (total)= \ntotal nr. of tags="
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
529 plt.text(0.1, 0.09, legend, size=10, transform=plt.gcf().transFigure)
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
530
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
531 legend = "nr. of tags\n\n{:,}\n{:,}\n{:,} ({:,})\n{:,} ({:,})".format(len(dataAB), len(dataBA),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
532 len(duplTags), len(duplTags_double), (
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
533 len(dataAB) + len(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
534 dataBA) + len(duplTags)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
535 (len(ab) + len(ba)))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
536 plt.text(0.23, 0.09, legend, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
537
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
538 legend5 = "PE reads\n\n{:,}\n{:,}\n{:,} ({:,})\n{:,} ({:,})".format(sum(dataAB_o), sum(dataBA_o),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
539 sum(duplTags_o), sum(duplTags_double_o),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
540 (sum(dataAB_o) + sum(dataBA_o) + sum(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
541 duplTags_o)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
542 (sum(ab_o) + sum(ba_o)))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
543 plt.text(0.38, 0.09, legend5, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
544
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
545 legend = "rel. freq. of tags\nunique\n{:.3f}\n{:.3f}\n{:.3f}\n{:,}".format(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
546 float(len(dataAB)) / (len(dataAB) + len(dataBA) + len(duplTags)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
547 float(len(dataBA)) / (len(dataAB) + len(dataBA) + len(duplTags)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
548 float(len(duplTags)) / (len(dataAB) + len(dataBA) + len(duplTags)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
549 (len(dataAB) + len(dataBA) + len(duplTags)))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
550 plt.text(0.54, 0.09, legend, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
551
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
552 legend = "total\n{:.3f}\n{:.3f}\n{:.3f} ({:.3f})\n{:,}".format(float(len(dataAB)) / (len(ab) + len(ba)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
553 float(len(dataBA)) / (len(ab) + len(ba)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
554 float(len(duplTags)) / (len(ab) + len(ba)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
555 float(len(duplTags_double)) / (
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
556 len(ab) + len(ba)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
557 (len(ab) + len(ba)))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
558 plt.text(0.64, 0.09, legend, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
559
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
560 legend1 = "\nsingletons:\nfamily size > 20:"
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
561 plt.text(0.1, 0.03, legend1, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
562
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
563 legend4 = "{:,}\n{:,}".format(singl, last)
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
564 plt.text(0.23, 0.03, legend4, size=10, transform=plt.gcf().transFigure)
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
565 legend3 = "{:.3f}\n{:.3f}".format(float(singl) / len(data), float(last) / len(data))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
566 plt.text(0.64, 0.03, legend3, size=10, transform=plt.gcf().transFigure)
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
567
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
568 legend3 = "\n\n{:,}".format(sum(data_o[data_o > 20]))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
569 plt.text(0.38, 0.03, legend3, size=10, transform=plt.gcf().transFigure)
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
570
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
571 legend3 = "{:.3f}\n{:.3f}".format(float(singl) / sum(data_o), float(sum(data_o[data_o > 20])) / sum(data_o))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
572 plt.text(0.84, 0.03, legend3, size=10, transform=plt.gcf().transFigure)
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
573
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
574 legend = "PE reads\nunique\n{:.3f}\n{:.3f}\n{:.3f}\n{:,}".format(
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
575 float(sum(dataAB_o)) / (sum(dataAB_o) + sum(dataBA_o) + sum(duplTags_o)),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
576 float(sum(dataBA_o)) / (sum(dataAB_o) + sum(dataBA_o) + sum(duplTags_o)),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
577 float(sum(duplTags_o)) / (sum(dataAB_o) + sum(dataBA_o) + sum(duplTags_o)),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
578 (sum(dataAB_o) + sum(dataBA_o) + sum(duplTags_o)))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
579 plt.text(0.74, 0.09, legend, size=10, transform=plt.gcf().transFigure)
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
580
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
581 legend = "total\n{:.3f}\n{:.3f}\n{:.3f} ({:.3f})\n{:,}".format(
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
582 float(sum(dataAB_o)) / (sum(ab_o) + sum(ba_o)),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
583 float(sum(dataBA_o)) / (sum(ab_o) + sum(ba_o)),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
584 float(sum(duplTags_o)) / (sum(ab_o) + sum(ba_o)),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
585 float(sum(duplTags_double_o)) / (sum(ab_o) + sum(ba_o)), (sum(ab_o) + sum(ba_o)))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
586 plt.text(0.84, 0.09, legend, size=10, transform=plt.gcf().transFigure)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
587
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
588 pdf.savefig(fig)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
589 plt.close()
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
590
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
591 # PLOT FSD based on PE reads
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
592 fig3 = plt.figure()
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
593 plt.subplots_adjust(left=0.12, right=0.97, bottom=0.3, top=0.94, hspace=0)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
594
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
595 fig3.suptitle("{}: FSD based on PE reads".format(name_file), fontsize=14)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
596 ax2 = fig3.add_subplot(1, 1, 1)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
597 ticks = numpy.arange(1, 22)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
598 ticks1 = map(str, ticks)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
599 ticks1[len(ticks1) - 1] = ">20"
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
600 reads = []
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
601 reads_rel = []
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
602
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
603 #barWidth = 0 - (len(list_to_plot) + 1) / 2 * 1. / (len(list_to_plot) + 1)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
604 ax2.set_xticks([], [])
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
605
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
606 list_y = []
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
607 label = ["duplex", "ab", "ba"]
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
608 col = ["#FF0000", "#5FB404", "#FFBF00"]
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
609 for i in range(len(list1)):
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
610 x = list(numpy.arange(1, 22).astype(float))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
611 unique, c = numpy.unique(list1[i], return_counts=True)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
612 y = unique * c
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
613 if sum(list1_o[i] > 20) > 0:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
614 y[len(y) - 1] = sum(list1_o[i][list1_o[i] > 20])
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
615 y = [y[x[idx] == unique][0] if x[idx] in unique else 0 for idx in range(len(x))]
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
616 reads.append(y)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
617 reads_rel.append(list(numpy.float_(y)) / sum(numpy.concatenate(list1_o)))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
618
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
619 if rel_freq:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
620 y = list(numpy.float_(y)) / sum(numpy.concatenate(list1_o))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
621 ax2.set_ylim(0, 1.07)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
622 else:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
623 y = y
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
624
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
625 list_y.append(y)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
626 if i == 0:
46
901827154779 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 45
diff changeset
627 counts2 = ax2.bar(x, y, align="center", width=0.8,
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
628 edgecolor="black", label=label[0],
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
629 linewidth=1, alpha=1, color=col[0])
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
630 elif i == 1:
46
901827154779 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 45
diff changeset
631 counts2 = ax2.bar(x, y, bottom=list_y[i-1], align="center", width=0.8,
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
632 edgecolor="black", label=label[1],
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
633 linewidth=1, alpha=1, color=col[1])
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
634 elif i == 2:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
635 bars = numpy.add(list_y[0], list_y[1]).tolist()
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
636
46
901827154779 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 45
diff changeset
637 counts2 = ax2.bar(x, y, bottom=bars, align="center", width=0.8,
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
638 edgecolor="black", label=label[2],
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
639 linewidth=1, alpha=1, color=col[2])
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
640
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
641 ax2.legend(loc='upper right', fontsize=14, frameon=True, bbox_to_anchor=(0.9, 1))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
642
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
643 singl = len(data_o[data_o == 1])
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
644 last = len(data_o[data_o > 20]) # large families
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
645
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
646 ax2.set_xticks(numpy.array(ticks))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
647 ax2.set_xticklabels(ticks1)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
648 ax2.set_xlabel("Family size", fontsize=14)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
649 ax2.set_ylabel(ylab, fontsize=14)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
650 if log_axis:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
651 ax2.set_yscale('log')
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
652 ax2.grid(b=True, which="major", color="#424242", linestyle=":")
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
653 ax2.margins(0.01, None)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
654
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
655 # extra information beneath the plot
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
656 legend = "SSCS ab= \nSSCS ba= \nDCS (total)= \ntotal nr. of tags="
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
657 plt.text(0.1, 0.09, legend, size=10, transform=plt.gcf().transFigure)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
658
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
659 legend = "nr. of tags\n\n{:,}\n{:,}\n{:,} ({:,})\n{:,} ({:,})".format(len(dataAB), len(dataBA),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
660 len(duplTags), len(duplTags_double), (
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
661 len(dataAB) + len(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
662 dataBA) + len(duplTags)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
663 (len(ab) + len(ba)))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
664 plt.text(0.23, 0.09, legend, size=10, transform=plt.gcf().transFigure)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
665
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
666 legend5 = "PE reads\n\n{:,}\n{:,}\n{:,} ({:,})\n{:,} ({:,})".format(sum(dataAB_o), sum(dataBA_o),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
667 sum(duplTags_o), sum(duplTags_double_o),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
668 (sum(dataAB_o) + sum(dataBA_o) + sum(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
669 duplTags_o)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
670 (sum(ab_o) + sum(ba_o)))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
671 plt.text(0.38, 0.09, legend5, size=10, transform=plt.gcf().transFigure)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
672
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
673 legend = "rel. freq. of tags\nunique\n{:.3f}\n{:.3f}\n{:.3f}\n{:,}".format(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
674 float(len(dataAB)) / (len(dataAB) + len(dataBA) + len(duplTags)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
675 float(len(dataBA)) / (len(dataAB) + len(dataBA) + len(duplTags)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
676 float(len(duplTags)) / (len(dataAB) + len(dataBA) + len(duplTags)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
677 (len(dataAB) + len(dataBA) + len(duplTags)))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
678 plt.text(0.54, 0.09, legend, size=10, transform=plt.gcf().transFigure)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
679
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
680 legend = "total\n{:.3f}\n{:.3f}\n{:.3f} ({:.3f})\n{:,}".format(float(len(dataAB)) / (len(ab) + len(ba)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
681 float(len(dataBA)) / (len(ab) + len(ba)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
682 float(len(duplTags)) / (len(ab) + len(ba)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
683 float(len(duplTags_double)) / (
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
684 len(ab) + len(ba)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
685 (len(ab) + len(ba)))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
686 plt.text(0.64, 0.09, legend, size=10, transform=plt.gcf().transFigure)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
687
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
688 legend1 = "\nsingletons:\nfamily size > 20:"
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
689 plt.text(0.1, 0.03, legend1, size=10, transform=plt.gcf().transFigure)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
690
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
691 legend4 = "{:,}\n{:,}".format(singl, last)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
692 plt.text(0.23, 0.03, legend4, size=10, transform=plt.gcf().transFigure)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
693 legend3 = "{:.3f}\n{:.3f}".format(float(singl) / len(data), float(last) / len(data))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
694 plt.text(0.64, 0.03, legend3, size=10, transform=plt.gcf().transFigure)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
695
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
696 legend3 = "\n\n{:,}".format(sum(data_o[data_o > 20]))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
697 plt.text(0.38, 0.03, legend3, size=10, transform=plt.gcf().transFigure)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
698
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
699 legend3 = "{:.3f}\n{:.3f}".format(float(singl) / sum(data_o), float(sum(data_o[data_o > 20])) / sum(data_o))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
700 plt.text(0.84, 0.03, legend3, size=10, transform=plt.gcf().transFigure)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
701
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
702 legend = "PE reads\nunique\n{:.3f}\n{:.3f}\n{:.3f}\n{:,}".format(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
703 float(sum(dataAB_o)) / (sum(dataAB_o) + sum(dataBA_o) + sum(duplTags_o)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
704 float(sum(dataBA_o)) / (sum(dataAB_o) + sum(dataBA_o) + sum(duplTags_o)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
705 float(sum(duplTags_o)) / (sum(dataAB_o) + sum(dataBA_o) + sum(duplTags_o)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
706 (sum(dataAB_o) + sum(dataBA_o) + sum(duplTags_o)))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
707 plt.text(0.74, 0.09, legend, size=10, transform=plt.gcf().transFigure)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
708
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
709 legend = "total\n{:.3f}\n{:.3f}\n{:.3f} ({:.3f})\n{:,}".format(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
710 float(sum(dataAB_o)) / (sum(ab_o) + sum(ba_o)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
711 float(sum(dataBA_o)) / (sum(ab_o) + sum(ba_o)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
712 float(sum(duplTags_o)) / (sum(ab_o) + sum(ba_o)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
713 float(sum(duplTags_double_o)) / (sum(ab_o) + sum(ba_o)), (sum(ab_o) + sum(ba_o)))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
714 plt.text(0.84, 0.09, legend, size=10, transform=plt.gcf().transFigure)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
715
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
716 pdf.savefig(fig3)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
717 plt.close()
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
718
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
719 # write same information to a csv file
44
a76af7fd9fca planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 43
diff changeset
720 count = numpy.bincount(data_o) # original counts of family sizes
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
721
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
722 output_file.write("\nDataset:{}{}\n".format(sep, name_file))
44
a76af7fd9fca planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 43
diff changeset
723 output_file.write("max. family size:{}{}\n".format(sep, max(data_o)))
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
724 output_file.write("absolute frequency:{}{}\n".format(sep, count[len(count) - 1]))
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
725 output_file.write("relative frequency:{}{:.3f}\n\n".format(sep, float(count[len(count) - 1]) / sum(count)))
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
726
44
a76af7fd9fca planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 43
diff changeset
727 output_file.write("median family size:{}{}\n".format(sep, numpy.median(numpy.array(data_o))))
a76af7fd9fca planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 43
diff changeset
728 output_file.write("mean family size:{}{}\n\n".format(sep, numpy.mean(numpy.array(data_o))))
43
f72593bcc8ee planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 42
diff changeset
729
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
730 output_file.write(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
731 "{}singletons:{}{}{}family size > 20:{}{}{}{}length of dataset:\n".format(sep, sep, sep, sep, sep, sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
732 sep, sep))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
733 output_file.write(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
734 "{}nr. of tags{}rel. freq of tags{}rel.freq of PE reads{}nr. of tags{}rel. freq of tags{}nr. of PE reads{}rel. freq of PE reads{}total nr. of tags{}total nr. of PE reads\n".format(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
735 sep, sep, sep, sep, sep, sep, sep, sep, sep))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
736 output_file.write("{}{}{}{}{:.3f}{}{:.3f}{}{}{}{:.3f}{}{}{}{:.3f}{}{}{}{}\n\n".format(
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
737 name_file, sep, singl, sep, float(singl) / len(data), sep, float(singl) / sum(data_o), sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
738 last, sep, float(last) / len(data), sep, sum(data_o[data_o > 20]), sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
739 float(sum(data_o[data_o > 20])) / sum(data_o), sep, len(data),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
740 sep, sum(data_o)))
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
741
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
742 # information for FS >= 1
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
743 output_file.write(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
744 "The unique frequencies were calculated from the dataset where the tags occured only once (=ab without DCS, ba without DCS)\n"
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
745 "Whereas the total frequencies were calculated from the whole dataset (=including the DCS).\n\n")
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
746 output_file.write(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
747 "FS >= 1{}nr. of tags{}nr. of PE reads{}rel. freq of tags{}{}rel. freq of PE reads:\n".format(sep, sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
748 sep, sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
749 sep))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
750 output_file.write("{}{}{}unique:{}total{}unique{}total:\n".format(sep, sep, sep, sep, sep, sep))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
751 output_file.write("SSCS ab{}{}{}{}{}{:.3f}{}{:.3f}{}{:.3f}{}{:.3f}\n".format(
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
752 sep, len(dataAB), sep, sum(dataAB_o), sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
753 float(len(dataAB)) / (len(dataAB) + len(dataBA) + len(duplTags)),
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
754 sep, float(sum(dataAB_o)) / (sum(dataAB_o) + sum(dataBA_o) + sum(duplTags_o)), sep,
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
755 float(len(dataAB)) / (len(ab) + len(ba)), sep, float(sum(dataAB_o)) / (sum(ab_o) + sum(ba_o))))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
756 output_file.write("SSCS ba{}{}{}{}{}{:.3f}{}{:.3f}{}{:.3f}{}{:.3f}\n".format(
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
757 sep, len(dataBA), sep, sum(dataBA_o), sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
758 float(len(dataBA)) / (len(dataBA) + len(dataBA) + len(duplTags)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
759 sep, float(sum(dataBA_o)) / (sum(dataBA_o) + sum(dataBA_o) + sum(duplTags_o)), sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
760 float(len(dataBA)) / (len(ba) + len(ba)),
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
761 sep, float(sum(dataBA_o)) / (sum(ba_o) + sum(ba_o))))
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
762 output_file.write(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
763 "DCS (total){}{} ({}){}{} ({}){}{:.3f}{}{:.3f} ({:.3f}){}{:.3f}{}{:.3f} ({:.3f})\n".format(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
764 sep, len(duplTags), len(duplTags_double), sep, sum(duplTags_o), sum(duplTags_double_o), sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
765 float(len(duplTags)) / (len(dataAB) + len(dataBA) + len(duplTags)), sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
766 float(len(duplTags)) / (len(ab) + len(ba)), float(len(duplTags_double)) / (len(ab) + len(ba)), sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
767 float(sum(duplTags_o)) / (sum(dataAB_o) + sum(dataBA_o) + sum(duplTags_o)), sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
768 float(sum(duplTags_o)) / (sum(ab_o) + sum(ba_o)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
769 float(sum(duplTags_double_o)) / (sum(ab_o) + sum(ba_o))))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
770 output_file.write("total nr. of tags{}{}{}{}{}{}{}{}{}{}{}{}\n".format(
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
771 sep, (len(dataAB) + len(dataBA) + len(duplTags)), sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
772 (sum(dataAB_o) + sum(dataBA_o) + sum(duplTags_o)), sep,
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
773 (len(dataAB) + len(dataBA) + len(duplTags)), sep, (len(ab) + len(ba)), sep,
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
774 (sum(dataAB_o) + sum(dataBA_o) + sum(duplTags_o)), sep, (sum(ab_o) + sum(ba_o))))
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
775 # information for FS >= 3
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
776 output_file.write(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
777 "\nFS >= 3{}nr. of tags{}nr. of PE reads{}rel. freq of tags{}{}rel. freq of PE reads:\n".format(sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
778 sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
779 sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
780 sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
781 sep))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
782 output_file.write("{}{}{}unique:{}total{}unique{}total:\n".format(sep, sep, sep, sep, sep, sep))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
783 output_file.write("SSCS ab{}{}{}{}{}{:.3f}{}{:.3f}{}{:.3f}{}{:.3f}\n".format(
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
784 sep, len(dataAB_FS3), sep, sum(dataAB_FS3_o), sep,
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
785 float(len(dataAB_FS3)) / (len(dataAB_FS3) + len(dataBA_FS3) + len(duplTags_FS3)), sep,
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
786 float(len(dataAB_FS3)) / (len(dataBA_FS3) + len(dataBA_FS3) + duplTags_double_FS3),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
787 sep, float(sum(dataAB_FS3_o)) / (sum(dataAB_FS3_o) + sum(dataBA_FS3_o) + sum(duplTags_FS3_o)),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
788 sep, float(sum(dataAB_FS3_o)) / (sum(dataBA_FS3_o) + sum(dataBA_FS3_o) + duplTags_double_FS3_o)))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
789 output_file.write("SSCS ba{}{}{}{}{}{:.3f}{}{:.3f}{}{:.3f}{}{:.3f}\n".format(
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
790 sep, len(dataBA_FS3), sep, sum(dataBA_FS3_o), sep,
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
791 float(len(dataBA_FS3)) / (len(dataBA_FS3) + len(dataBA_FS3) + len(duplTags_FS3)),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
792 sep, float(len(dataBA_FS3)) / (len(dataBA_FS3) + len(dataBA_FS3) + duplTags_double_FS3),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
793 sep, float(sum(dataBA_FS3_o)) / (sum(dataBA_FS3_o) + sum(dataBA_FS3_o) + sum(duplTags_FS3_o)),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
794 sep, float(sum(dataBA_FS3_o)) / (sum(dataBA_FS3_o) + sum(dataBA_FS3_o) + duplTags_double_FS3_o)))
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
795 output_file.write(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
796 "DCS (total){}{} ({}){}{} ({}){}{:.3f}{}{:.3f} ({:.3f}){}{:.3f}{}{:.3f} ({:.3f})\n".format(
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
797 sep, len(duplTags_FS3), duplTags_double_FS3, sep, sum(duplTags_FS3_o), duplTags_double_FS3_o, sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
798 float(len(duplTags_FS3)) / (len(dataAB_FS3) + len(dataBA_FS3) + len(duplTags_FS3)), sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
799 float(len(duplTags_FS3)) / (len(dataAB_FS3) + len(dataBA_FS3) + duplTags_double_FS3),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
800 float(duplTags_double_FS3) / (len(dataAB_FS3) + len(dataBA_FS3) + duplTags_double_FS3),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
801 sep, float(sum(duplTags_FS3_o)) / (sum(dataAB_FS3_o) + sum(dataBA_FS3_o) + sum(duplTags_FS3_o)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
802 sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
803 float(sum(duplTags_FS3_o)) / (sum(dataAB_FS3_o) + sum(dataBA_FS3_o) + duplTags_double_FS3_o),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
804 float(duplTags_double_FS3_o) / (sum(dataAB_FS3_o) + sum(dataBA_FS3_o) + duplTags_double_FS3_o)))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
805 output_file.write("total nr. of tags{}{}{}{}{}{}{}{}{}{}{}{}\n".format(
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
806 sep, (len(dataAB_FS3) + len(dataBA_FS3) + len(duplTags_FS3)), sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
807 (sum(dataAB_FS3_o) + sum(dataBA_FS3_o) + sum(duplTags_FS3_o)),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
808 sep, (len(dataAB_FS3) + len(dataBA_FS3) + len(duplTags_FS3)), sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
809 (len(dataAB_FS3) + len(dataBA_FS3) + duplTags_double_FS3),
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
810 sep, (sum(dataAB_FS3_o) + sum(dataBA_FS3_o) + sum(duplTags_FS3_o)), sep,
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
811 (sum(dataAB_FS3_o) + sum(dataBA_FS3_o) + duplTags_double_FS3_o)))
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
812
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
813 counts = [numpy.bincount(d, minlength=22)[1:] for d in list1] # original counts of family sizes
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
814 output_file.write("\nValues from family size distribution based on families\n")
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
815 output_file.write("{}duplex{}ab{}ba{}sum\n".format(sep, sep, sep, sep))
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
816
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
817 j = 0
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
818 for fs in bins:
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
819 if fs == 21:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
820 fs = ">20"
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
821 else:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
822 fs = "={}".format(fs)
45
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
823 output_file.write("FS{}{}".format(fs, sep))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
824 for n in range(3):
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
825 output_file.write("{}{}".format(int(counts[n][j]), sep))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
826 output_file.write("{}\n".format(counts[0][j] + counts[1][j] + counts[2][j]))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
827 j += 1
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
828 output_file.write("sum{}".format(sep))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
829 for i in counts:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
830 output_file.write("{}{}".format(int(sum(i)), sep))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
831 output_file.write("{}\n".format(sum(counts[0] + counts[1] + counts[2])))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
832
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
833 output_file.write("\nValues from family size distribution based on PE reads\n")
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
834 output_file.write("{}duplex{}ab{}ba{}sum\n".format(sep, sep, sep, sep))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
835 j = 0
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
836 for fs in bins:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
837 if fs == 21:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
838 fs = ">20"
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
839 else:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
840 fs = "={}".format(fs)
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
841 output_file.write("FS{}{}".format(fs, sep))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
842 for n in range(3):
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
843 output_file.write("{}{}".format(int(reads[n][j]), sep))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
844 output_file.write("{}\n".format(reads[0][j] + reads[1][j] + reads[2][j]))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
845 j += 1
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
846 output_file.write("sum{}".format(sep))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
847 for i in reads:
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
848 output_file.write("{}{}".format(int(sum(i)), sep))
6651e76baca1 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit 033dd7b750f68e8aa68f327d7d72bd311ddbee4e-dirty
mheinzl
parents: 44
diff changeset
849 output_file.write("{}\n".format(sum(reads[0] + reads[1] + reads[2])))
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
850
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
851 print("Files successfully created!")
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
852
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
853
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
854 if __name__ == '__main__':
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
855 sys.exit(compare_read_families(sys.argv))