annotate fsd.py @ 17:2e517a54eedc draft

planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
author mheinzl
date Tue, 02 Apr 2019 05:10:09 -0400
parents 6bd9ef49d013
children c825a29a7d9f
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
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
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 --output_tabular outptufile_name_tabular --output_pdf outptufile_name_pdf
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
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
18
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
19 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
20 import numpy
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
21 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
22
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
23 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
24
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 def readFileReferenceFree(file):
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
27 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
28 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
29 return(data_array)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
30
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 def make_argparser():
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
33 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
34 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
35 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
36 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
37 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
38 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
39 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
40 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
41 parser.add_argument('--inputName4')
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('--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
43 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
44 return parser
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
45
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
46
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
47 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
48
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
49 parser = make_argparser()
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
50 args = parser.parse_args(argv[1:])
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
51 firstFile = args.inputFile1
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
52 name1 = args.inputName1
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
53 secondFile = args.inputFile2
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
54 name2 = args.inputName2
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
55 thirdFile = args.inputFile3
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
56 name3 = args.inputName3
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
57 fourthFile = args.inputFile4
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
58 name4 = args.inputName4
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
59 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
60 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
61
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
62 sep = "\t"
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
63
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
64 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
65 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
66 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
67 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
68 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
69
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
70 list_to_plot = []
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
71 label = []
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
72 data_array_list = []
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
73 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
74 fig = plt.figure()
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
75 plt.subplots_adjust(bottom=0.25)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
76 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
77 file1 = readFileReferenceFree(firstFile)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
78 integers = numpy.array(file1[:, 0]).astype(int) # keep original family sizes
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
79
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
80 # for plot: replace all big family sizes by 22
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
81 data1 = numpy.array(file1[:, 0]).astype(int)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
82 bigFamilies = numpy.where(data1 > 20)[0]
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
83 data1[bigFamilies] = 22
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
84
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
85 name1 = name1.split(".tabular")[0]
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
86 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
87 label.append(name1)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
88 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
89
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
90 legend = "\n\n\n{}".format(name1)
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
91 plt.text(0.05, 0.11, 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
92 legend1 = "singletons:\nnr. of tags\n{:,}".format(numpy.bincount(data1)[1])
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
93 plt.text(0.32, 0.11, 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
94
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
95 legend3 = "freq. of tags\n{:.3f}".format(float(numpy.bincount(data1)[1]) / len(data1))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
96 plt.text(0.41, 0.11, 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
97
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
98 legend3b = "PE reads\n{:.3f}".format(float(numpy.bincount(data1)[1]) / sum(integers))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
99 plt.text(0.5, 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
100
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
101 legend4 = "family size > 20:\nnr. of tags\n{:,} ({:.3f})".format(numpy.bincount(data1)[len(numpy.bincount(data1)) - 1].astype(int), float(numpy.bincount(data1)[len(numpy.bincount(data1)) - 1]) / len(data1))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
102 plt.text(0.58, 0.11, legend4, 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
103
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
104 legend5 = "PE reads\n{:,} ({:.3f})".format(sum(integers[integers > 20]), float(sum(integers[integers > 20])) / sum(integers))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
105 plt.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
106
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
107 legend6 = "total nr. of\ntags\n{:,}".format(len(data1))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
108 plt.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
109
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
110 legend6b = "PE reads\n{:,}".format(sum(integers))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
111 plt.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
112
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
113 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
114 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
115 integers2 = numpy.array(file2[:, 0]).astype(int) # keep original family sizes
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
116
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
117 data2 = numpy.asarray(file2[:, 0]).astype(int)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
118 bigFamilies2 = numpy.where(data2 > 20)[0]
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
119 data2[bigFamilies2] = 22
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
120
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
121 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
122 name2 = name2.split(".tabular")[0]
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
123 label.append(name2)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
124 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
125
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
126 plt.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
127
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
128 legend1 = "{:,}".format(numpy.bincount(data2)[1])
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
129 plt.text(0.32, 0.09, 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
130
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
131 legend3 = "{:.3f}".format(float(numpy.bincount(data2)[1]) / len(data2))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
132 plt.text(0.41, 0.09, 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
133
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
134 legend3b = "{:.3f}".format(float(numpy.bincount(data2)[1]) / sum(integers2))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
135 plt.text(0.5, 0.09, 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
136
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
137 legend4 = "{:,} ({:.3f})".format(
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
138 numpy.bincount(data2)[len(numpy.bincount(data2)) - 1].astype(int),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
139 float(numpy.bincount(data2)[len(numpy.bincount(data2)) - 1]) / len(data2))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
140 plt.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
141
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
142 legend5 = "{:,} ({:.3f})".format(sum(integers2[integers2 > 20]), float(sum(integers2[integers2 > 20])) / sum(integers2))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
143 plt.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
144
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
145 legend6 = "{:,}".format(len(data2))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
146 plt.text(0.82, 0.09, legend6, 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
147
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
148 legend6b = "{:,}".format(sum(integers2))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
149 plt.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
150
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
151 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
152 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
153 integers3 = numpy.array(file3[:, 0]).astype(int) # keep original family sizes
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
154
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
155 data3 = numpy.asarray(file3[:, 0]).astype(int)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
156 bigFamilies3 = numpy.where(data3 > 20)[0]
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
157 data3[bigFamilies3] = 22
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
158
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
159 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
160 name3 = name3.split(".tabular")[0]
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
161 label.append(name3)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
162 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
163
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
164 plt.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
165
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
166 legend1 = "{:,}".format(numpy.bincount(data3)[1])
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
167 plt.text(0.32, 0.07, 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
168
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
169 legend3 = "{:.3f}".format(float(numpy.bincount(data3)[1]) / len(data3))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
170 plt.text(0.41, 0.07, 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
171
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
172 legend3b = "{:.3f}".format(float(numpy.bincount(data3)[1]) / sum(integers3))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
173 plt.text(0.5, 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
174
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
175 legend4 = "{:,} ({:.3f})".format(
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
176 numpy.bincount(data3)[len(numpy.bincount(data3)) - 1].astype(int),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
177 float(numpy.bincount(data3)[len(numpy.bincount(data3)) - 1]) / len(data3))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
178 plt.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
179
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
180 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
181 float(sum(integers3[integers3 > 20])) / sum(integers3))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
182 plt.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
183
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
184 legend6 = "{:,}".format(len(data3))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
185 plt.text(0.82, 0.07, legend6, 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
186
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
187 legend6b = "{:,}".format(sum(integers3))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
188 plt.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
189
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
190 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
191 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
192 integers4 = numpy.array(file4[:, 0]).astype(int) # keep original family sizes
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
193
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
194 data4 = numpy.asarray(file4[:, 0]).astype(int)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
195
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
196 bigFamilies4 = numpy.where(data4 > 20)[0]
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
197 data4[bigFamilies4] = 22
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
198
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
199 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
200 name4 = name4.split(".tabular")[0]
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
201 label.append(name4)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
202 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
203
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
204 plt.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
205
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
206 legend1 = "{:,}".format(numpy.bincount(data4)[1])
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
207 plt.text(0.32, 0.05, 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
208
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
209 legend3 = "{:.3f}".format(float(numpy.bincount(data4)[1]) / len(data4))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
210 plt.text(0.41, 0.05, 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
211
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
212 legend3b = "{:.3f}".format(float(numpy.bincount(data4)[1]) / sum(integers4))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
213 plt.text(0.5, 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
214
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
215 legend4 = "{:,} ({:.3f})".format(
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
216 numpy.bincount(data4)[len(numpy.bincount(data4)) - 1].astype(int),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
217 float(numpy.bincount(data4)[len(numpy.bincount(data4)) - 1]) / len(data4))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
218 plt.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
219
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
220 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
221 float(sum(integers4[integers4 > 20])) / sum(integers4))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
222 plt.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
223
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
224 legend6 = "{:,}".format(len(data4))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
225 plt.text(0.82, 0.05, legend6, 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
226
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
227 legend6b = "{:,}".format(sum(integers4))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
228 plt.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
229
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
230 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
231 minimumX = numpy.amin(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
232
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
233 counts = plt.hist(list_to_plot, bins=range(minimumX, maximumX + 1), stacked=False, edgecolor="black",
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
234 linewidth=1, label=label, align="left", rwidth=0.8, alpha=0.7)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
235
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
236 ticks = numpy.arange(minimumX - 1, maximumX, 1)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
237 ticks1 = map(str, ticks)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
238 ticks1[len(ticks1) - 1] = ">20"
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
239 plt.xticks(numpy.array(ticks), ticks1)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
240
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
241 plt.legend(loc='upper right', fontsize=14, frameon=True, bbox_to_anchor=(0.9, 1))
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
242 # plt.title("Family Size Distribution", fontsize=14)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
243 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
244 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
245 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
246 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
247 pdf.savefig(fig)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
248 plt.close()
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
249
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
250 # write data to CSV file
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
251 output_file.write("Values from family size distribution with all datasets\n")
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
252 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
253 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
254 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
255 # output_file.write("{}sum".format(sep))
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
256 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
257 j = 0
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
258 for fs in counts[1][0:len(counts[1]) - 1]:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
259 if fs == 21:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
260 fs = ">20"
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
261 else:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
262 fs = "={}".format(fs)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
263 output_file.write("FS{}{}".format(fs, sep))
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
264 if len(label) == 1:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
265 output_file.write("{}{}".format(int(counts[0][j]), sep))
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
266 else:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
267 for n in range(len(label)):
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
268 output_file.write("{}{}".format(int(counts[0][n][j]), sep))
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
269 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
270 j += 1
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
271 output_file.write("sum{}".format(sep))
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
272 if len(label) == 1:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
273 output_file.write("{}{}".format(int(sum(counts[0])), sep))
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
274 else:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
275 for i in counts[0]:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
276 output_file.write("{}{}".format(int(sum(i)), sep))
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
277
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
278 # 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
279 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
280 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
281 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
282
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
283 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
284 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
285 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
286 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
287 # 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
288 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
289 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
290
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
291 # 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
292 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
293 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
294
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
295 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
296 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
297
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
298 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
299 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
300
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
301 # 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
302 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
303 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
304 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
305 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
306
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
307 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
308 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
309 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
310 ba = data[ba]
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
311
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
312 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
313 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
314
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
315 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
316 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
317
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
318 list1 = [duplTags_double, dataAB, dataBA] # list for plotting
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
319
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
320 # 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
321 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
322 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
323 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
324 dataBA_FS3_o = dataBA_o[dataBA_o >= 3]
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
325 ab_FS3 = ab[ab >= 3]
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
326 ba_FS3 = ba[ba >= 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
327 ab_FS3_o = ab_o[ab_o >= 3]
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
328 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
329
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
330 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
331 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
332 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
333
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
334 # 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
335 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
336 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
337 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
338
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
339 fig = plt.figure()
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
340 plt.subplots_adjust(bottom=0.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
341 counts = plt.hist(list1, bins=range(minimumX, maximumX + 1), stacked=True, label=["duplex", "ab", "ba"],
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
342 edgecolor="black", linewidth=1, align="left", color=["#FF0000", "#5FB404", "#FFBF00"],
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
343 rwidth=0.8)
16
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
344 # tick labels of x axis
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
345 ticks = numpy.arange(minimumX - 1, maximumX, 1)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
346 ticks1 = map(str, ticks)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
347 ticks1[len(ticks1) - 1] = ">20"
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
348 plt.xticks(numpy.array(ticks), ticks1)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
349 singl = counts[0][2][0] # singletons
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
350 last = counts[0][2][len(counts[0][0]) - 1] # large families
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
351
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
352 plt.legend(loc='upper right', fontsize=14, bbox_to_anchor=(0.9, 1), frameon=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
353 plt.title(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
354 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
355 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
356 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
357 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
358
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
359 # 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
360 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
361 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
362
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
363 legend = "nr. of tags\n\n{:,}\n{:,}\n{:,} ({:,})\n{:,}".format(len(dataAB), len(dataBA), len(duplTags), len(duplTags_double), (len(dataAB) + len(dataBA) + len(duplTags)))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
364 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
365
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
366 legend5 = "PE reads\n\n{:,}\n{:,}\n{:,} ({:,})\n{:,}".format(sum(dataAB_o), sum(dataBA_o), sum(duplTags_o), sum(duplTags_double_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
367 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
368
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
369 legend = "rel. freq. of tags\nunique\n{:.3f}\n{:.3f}\n{:.3f}\n{:,}".format(float(len(dataAB)) / (len(dataAB) + len(dataBA) + len(duplTags)), float(len(dataBA)) / (len(dataAB) + len(dataBA) + len(duplTags)), float(len(duplTags)) / (len(dataAB) + len(dataBA) + len(duplTags)), (len(dataAB) + len(dataBA) + len(duplTags)))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
370 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
371
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
372 legend = "total\n{:.3f}\n{:.3f}\n{:.3f} ({:.3f})\n{:,}".format(float(len(dataAB)) / (len(ab) + len(ba)), float(len(dataBA)) / (len(ab) + len(ba)), float(len(duplTags)) / (len(ab) + len(ba)), float(len(duplTags_double)) / (len(ab) + len(ba)), (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
373 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
374
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
375 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
376 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
377
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
378 legend4 = "{:,}\n{:,}".format(singl.astype(int), last.astype(int))
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
379 plt.text(0.23, 0.03, 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
380
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
381 legend3 = "{:.3f}\n{:.3f}".format(singl / len(data), 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
382 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
383
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
384 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
385 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
386
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
387 legend3 = "{:.3f}\n{:.3f}".format(float(singl)/sum(data_o), float(sum(data_o[data_o > 20])) / sum(data_o))
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
388 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
389
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
390 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
391 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
392 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
393 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
394 (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
395 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
396
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
397 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
398 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
399 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
400 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
401 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
402 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
403
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
404 pdf.savefig(fig)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
405 plt.close()
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
406
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
407 # write same information to a csv file
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
408 count = numpy.bincount(integers) # original counts of family sizes
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
409 output_file.write("\nDataset:{}{}\n".format(sep, name_file))
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
410 output_file.write("max. family size:{}{}\n".format(sep, max(integers)))
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
411 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
412 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
413
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
414 output_file.write("{}singletons:{}{}{}family size > 20:\n".format(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
415 output_file.write("{}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(sep, sep, sep, 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
416 output_file.write("{}{}{}{}{:.3f}{}{:.3f}{}{}{}{:.3f}{}{}{}{:.3f}{}{}{}{}\n\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
417 name_file, sep, singl.astype(int), sep, singl / len(data), sep, float(singl)/sum(data_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
418 last.astype(int), sep, last / len(data), sep, sum(data_o[data_o > 20]), sep, float(sum(data_o[data_o > 20])) / sum(data_o), sep, len(data), 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
419
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
420 # information for FS >= 1
17
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
421 output_file.write("The unique frequencies were calculated from the dataset where the tags occured only once (=ab without DCS, ba without DCS)\n"
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
422 "Whereas the total frequencies were calculated from the whole dataset (=including the DCS).\n\n")
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
423 output_file.write("FS >= 1{}nr. of tags{}nr. of PE reads{}rel. freq of tags{}{}rel. freq of PE reads:\n".format(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
424 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
425 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
426 sep, len(dataAB), sep, sum(dataAB_o), sep, float(len(dataAB)) / (len(dataAB) + len(dataBA) + len(duplTags)),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
427 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
428 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
429 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
430 sep, len(dataBA), sep, sum(dataBA_o), sep, float(len(dataBA)) / (len(dataBA) + len(dataBA) + len(duplTags)),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
431 sep, float(sum(dataBA_o)) / (sum(dataBA_o) + sum(dataBA_o) + sum(duplTags_o)), sep, float(len(dataBA)) / (len(ba) + len(ba)),
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
432 sep, float(sum(dataBA_o)) / (sum(ba_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
433 output_file.write("DCS (total){}{} ({}){}{} ({}){}{:.3f}{}{:.3f} ({:.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
434 sep, len(duplTags), len(duplTags_double), sep, sum(duplTags_o), sum(duplTags_double_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
435 float(len(duplTags)) / (len(dataAB) + len(dataBA) + len(duplTags)), sep,
2e517a54eedc planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit b8a2f7b7615b2bcd3b602027af31f4e677da94f6-dirty
mheinzl
parents: 16
diff changeset
436 float(len(duplTags)) / (len(ab) + len(ba)), float(len(duplTags_double)) / (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
437 float(sum(duplTags_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
438 float(sum(duplTags_o)) / (sum(ab_o) + sum(ba_o)), float(sum(duplTags_double_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
439 output_file.write("total nr. of tags{}{}{}{}{}{}{}{}{}{}{}{}\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
440 sep, (len(dataAB) + len(dataBA) + len(duplTags)), sep, (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
441 (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
442 (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
443 # information for FS >= 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
444 output_file.write("\nFS >= 3{}nr. of tags{}nr. of PE reads{}rel. freq of tags{}{}rel. freq of PE reads:\n".format(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
445 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
446 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
447 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
448 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
449 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
450 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
451 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
452 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
453 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
454 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
455 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
456 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
457 sep, float(sum(dataBA_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
458 output_file.write("DCS (total){}{} ({}){}{} ({}){}{:.3f}{}{:.3f} ({:.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
459 sep, len(duplTags_FS3), duplTags_double_FS3, sep, sum(duplTags_FS3_o), duplTags_double_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
460 float(len(duplTags_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
461 float(len(duplTags_FS3)) / (len(dataAB_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
462 float(duplTags_double_FS3) / (len(dataAB_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
463 sep, float(sum(duplTags_FS3_o)) / (sum(dataAB_FS3_o) + sum(dataBA_FS3_o) + sum(duplTags_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
464 float(sum(duplTags_FS3_o)) / (sum(dataAB_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
465 float(duplTags_double_FS3_o) / (sum(dataAB_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
466 output_file.write("total nr. of tags{}{}{}{}{}{}{}{}{}{}{}{}\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
467 sep, (len(dataAB_FS3) + len(dataBA_FS3) + len(duplTags_FS3)), sep, (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
468 sep, (len(dataAB_FS3) + len(dataBA_FS3) + len(duplTags_FS3)), sep, (len(dataAB_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
469 sep, (sum(dataAB_FS3_o) + sum(dataBA_FS3_o) + sum(duplTags_FS3_o)), sep, (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
470
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
471 output_file.write("\nValues from family size distribution\n")
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
472 output_file.write("{}duplex{}ab{}ba{}sum\n".format(sep, sep, sep, sep))
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
473 for dx, ab, ba, fs in zip(counts[0][0], counts[0][1], counts[0][2], counts[1]):
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
474 if fs == 21:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
475 fs = ">20"
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
476 else:
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
477 fs = "={}".format(fs)
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
478 ab1 = ab - dx
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
479 ba1 = ba - ab
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
480 output_file.write("FS{}{}{}{}{}{}{}{}{}\n".format(fs, sep, int(dx), sep, int(ab1), sep, int(ba1), sep, int(ba)))
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
481
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
482 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
483
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
484
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
485 if __name__ == '__main__':
6bd9ef49d013 planemo upload for repository https://github.com/monikaheinzl/duplexanalysis_galaxy/tree/master/tools/fsd commit dfaab79252a858e8df16bbea3607ebf1b6962e5a
mheinzl
parents:
diff changeset
486 sys.exit(compare_read_families(sys.argv))