Mercurial > repos > rnateam > splitfasta
changeset 0:f6d6b62540f8 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/splitfasta commit 03f3cc2000e6ce876a3cb44c55c3fe878a2e7ce3-dirty
author | rnateam |
---|---|
date | Fri, 16 Oct 2015 16:13:08 -0400 |
parents | |
children | 87bdbac78136 |
files | splitFasta.py splitFasta.xml test-data/ID1_result1.fasta test-data/ID2_result1.fasta test-data/ID3_result1.fasta test-data/test.fasta tool_dependencies.xml |
diffstat | 7 files changed, 81 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/splitFasta.py Fri Oct 16 16:13:08 2015 -0400 @@ -0,0 +1,13 @@ +#!/usr/bin/env python +import os +import sys +from Bio import SeqIO + +if __name__ == "__main__": + inpath = sys.argv[1] + os.mkdir('splits') + with open(inpath, 'r') as handle: + for record in SeqIO.parse(handle, 'fasta'): + header = os.path.join('splits', record.id + '.fasta') + with open(header, 'w') as handle2: + SeqIO.write([record], handle2, 'fasta')
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/splitFasta.xml Fri Oct 16 16:13:08 2015 -0400 @@ -0,0 +1,44 @@ +<tool id="rbc_splitfasta" name="Split Fasta" version="0.2.0"> + <description>files into a collection</description> + <requirements> + <requirement type="package" version="1.65">biopython</requirement> + </requirements> + <stdio> + <exit_code range="1:" /> + </stdio> + <command interpreter="python"> + <![CDATA[ + splitFasta.py $inputFile + ]]></command> + <inputs> + <param name="inputFile" type="data" format="fasta" label="Fasta file to split"/> + </inputs> + <outputs> + <collection name="splitted_fasta" type="list" label="Sequence collection in FASTA format"> + <discover_datasets pattern="(?P<designation>.*)" directory="splits" ext="fasta" visible="false"/> + </collection> + </outputs> + <tests> + <test> + <param name="inputFile" value="test.fasta" /> + <output_collection name="splitted_fasta"> + <element name="ID1.fasta" file="ID1_result1.fasta" ftype="fasta" /> + <element name="ID2.fasta" file="ID2_result1.fasta" ftype="fasta" /> + <element name="ID3.fasta" file="ID3_result1.fasta" ftype="fasta" /> + </output_collection> + </test> + </tests> + <help><![CDATA[ + Takes an input file and writes each consecutive two lines to a separate file, in a dataset collection. + ]]></help> + <citations> + <citation type="bibtex"> + @ARTICLE{bgruening_galaxytools, + Author = {Björn Grüning, Cameron Smith, Torsten Houwaart, Nicola Soranzo, Eric Rasche}, + keywords = {bioinformatics, ngs, galaxy, cheminformatics, rna}, + title = {{Galaxy Tools - A collection of bioinformatics and cheminformatics tools for the Galaxy environment}}, + url = {https://github.com/bgruening/galaxytools} + } + </citation> + </citations> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/ID1_result1.fasta Fri Oct 16 16:13:08 2015 -0400 @@ -0,0 +1,2 @@ +>ID1 desc +GATACA
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/ID2_result1.fasta Fri Oct 16 16:13:08 2015 -0400 @@ -0,0 +1,2 @@ +>ID2 desc +GATACAGATACAGATACAGATACAGATACA
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/ID3_result1.fasta Fri Oct 16 16:13:08 2015 -0400 @@ -0,0 +1,3 @@ +>ID3 desc +GATACAGATACAGATACAGATACAGATACAGATACAGATACAGATACAGATACAGATACA +GATACA
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/test.fasta Fri Oct 16 16:13:08 2015 -0400 @@ -0,0 +1,11 @@ +>ID1 desc +GATACA + + +>ID2 desc +GATACAGATACA +GATACAGA +TACAGATACA +>ID3 desc +GATACAGATACAGATACAGATACAGATACAGATACAGATACAGATACAGATACAGA +TACAGATACA
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_dependencies.xml Fri Oct 16 16:13:08 2015 -0400 @@ -0,0 +1,6 @@ +<?xml version="1.0"?> +<tool_dependency> + <package name="biopython" version="1.65"> + <repository changeset_revision="f8d72690eeae" name="package_biopython_1_65" owner="biopython" toolshed="https://testtoolshed.g2.bx.psu.edu" /> + </package> +</tool_dependency>