Repository 'calculate_fitness'
hg clone https://toolshed.g2.bx.psu.edu/repos/kaymccoy/calculate_fitness

Changeset 9:d099ed535baf (2016-12-11)
Previous changeset 8:0b1764fec7c1 (2016-12-11) Next changeset 10:00a4fcfdef53 (2016-12-11)
Commit message:
Uploaded
added:
calc_fitness.py
b
diff -r 0b1764fec7c1 -r d099ed535baf calc_fitness.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/calc_fitness.py Sun Dec 11 17:02:24 2016 -0500
[
b'@@ -0,0 +1,777 @@\n+# A translation of calc_fitness.pl into python! For analysis of Tn-Seq.\n+# This script requires BioPython, which in turn has a good number of dependencies (some optional but very helpful).\n+# How to install BioPython and a list of its dependencies can be found here: http://biopython.org/DIST/docs/install/Installation.html\n+# K. McCoy\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+##### ARGUMENTS #####\n+\n+def print_usage():\n+\tprint "\\n" + "You are missing one or more required flags. A complete list of flags accepted by calc_fitness is as follows:" + "\\n\\n"\n+\tprint "\\033[1m" + "Required" + "\\033[0m" + "\\n"\n+\tprint "-ref" + "\\t\\t" + "The name of the reference genome file, in GenBank format." + "\\n"\n+\tprint "-t1" + "\\t\\t" + "The name of the bowtie mapfile from time 1." + "\\n"\n+\tprint "-t2" + "\\t\\t" + "The name of the bowtie mapfile from time 2." + "\\n"\n+\tprint "-out" + "\\t\\t" + "Name of a file to enter the .csv output." + "\\n"\n+\tprint "\\n"\n+\tprint "\\033[1m" + "Optional" + "\\033[0m" + "\\n"\n+\tprint "-expansion" + "\\t\\t" + "Expansion factor (default: 250)" + "\\n"\n+\tprint "-reads1" + "\\t\\t" + "The number of reads to be used to calculate the correction factor for time 0." + "\\n\\t\\t" + "(default counted from bowtie output)" + "\\n"\n+\tprint "-reads2" + "\\t\\t" + "The number of reads to be used to calculate the correction factor for time 6." + "\\n\\t\\t" + "(default counted from bowtie output)" + "\\n"\n+\tprint "-cutoff" + "\\t\\t" + "Discard any positions where the average of counted transcripts at time 0 and time 1 is below this number (default 0)" + "\\n"\n+\tprint "-cutoff2" + "\\t\\t" + "Discard any positions within the normalization genes where the average of counted transcripts at time 0 and time 1 is below this number (default 10)" + "\\n"\n+\tprint "-strand" + "\\t\\t" + "Use only the specified strand (+ or -) when counting transcripts (default: both)" + "\\n"\n+\tprint "-normalize" + "\\t" + "A file that contains a list of genes that should have a fitness of 1 - used for normalization and bottleneck calculations." + "\\n"\n+\tprint "-b" + "\\t" + "Calculate bottleneck value (the percentage of insertions randomly lost) from all genes (rather than only normalization genes)" + "\\n"\n+\tprint "-maxweight" + "\\t" + "The maximum weight a transposon gene can have in normalization calculations" + "\\n"\n+\tprint "-multiply" + "\\t" + "Multiply all fitness scores by a certain value (e.g., the fitness of a knockout). You should normalize the data." + "\\n"\n+\tprint "-ef" + "\\t\\t" + "Exclude insertions that occur in the first N amount (%) of gene--becuase may not affect gene function." + "\\n"\n+\tprint "-el" + "\\t\\t" + "Exclude insertions in the last N amount (%) of the gene--considering truncation may not affect gene function." + "\\n"\n+\tprint "-wig" + "\\t\\t" + "Create a wiggle file for viewing in a genome browser. Provide a filename." + "\\n"\n+\tprint "-uncol" + "\\t\\t" + "Use if reads were uncollapsed when mapped." + "\\n"\n+\tprint "\\n"\n+\n+import argparse \n+parser = argparse.ArgumentParser()\n+parser.add_argument("-ref", action="store", dest="ref_genome")\n+parser.add_argument("-t1", action="store", dest="mapfile1")\n+parser.add_argument("-t2", action="store", dest="mapfile2")\n+parser.add_argument("-out", action="store", dest="outfile")\n+parser.add_argument("-out2", action="store", dest="outfile2")\n+parser.add_argument("-expansion", action="store", dest="expansion_factor")\n+parser.add_argument("-reads1", action="store", dest="reads1")\n+parser.add_argument("-reads2", action="store", dest="reads2")\n+parser.add_argument("-cutoff", action="store", dest="cutoff")\n+parser.add_argument("-cutoff2", action="store", dest="cutoff2")\n+parser.add_argument("-strand", action="store", dest="usestrand")\n+parser.add_argument("-normalize", action="store", dest="normalize")\n+parser.add_argument("-b", action="store", dest="bottleall")\n+parser.add_argument("-maxweight", action="store", dest="max_weight")\n+parser.add_argument("-multiply", action="store", dest="multiply")\n+parser.add_argument("-ef", action="stor'..b"                                    `````````````````````````@##@``````````````````@##;````````````````````````````      ``+@@@@``         \n+#                                                                                         ````###,````          ````+##@```                               ``+@@@@``         \n+#                                                                                          ``,###```              ``.@##```                               ``'@@@@``         \n+#                                                                                          ``###@``               ```@##```                               ``'@@@@``         \n+#                                                                                         ```@##@``                ``@##+``                               ``'@@@@``         \n+#                                                                                         ```###.``                ``:##@``                               ``'@@@@``         \n+#                                                                                         ``:###```                ```##@```                              ``'@@@@``         \n+#                                                                                         ``@##@``                 ```@##```                              ``'@@@@``         \n+#                                                                                        ```@##'``                  ``@###``                              ``'@@@@``         \n+#                                                                                        ```@##```                  ```##@``                              ``'@@@@``         \n+#                                                                                        ``,###```                  ```@#@```                             ``'@@@@``         \n+#                                                                                        ``####``                    ``@##.``                             ``'@@@@``         \n+#                                                                                        ``@##@``                    ``;##@``                             ``'@@@@``         \n+#                                                                                 `````````@##@``                    ```##@````                           ``;@@@@``         \n+#                                                                            ``````````````@##;``                    ```###``````````````                 ``;@@@@``         \n+#                                                                          `````````.,;.```###```                     ``@##:``````````````                ``;@@@@``         \n+#                                                                         `````#@#########@@##```                     ``###@@@@@@###@#@'```               ``;@@@@``         \n+#                                                                        ```@@###############@``                      ``,################``               ``;@@@@``         \n+#                                                                        ``'@################+``                      ```###############+``               ``;@@@@``         \n+#                                                                         ``````````````````````                       ``###########@#,````               ``.@@@@``         \n+#                                                                         `````````````````````                        ```````````````````                ```@@@.`          \n+#                                                                                                                       ````````````````                   ```````          \n+#                                                                                                                                                                           \n+#\n\\ No newline at end of file\n"