changeset 0:6b5153d02ac2 draft

Uploaded
author mons
date Sat, 01 Nov 2014 10:34:38 -0400
parents
children a5ef7a9e5cb7
files README.txt genbanktofasta.py genbanktofasta.xml repository_dependencies.xml
diffstat 4 files changed, 109 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.txt	Sat Nov 01 10:34:38 2014 -0400
@@ -0,0 +1,15 @@
+
+----------------
+GenBank to FASTA
+----------------
+
+This package contains the GenBank to FASTA converter.
+
+--------------------------------------------------------------------
+Instructions for integration of the "GenBank to FASTA" tool into the workflow-system
+Galaxy (http://getgalaxy.org)
+--------------------------------------------------------------------
+
+For best results, we recommand you to install it via the toolshed.
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/genbanktofasta.py	Sat Nov 01 10:34:38 2014 -0400
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+"""
+Input: genbank file
+Output: fasta nucleotide or protein sequences
+This bit of code will record the full DNA nucleotide sequence for each record in the GenBank file as a fasta record.
+http://www.warwick.ac.uk/go/peter_cock/python/genbank2fasta/
+"""
+
+import sys, os
+from Bio import SeqIO
+
+
+def __main__():
+
+    infile = sys.argv[1]
+    outfile= sys.argv[2]
+    input_handle  = open(infile, "r")
+    output_handle = open(outfile, "w")
+    gbk_to_fna(input_handle,output_handle)
+
+
+#Short version:
+#SeqIO.write(SeqIO.parse(input_handle, "genbank"), output_handle, "fasta")
+#Long version, allows full control of fasta output
+
+def gbk_to_fna(input_handle,output_handle):
+    for seq_record in SeqIO.parse(input_handle, "genbank") :
+        print "Dealing with GenBank record %s" % seq_record.id
+        output_handle.write(">%s %s\n%s\n" % (
+               seq_record.id,
+               seq_record.description,
+               seq_record.seq.tostring()))
+    output_handle.close()
+    input_handle.close()
+    print "Done"
+
+
+
+if __name__ == "__main__" : __main__()
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/genbanktofasta.xml	Sat Nov 01 10:34:38 2014 -0400
@@ -0,0 +1,50 @@
+<tool id="genbank_to_fa" name="Converting GenBank files" version="1.0.0">
+    
+    <!-- [REQUIRED] Tool description displayed after the tool name -->
+    <description>to Fasta format</description>
+    
+    <!-- [OPTIONAL] 3rd party tools, binaries, modules... required for the tool to work -->
+    <requirements>
+    	<requirement type="binary">python</requirement>
+    </requirements>
+    
+    <command interpreter="python">
+        genbanktofasta.py $input $output
+    </command>
+    
+    <!-- [REQUIRED] Input files and tool parameters -->
+    <inputs>
+        <param name="input" type="data" format="genbank" label="Your Genbank input file" help="" />
+    </inputs>
+    
+    <!-- [REQUIRED] Output files -->
+    <outputs>
+        <data name="output" format="fasta" label="${input.name}.fasta" /> <!-- Output file of any format -->
+    </outputs>
+    
+    <!-- [STRONGLY RECOMMANDED] Exit code rules -->
+    <stdio>
+        <!-- [HELP] If no exit code rule is defined, the tool will stop if anything is written to STDERR -->
+        <exit_code range="1:" level="fatal" />
+    </stdio>
+    
+    
+    <!-- [OPTIONAL] Help displayed in Galaxy -->
+    <help>
+
+
+================
+GenBank to Fasta
+================
+
+-----------
+Description
+-----------
+
+	| This tool converts a GenBank file to FASTA nucleotides format.
+	| Reference: http://www.warwick.ac.uk/go/peter_cock/python/genbank2fasta/
+
+
+    </help>
+    
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/repository_dependencies.xml	Sat Nov 01 10:34:38 2014 -0400
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<repositories description="GenBank to FASTA tool requires the Galaxy applicable data format GenBank">
+	<repository changeset_revision="a4a890259b82" name="genbank_complete_datatype" owner="mons" toolshed="https://testtoolshed.g2.bx.psu.edu" />
+</repositories>