Mercurial > repos > nml > fasta2bed
diff fasta_to_bed.pl @ 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 |
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"; + +} + +