changeset 22:482aef16b6f5 draft

planemo upload for repository https://github.com/zipho/novo_align commit 3aa343058f631ac4117c9bc86989dc449f84135f
author sanbi-uwc
date Thu, 25 Jan 2018 03:37:56 -0500
parents 119cb8e503d0
children 80e0ad163783
files novo_align.py novo_align.xml
diffstat 2 files changed, 66 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/novo_align.py	Thu Jan 25 03:37:56 2018 -0500
@@ -0,0 +1,47 @@
+#!/usr/bin/env python
+from __future__ import print_function
+import argparse
+import shlex
+import os
+import sys
+import logging
+log = logging.getLogger( __name__ )
+
+
+def novo_align(output_filename, index_filename, fwd_file, rev_file ):
+    param = r'@RG\tID:RG\tSM:$i\tPL:ILLUMINA'
+    cmdline_str = "novoalign -c 8 -k -d {} -f {} {} -i PE 250, 100 -o SAM '{}' | samtools view -bS - > {}".format(
+        index_filename,
+        fwd_file,
+        rev_file,
+        param,
+        output_filename)
+    try:
+        os.system(cmdline_str)
+    except:
+        print("Error running the nova-align", file=sys.stderr)
+
+
+def newSplit(value):
+    lex = shlex.shlex(value)
+    lex.quotes = '"'
+    lex.whitespace_split = True
+    lex.commenters = ''
+    return list(lex)
+
+
+def main():
+    parser = argparse.ArgumentParser(description="Generate a BAM file from the Novo Align tool")
+    parser.add_argument('output_filename')
+    parser.add_argument('--index_filename')
+    parser.add_argument('--forward_filename')
+    parser.add_argument('--reverse_filename')
+    args = parser.parse_args()
+
+    # a dirty way of referencing the file
+    index_file_path = args.index_filename  # removed old logic here: + "/" + args.index_filename.split("/")[-1]
+    novo_align(args.output_filename, index_file_path, args.forward_filename, args.reverse_filename)
+
+
+if __name__ == "__main__":
+    main()
--- a/novo_align.xml	Tue Jun 27 10:18:49 2017 -0400
+++ b/novo_align.xml	Thu Jan 25 03:37:56 2018 -0500
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<tool id="novo_align" name="novoalign" version="0.0.10">
+<tool id="novo_align" name="NOVO ALIGN" version="0.0.8">
     <description>Tool to run the Novo Align mapping tool</description>
     <requirements>
         <requirement type="package" version="1.2">samtools</requirement>
@@ -42,43 +42,42 @@
           ln -s '${index.reference}' reference.fasta &&
           novoindex -m reference.nix reference.fasta &&
         #end if
-        novoalign -c \${GALAXY_SLOTS:-8} -k -d
+        python $__tool_directory__/novo_align.py
+            '${out_file}'
+            --index
             #if str($index.source) == 'builtin':
               '${index.index1.fields.path}'
             #else
               reference.nix
             #end if
-            -f 
             #if $paired_end.is_paired_end
                 #if $paired_input_type == "pair_of_files"
                     #if $paired_end.paired_input_type_conditional.fastq_r1_in.metadata.is_gzipped
-                        ./input_mate1.gz
-                        ./input_mate2.gz
+                        --forward_file ./input_mate1.gz
+                        --reverse_file ./input_mate2.gz
                     #else
-                        ./input_mate1.$r1_ext
-                        ./input_mate2.$r2_ext
+                        --forward_file ./input_mate1.$r1_ext
+                        --reverse_file ./input_mate2.$r2_ext
                     #end if
                 #else
                     #if $paired_end.paired_input_type_conditional.fastq_pair.forward.metadata.is_gzipped:
-                        ./input_mate1.gz
-                        ./input_mate2.gz
+                        --forward_file ./input_mate1.gz
+                        --reverse_file ./input_mate2.gz
                     #else
-                        ./input_mate1.$r1_ext
-                        ./input_mate2.$r2_ext
+                        --forward_file ./input_mate1.$r1_ext
+                        --reverse_file ./input_mate2.$r2_ext
                     #end if
                 #end if
             #else
-                '${fastq_in}.${fastq_in.ext}' '${fastq_in}.${fastq_in.ext}'
+                --forward_file ${fastq_in}.${fastq_in.ext} --reverse_file ${fastq_in}.${fastq_in.ext}
             #end if
-            -i PE 250, 100 
-            -o SAM '@RG\tID:RG\tSM:\$i\tPL:ILLUMINA' | samtools view -bS - | novosort -c \${GALAXY_SLOTS:-8} -m 8G -s -f - > '${out_file}' 
 
     ]]></command>
     <inputs>
     <conditional name="paired_end">
     <param name="is_paired_end" type="boolean" label="Paired end data?" truevalue="yes" falsevalue="no" checked="yes" />
     <when value="no">
-      <param name="fastq_in" type="data" format="fastqsanger,fastqsanger.gz" label="Input FASTQ file" />
+      <param name="fastq_in" type="data" format="fastqsanger|fastqsanger.gz" label="Input FASTQ file" />
     </when>
     <when value="yes">
       <conditional name="paired_input_type_conditional">
@@ -87,11 +86,11 @@
           <option value="collection">Dataset collection pair</option>
         </param>
         <when value="pair_of_files">
-      <param name="fastq_r1_in" type="data" format="fastqsanger,fastqsanger.gz" label="Input FASTQ file (R1/first of pair)" />
-      <param name="fastq_r2_in" type="data" format="fastqsanger,fastqsanger.gz" label="Input FASTQ file (R2/second of pair)" />
+      <param name="fastq_r1_in" type="data" format="fastqsanger|fastqsanger.gz" label="Input FASTQ file (R1/first of pair)" />
+      <param name="fastq_r2_in" type="data" format="fastqsanger|fastqsanger.gz" label="Input FASTQ file (R2/second of pair)" />
     </when>
         <when value="collection">
-          <param name="fastq_pair" format="fastqsanger,fastqsanger.gz" type="data_collection"
+          <param name="fastq_pair" format="fastqsanger|fastqsanger.gz" type="data_collection"
          collection_type="paired"
          label="Select FASTQ dataset collection with R1/R2 pair" />
         </when>
@@ -105,7 +104,7 @@
       </param>
       <when value="builtin">
         <param name="index1" type="select" label="Novo-Align Index(FASTA format)">
-            <options from_data_table="novocraft_index"/>
+            <options from_data_table="all_fasta"/>
         </param>
       </when>
       <when value="history">
@@ -117,7 +116,7 @@
         <param name="fastq_input1" type="data" format="fastqsanger" label="Select first set of reads" help="Specify dataset with forward reads"/>
         <param name="fastq_input2" type="data" format="fastqsanger" label="Select second set of reads" help="Specify dataset with reverse reads"/>
         <param name="index1" type="select" label="Novo-Align Index(FASTA format)">
-            <options from_data_table="novocraft_index"/>
+            <options from_data_table="all_fasta"/>
         </param>
     </inputs>-->
     <outputs>