changeset 1:6218b518cd16 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/msp_sr_signature commit 062e78aef14c4655d1b32d5f29ca543a50389b08
author drosofff
date Wed, 07 Jun 2017 17:53:44 -0400
parents a2f293717ce3
children 229645380cb9
files signature.py signature.xml smRtools.py tool_dependencies.xml
diffstat 4 files changed, 24 insertions(+), 80 deletions(-) [+]
line wrap: on
line diff
--- a/signature.py	Wed Oct 21 11:35:25 2015 -0400
+++ b/signature.py	Wed Jun 07 17:53:44 2017 -0400
@@ -2,15 +2,13 @@
 # script for computing overlap signatures from a bowtie output
 # Christophe Antoniewski <drosofff@gmail.com>
 # Usage signature.py <1:input> <2:format of input> <3:minsize query> <4:maxsize query> <5:minsize target> <6:maxsize target>
-#			  <7:minscope> <8:maxscope> <9:output> <10:bowtie index> <11:procedure option> <12: graph (global or lattice)>
-# 			  <13: R code>
+# <7:minscope> <8:maxscope> <9:output> <10:bowtie index> <11:procedure option> <12: graph (global or lattice)>
+# <13: R code>
 # version 2.0.0
 
-import sys
 import subprocess
 import argparse
-from smRtools import *
-from collections import defaultdict  # test whether it is required
+from smRtools import HandleSmRNAwindows
 
 
 def Parser():
--- a/signature.xml	Wed Oct 21 11:35:25 2015 -0400
+++ b/signature.xml	Wed Jun 07 17:53:44 2017 -0400
@@ -1,16 +1,16 @@
-<tool id="signature" name="Small RNA Signatures" version="2.0.5">
+<tool id="signature" name="Small RNA Signatures" version="2.1.0">
     <description />
     <requirements>
-        <requirement type="package" version="0.12.7">bowtie</requirement>
-        <requirement type="package" version="0.7.7">pysam</requirement>
-        <requirement type="package" version="3.1.2">R</requirement>
-        <requirement type="package" version="2.14">biocbasics</requirement>
-        <requirement type="package" version="1.9">numpy</requirement>
+        <requirement type="package" version="1.1.2">bowtie</requirement>
+        <requirement type="package" version="1.11.2=py27_0">numpy</requirement>
+        <requirement type="package" version="0.11.2.1=py27_0">pysam</requirement>
+        <!-- <requirement type="package" version="3.1.2">R</requirement> -->
+        <requirement type="package" version="0.20_33=r3.2.2_0a">r-lattice</requirement>
     </requirements>
-    <command interpreter="python">
-           signature.py
-           --input $refGenomeSource.input
-           --inputFormat $refGenomeSource.input.ext
+    <command><![CDATA[
+        python '$__tool_directory__'/signature.py
+           --input '$refGenomeSource.input'
+           --inputFormat '$refGenomeSource.input.ext'
            --minquery $minquery
            --maxquery $maxquery
            --mintarget $mintarget
@@ -19,15 +19,15 @@
            --maxscope $maxscope
            --outputOverlapDataframe $output
           #if $refGenomeSource.genomeSource == "history":
-            --referenceGenome $refGenomeSource.ownFile
+            --referenceGenome '$refGenomeSource.ownFile'
           #else:
             #silent reference= filter( lambda x: str( x[0] ) == str( $input.dbkey ), $__app__.tool_data_tables[ 'bowtie_indexes' ].get_fields() )[0][-1]
-            --referenceGenome $reference
+            --referenceGenome '$reference'
             --extract_index
           #end if
 	  --graph $graph_type 
-          --rcode $sigplotter
-       </command>
+          --rcode '$sigplotter'
+    ]]></command>
     <inputs>
         <conditional name="refGenomeSource">
             <param help="Built-ins were indexed using default options" label="Will you select a reference genome from your history or use a built-in index?" name="genomeSource" type="select">
--- a/smRtools.py	Wed Oct 21 11:35:25 2015 -0400
+++ b/smRtools.py	Wed Jun 07 17:53:44 2017 -0400
@@ -142,26 +142,6 @@
           self.alignedReads += 1
       F.close()
       return self.instanceDict
-#    elif self.alignmentFileFormat == "sam":
-#      F = open (self.alignmentFile, "r")
-#      dict = {"0":"+", "16":"-"}
-#      for line in F:
-#        if line[0]=='@':
-#            continue
-#        fields = line.split()
-#        if fields[2] == "*": continue
-#        polarity = dict[fields[1]]
-#        gene = fields[2]
-#        offset = int(fields[3])
-#        size = len (fields[9])
-#        if self.size_inf:
-#          if (size>=self.size_inf and size<= self.size_sup):
-#            self.instanceDict[gene].addread (polarity, offset, size)
-#            self.alignedReads += 1
-#       else:
-#          self.instanceDict[gene].addread (polarity, offset, size)
-#          self.alignedReads += 1
-#      F.close()
     elif self.alignmentFileFormat == "bam" or self.alignmentFileFormat == "sam":
       import pysam
       samfile = pysam.Samfile(self.alignmentFile)
@@ -184,22 +164,6 @@
           self.alignedReads += 1
       return self.instanceDict
 
-#  def size_histogram (self):
-#    size_dict={}
-#    size_dict['F']= defaultdict (int)
-#    size_dict['R']= defaultdict (int)
-#    size_dict['both'] = defaultdict (int)
-#    for item in self.instanceDict:
-#      buffer_dict_F = self.instanceDict[item].size_histogram()['F']
-#      buffer_dict_R = self.instanceDict[item].size_histogram()['R']
-#      for size in buffer_dict_F:
-#        size_dict['F'][size] += buffer_dict_F[size]
-#      for size in buffer_dict_R:
-#        size_dict['R'][size] -= buffer_dict_R[size]
-#    allSizeKeys = list (set (size_dict['F'].keys() + size_dict['R'].keys() ) )
-#    for size in allSizeKeys:
-#      size_dict['both'][size] = size_dict['F'][size] + size_dict['R'][size]
-#    return size_dict
   def size_histogram (self): # in HandleSmRNAwindows
     '''refactored on 7-9-2014 to debug size_histogram tool'''
     size_dict={}
@@ -361,24 +325,7 @@
     for offset in range (min(dicsize.keys()), max(dicsize.keys())+1):
       dicsize[size] = dicsize.get(size, 0) # to fill offsets with null values
     return dicsize
-    
-#  def size_histogram(self):
-#    norm=self.norm
-#    hist_dict={}
-#    hist_dict['F']={}
-#    hist_dict['R']={}
-#    for offset in self.readDict:
-#      for size in self.readDict[offset]:
-#        if offset < 0:
-#          hist_dict['R'][size] = hist_dict['R'].get(size, 0) - 1*norm
-#        else:
-#          hist_dict['F'][size] = hist_dict['F'].get(size, 0) + 1*norm
-#   ## patch to avoid missing graphs when parsed by R-lattice. 27-08-2014. Test and validate !    
-#    if not (hist_dict['F']) and (not hist_dict['R']):
-#      hist_dict['F'][21] = 0
-#      hist_dict['R'][21] = 0
-#   ##
-#    return hist_dict
+
 
   def size_histogram(self, minquery=None, maxquery=None): # in SmRNAwindow
     '''refactored on 7-9-2014 to debug size_histogram tool'''
@@ -480,7 +427,6 @@
       return ". | %s" % (freqDic["Trev"] / reverse_sum * 100)
     else:
       return "%s | %s" % (freqDic["Tfor"] / forward_sum * 100, freqDic["Trev"] / reverse_sum * 100)
-
     
   def readplot (self):
     norm=self.norm
--- a/tool_dependencies.xml	Wed Oct 21 11:35:25 2015 -0400
+++ b/tool_dependencies.xml	Wed Jun 07 17:53:44 2017 -0400
@@ -1,16 +1,16 @@
 <?xml version="1.0"?>
 <tool_dependency>
-  <package name="bowtie" version="0.12.7">
-      <repository changeset_revision="9f9f38617a98" name="package_bowtie_0_12_7" owner="devteam" toolshed="https://toolshed.g2.bx.psu.edu" />
+  <package name="bowtie" version="1.1.2">
+      <repository changeset_revision="a1c1a92e13a6" name="package_bowtie_1_1_2" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
     </package>
-    <package name="pysam" version="0.7.7">
-      <repository changeset_revision="0a5141bdf9d0" name="package_pysam_0_7_7" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
+    <package name="pysam" version="0.8.3">
+      <repository changeset_revision="08db58be052a" name="package_python_2_7_pysam_0_8_3" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
     </package>
     <package name="numpy" version="1.9">
-        <repository changeset_revision="9cc1138e5e3e" name="package_numpy_1_9" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
+        <repository changeset_revision="f24fc0b630fc" name="package_python_2_7_numpy_1_9" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
     </package>
     <package name="R" version="3.1.2">
-        <repository changeset_revision="9f2fddb9d6e2" name="package_r_3_1_2" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
+        <repository changeset_revision="4d2fd1413b56" name="package_r_3_1_2" owner="iuc" toolshed="https://toolshed.g2.bx.psu.edu" />
     </package>
     <package name="biocbasics" version="2.14">
         <repository changeset_revision="f0ef1a7b157e" name="package_biocbasics_2_14" owner="mvdbeek" toolshed="https://toolshed.g2.bx.psu.edu" />