Mercurial > repos > nml > fasta2bed
annotate 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 |
rev | line source |
---|---|
0
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
1 #!/usr/bin/env perl |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
2 use strict; |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
3 use warnings; |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
4 use Bio::SeqIO; |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
5 use Bio::Seq; |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
6 use Getopt::Long; |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
7 |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
8 my ($fasta_file, $out); |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
9 |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
10 GetOptions( |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
11 "i|input=s" => \$fasta_file, #contigs fasta file |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
12 "o|output=s" => \$out |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
13 ); |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
14 |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
15 my $seqio_object= Bio::SeqIO->new (-format =>'fasta', -file=>$fasta_file); |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
16 open(my $out_fh, ">", $out) || die "Could write to file '$out'\n"; |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
17 |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
18 while (my $seq_object = $seqio_object->next_seq()) { |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
19 my $seq_id = $seq_object->display_id(); |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
20 my $length = $seq_object->length(); |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
21 print $out_fh $seq_id . "\t" . "1" . "\t" . $length . "\t" . $seq_id . "\n"; |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
22 |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
23 } |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
24 |
1b3c339fd390
planemo upload for repository https://github.com/phac-nml/galaxy_tools commit a0204b99a722240fe9b03b78a0786b30aa8ecc96
nml
parents:
diff
changeset
|
25 |