Mercurial > repos > nml > fasta2bed
changeset 0:1b3c339fd390 draft default tip
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
author | nml |
---|---|
date | Wed, 11 Oct 2017 11:46:25 -0400 |
parents | |
children | |
files | fasta_to_bed.pl fasta_to_bed.xml test-data/contigs.fasta test-data/results.bed |
diffstat | 4 files changed, 95 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fasta_to_bed.pl Wed Oct 11 11:46:25 2017 -0400 @@ -0,0 +1,25 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Bio::SeqIO; +use Bio::Seq; +use Getopt::Long; + +my ($fasta_file, $out); + +GetOptions( + "i|input=s" => \$fasta_file, #contigs fasta file + "o|output=s" => \$out +); + +my $seqio_object= Bio::SeqIO->new (-format =>'fasta', -file=>$fasta_file); +open(my $out_fh, ">", $out) || die "Could write to file '$out'\n"; + +while (my $seq_object = $seqio_object->next_seq()) { + my $seq_id = $seq_object->display_id(); + my $length = $seq_object->length(); + print $out_fh $seq_id . "\t" . "1" . "\t" . $length . "\t" . $seq_id . "\n"; + +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/fasta_to_bed.xml Wed Oct 11 11:46:25 2017 -0400 @@ -0,0 +1,28 @@ +<tool id="fasta2bed" name="Fasta to Bed File" version="1.0.0"> + <description>Create Bed file from Multiple fasta file</description> + <requirements> + <requirement type="package" version="1.6.924">perl-bioperl</requirement> + <requirement type="package" version="2.49">perl-getopt-long</requirement> + </requirements> + <command detect_errors="exit_code"><![CDATA[ + perl $__tool_directory__/fasta_to_bed.pl + -i '$dataset' + -o '$output' + ]]></command> + <inputs> + <param name="dataset" type="data" format="fasta" label="fasta or multifasta file" help="fasta to convert to bed file."/> + </inputs> + <outputs> + <data name="output" format="bed"/> + </outputs> + <tests> + <test> + <param name="dataset" value="contigs.fasta"/> + <output name="output" value="results.bed"/> + </test> + </tests> + <help> + Create a bed file format using the start and end position of one or more fata record in a fasta file. + + </help> +</tool>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/contigs.fasta Wed Oct 11 11:46:25 2017 -0400 @@ -0,0 +1,40 @@ +>lcl|AF319579.1_cds_AAN14420.1_1 [gene=dnaA] [protein=DnaA] [protein_id=AAN14420.1] [location=1090..2430] [gbkey=CDS] +TTGGAAAATATCTCTGATTTATGGAATAGTGCCTTAAAAGAATTAGAAAAAAAGGTAAGCAAGCCAAGTT +ATGAAACCTGGTTAAAATCAACAACTGCTCATAACTTAAAAAAAGATGTATTAACTATTACAGCTCCAAA +TGAATTCGCTCGTGACTGGCTAGAATCTCATTATTCGGAACTAATCTCCGAAACACTTTATGATTTAACA +GGGGCAAAACTAGCTATTCGTTTTATCATTCCCCAAAGTCAGGCAGAAGAGGATATAGATCTCCCTTCTG +TTAAGCAAAAACACGCACATGATGAGTCTAATCACTTACCACAGAGTATGTTAAACCCAAAATATACATT +TGATACATTTGTTATTGGCTCTGGTAATCGTTTTGCACATGCTGCTTCTTTAGCTGTAGCTGAAGCACCA +GCTAAAGCCTATAATCCGCTCTTTATTTACGGGGGCGTTGGACTTGGAAAAACACATTTAATGCACGCAA +TTGGGCATTATGTAATTGAACACAACCCAAATGCAAAAGTTGTATATTTATCATCTGAAAAATTTACAAA +TGAATTTATTAATTCAATTCGTGATAATAAAGCTGTCGATTTTCGTAATAAATATCGTAATGTAGATGTC +TTATTGATAGATGATATTCAATTTCTTGCTGGAAAAGAACAAACACAGGAAGAGTTTTTCCATACATTTA +ATGCGTTACATGAAGAAAGTAAACAAATTGTGATTTCAAGCGATAGACCACCAAAAGAAATCCCAACTTT +AGAAGATCGCCTTCGTTCTCGCTTTGAATGGGGGTTAATTACGGACATTACGCCACCAGATTTAGAAACC +AGAATCGCAATTTTACGTAAAAAAGCAAAAGCAGAAGGTCTTGATATACCAAATGAAGTTATGCTTTATA +TCGCAAATCAAATCGATTCAAATATTCGTGAACTAGAGGGTGCACTTATTCGAGTTGTAGCTTATTCATC +TTTAATTAATAAAGATATGAATGCTGATTTAGCGGCTGAAGCGCTTAAAAATATTATTCCAAACTCTATA +CCTAGAATTATTTCTATTTCTGATATTCAAAAGGCTGTTGGGGGCGTCTATCAAGTAAAATTAGAAGATT +TCAAAGCAAAAAAACGGACAAAATCCGTTGCATTCCCTCGCCAAATTGCGATGTATTTATCACGTGAACT +TACGGACTCATCTTTGCCAAAAATAGGTGAAGAATTTGGTGGCCGCGATCATACAACAGTAATCCATGCT +CACGAAAAAATTTCGAAGCTATTAAAAACGGATACTCAATTACAAAAACACGTTGAAGAAGTTAAGGATA +TTTTAAAATAG +>lcl|AF319579.1_cds_AAN14421.1_2 [gene=dnaN] [protein=DNA polymerase III beta chain] [protein_id=AAN14421.1] [location=2613..3758] [gbkey=CDS] +ATGCGTTTTACAATACAAAAAGACTATCTTGTAAGAAGTGTACAAGATGTAATGAAGGCAGTTTCTTCTC +GTACAACAATTCCAATTCTTACAGGGATTAAAGTTGTAGCAACTGAAGAAGGAGTTACTTTAACAGGTAG +TGATGCAGACATCTCTATCGAATCATTTATCCCAGTCGAAGATGCTGGAAAAGAAATTGTGGAAATTGAA +CAAACAGGAAGTATTATTTTACAAGCAAAATATTTTAGTGAGATCGTAAAAAAATTACCTAAAGAAACTG +TCGAAATTTCTGTAGAAAATCATTTTATGACAAAAATAAAATCTGGAAAATCAGAGTTCAACTTAAATGG +TTTAGATGCTGCTGAATATCCGTTATTACCACAAATCGAAGAACATCATGTATTTAAGATTCCAACAGAT +TTACTAAAGCACATGATTCGTCAAACAGTATTTGCAGTTTCAAGTTCTGAAACAAGACCGATCTTGACAG +GTGTAAACTGGAAGGTATATAACAGCGAGCTAACTTGTATTGCAACAGATAGTCACAGACTAGCACTTCG +TAAAGCAAAAATCGAAGGGTATAATATTGCCGATGAATTTCAAGCGAATGTCGTTATTCCTGGTAAGAGC +TTAAGTGAATTAAGTAAAATTCTAGATGAATCTGAAGAAATGGTAGATATCGTTATTACGGAGTATCAAG +TATTATTCCGTACAAAACATTTATTATTCTTCTCAAGATTATTAGAAGGAAATTATCCAGATACAACGCG +TTTAATTCCAGCTGAAAGTAAAACTGATATATTTGTAAATACAAAAGAATTTTTACAAGCGATTGATCGT +GCGTCGCTGTTAGCAAGAGATGGTCGTAACAACGTTGTTAAATTATCGACATTAGAACAACAGATGTTAG +AGATTTCTTCGAATGCACCAGAAATCGGAAAAGTAGTAGAAGAGGTTCAATGTGAAAATGTAGATGGAGA +AGAATTAAAAATATCTTTTAGTGCAAAATATATGATGGACGCATTAAAGGCTTTAGACAGTACAGAAATT +AAAGTTAGTTTTACTGGAGCGATGAGACCGTTTTTAATTCGCACAGTAAATGATAATTCCATTATCCAAT +TAATTTTACCAGTCCGTACTTACTAA +