Mercurial > repos > nml > getmlst
annotate getmlst.pl @ 0:c2e910327131 draft default tip
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
author | nml |
---|---|
date | Fri, 17 Nov 2017 11:49:10 -0500 |
parents | |
children |
rev | line source |
---|---|
0
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
1 #!/usr/bin/env perl |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
2 |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
3 use strict; |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
4 use warnings; |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
5 use Cwd; |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
6 use File::Copy; |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
7 |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
8 my ($mlst_db, $mlst_defs, $species) = @ARGV; |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
9 |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
10 $species =~ s/__pd__/#/ig; |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
11 |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
12 my $command = "getmlst.py --species '$species'"; |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
13 |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
14 my $rv = system($command); |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
15 |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
16 if ($rv == 0) |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
17 { |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
18 #need to find output files in the dir |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
19 my $cur_dir = getcwd(); |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
20 |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
21 foreach my $file (<$cur_dir/*>) |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
22 { |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
23 if ($file =~ /\.fasta$/) |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
24 { |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
25 move($file, $mlst_db); |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
26 } |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
27 elsif ($file =~/\.txt$/) |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
28 { |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
29 move($file, $mlst_defs); |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
30 } |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
31 } |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
32 } |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
33 $rv = $rv >> 8; |
c2e910327131
planemo upload commit 132092ff7fe1c4810d1221054419389180b81657
nml
parents:
diff
changeset
|
34 exit $rv; |