annotate sffextract.rb @ 2:ce049751b625 draft default tip

Uploaded
author biowebdb
date Tue, 01 Apr 2014 09:16:51 -0400
parents d27bec235ad9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
1 #!/usr/bin/ruby
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
2 ##########################################################
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
3 ## Wrapper to convert SFF to Fasta
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
4 ##
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
5 ## Author: Biowebdb, 2014
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
6 ##
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
7 ## This tool needs sff_extraxt version 0.28 or higher
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
8 ## in path directory or $SFF_EXTRACT
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
9 ##
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
10 ## This tool need Biowebdb Ruby Lib
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
11 ## (http://biowebdb.org)
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
12 ##
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
13 ##########################################################
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
14 require "logger"
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
15 require "#{ENV['biowebdb']}/bioinformatics/Bioinformatics"
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
16
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
17 c = Bioinformatics.program "Sff"
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
18 c.logger(Logger.new(STDOUT))
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
19 c.workPath="/tmp/"
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
20 c.input = ARGV[0]
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
21 if ARGV.size == 2
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
22 c.format = 'FASTQ'
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
23 else
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
24 c.format = 'FASTA'
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
25 end
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
26 c.outputDir = "/tmp/#{Time.new.strftime("%Y%m%d%H%M%S")}"
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
27 c.execute(c.lineCommand)
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
28
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
29 basename = File.basename(c.input, '.*')
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
30
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
31 if c.format == 'FASTQ'
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
32 Kernel.system("mv #{c.outputDir}/*.fastq #{ARGV[1]}")
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
33 else
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
34 Kernel.system("mv #{c.output} #{ARGV[1]}")
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
35 Kernel.system("mv #{c.outputQual} #{ARGV[2]}")
d27bec235ad9 Uploaded
biowebdb
parents:
diff changeset
36 end