# HG changeset patch # User rnateam # Date 1445026414 14400 # Node ID ae4d5733272f8b3efc7c8ff869ff9b50f420b334 # Parent 7439ffbd894308e3711cce9c40606006a40bcd88 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/splitfasta commit 03f3cc2000e6ce876a3cb44c55c3fe878a2e7ce3-dirty diff -r 7439ffbd8943 -r ae4d5733272f splitFasta.py --- a/splitFasta.py Wed Jul 08 06:23:46 2015 -0400 +++ b/splitFasta.py Fri Oct 16 16:13:34 2015 -0400 @@ -1,14 +1,13 @@ -import sys, os +#!/usr/bin/env python +import os +import sys +from Bio import SeqIO + if __name__ == "__main__": - #assuming perfect input, read every two lines inpath = sys.argv[1] - file_contents = open(inpath, 'r').readlines() - os.makedirs('splits') - inname = os.path.basename(inpath) - for i in range(0, len(file_contents), 2): - headline = file_contents[i] - outname = headline[1:headline.index(' ')]+'.fa' - outfile = open(os.path.join('splits',outname), 'w') - outfile.write(file_contents[i]) - outfile.write(file_contents[i+1]) - outfile.close() + 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') diff -r 7439ffbd8943 -r ae4d5733272f splitFasta.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/splitFasta.xml Fri Oct 16 16:13:34 2015 -0400 @@ -0,0 +1,44 @@ + + files into a collection + + biopython + + + + + + + + + + + + + + + + + + + + + + + + + + + + @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} + } + + + diff -r 7439ffbd8943 -r ae4d5733272f splitfasta.xml --- a/splitfasta.xml Wed Jul 08 06:23:46 2015 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - outputFormat == 'collection' - - - - outputFormat == 'separate' - - - - - - - @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} - } - - - - diff -r 7439ffbd8943 -r ae4d5733272f test-data/ID1_result1.fasta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/ID1_result1.fasta Fri Oct 16 16:13:34 2015 -0400 @@ -0,0 +1,2 @@ +>ID1 desc +GATACA diff -r 7439ffbd8943 -r ae4d5733272f test-data/ID2_result1.fasta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/ID2_result1.fasta Fri Oct 16 16:13:34 2015 -0400 @@ -0,0 +1,2 @@ +>ID2 desc +GATACAGATACAGATACAGATACAGATACA diff -r 7439ffbd8943 -r ae4d5733272f test-data/ID3_result1.fasta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/ID3_result1.fasta Fri Oct 16 16:13:34 2015 -0400 @@ -0,0 +1,3 @@ +>ID3 desc +GATACAGATACAGATACAGATACAGATACAGATACAGATACAGATACAGATACAGATACA +GATACA diff -r 7439ffbd8943 -r ae4d5733272f test-data/test.fasta --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/test.fasta Fri Oct 16 16:13:34 2015 -0400 @@ -0,0 +1,11 @@ +>ID1 desc +GATACA + + +>ID2 desc +GATACAGATACA +GATACAGA +TACAGATACA +>ID3 desc +GATACAGATACAGATACAGATACAGATACAGATACAGATACAGATACAGATACAGA +TACAGATACA diff -r 7439ffbd8943 -r ae4d5733272f tool_dependencies.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tool_dependencies.xml Fri Oct 16 16:13:34 2015 -0400 @@ -0,0 +1,6 @@ + + + + + +