annotate seal-galaxy-cc1b1911/seal/generate_sam_header.py @ 0:244073d9abc1 draft default tip

Uploaded
author crs4
date Wed, 15 Oct 2014 09:41:10 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
244073d9abc1 Uploaded
crs4
parents:
diff changeset
1 #!/usr/bin/env python
244073d9abc1 Uploaded
crs4
parents:
diff changeset
2
244073d9abc1 Uploaded
crs4
parents:
diff changeset
3 # Copyright (C) 2011-2014 CRS4.
244073d9abc1 Uploaded
crs4
parents:
diff changeset
4 #
244073d9abc1 Uploaded
crs4
parents:
diff changeset
5 # This file is part of Seal.
244073d9abc1 Uploaded
crs4
parents:
diff changeset
6 #
244073d9abc1 Uploaded
crs4
parents:
diff changeset
7 # Seal is free software: you can redistribute it and/or modify it
244073d9abc1 Uploaded
crs4
parents:
diff changeset
8 # under the terms of the GNU General Public License as published by the Free
244073d9abc1 Uploaded
crs4
parents:
diff changeset
9 # Software Foundation, either version 3 of the License, or (at your option)
244073d9abc1 Uploaded
crs4
parents:
diff changeset
10 # any later version.
244073d9abc1 Uploaded
crs4
parents:
diff changeset
11 #
244073d9abc1 Uploaded
crs4
parents:
diff changeset
12 # Seal is distributed in the hope that it will be useful, but
244073d9abc1 Uploaded
crs4
parents:
diff changeset
13 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
244073d9abc1 Uploaded
crs4
parents:
diff changeset
14 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
244073d9abc1 Uploaded
crs4
parents:
diff changeset
15 # for more details.
244073d9abc1 Uploaded
crs4
parents:
diff changeset
16 #
244073d9abc1 Uploaded
crs4
parents:
diff changeset
17 # You should have received a copy of the GNU General Public License along
244073d9abc1 Uploaded
crs4
parents:
diff changeset
18 # with Seal. If not, see <http://www.gnu.org/licenses/>.
244073d9abc1 Uploaded
crs4
parents:
diff changeset
19
244073d9abc1 Uploaded
crs4
parents:
diff changeset
20
244073d9abc1 Uploaded
crs4
parents:
diff changeset
21
244073d9abc1 Uploaded
crs4
parents:
diff changeset
22 # A really really thin wrapper. We only seem to need it because Galaxy won't
244073d9abc1 Uploaded
crs4
parents:
diff changeset
23 # search for the command in the PATH
244073d9abc1 Uploaded
crs4
parents:
diff changeset
24
244073d9abc1 Uploaded
crs4
parents:
diff changeset
25 import os
244073d9abc1 Uploaded
crs4
parents:
diff changeset
26 import subprocess
244073d9abc1 Uploaded
crs4
parents:
diff changeset
27 import sys
244073d9abc1 Uploaded
crs4
parents:
diff changeset
28
244073d9abc1 Uploaded
crs4
parents:
diff changeset
29 if __name__ == '__main__':
244073d9abc1 Uploaded
crs4
parents:
diff changeset
30 output_path = sys.argv[-1]
244073d9abc1 Uploaded
crs4
parents:
diff changeset
31 try:
244073d9abc1 Uploaded
crs4
parents:
diff changeset
32 # seal merge_alignments won't overwrite an existing file, so we first remove
244073d9abc1 Uploaded
crs4
parents:
diff changeset
33 # the file Galaxy creates for us.
244073d9abc1 Uploaded
crs4
parents:
diff changeset
34 os.remove(output_path)
244073d9abc1 Uploaded
crs4
parents:
diff changeset
35 except IOError:
244073d9abc1 Uploaded
crs4
parents:
diff changeset
36 pass
244073d9abc1 Uploaded
crs4
parents:
diff changeset
37 hadoopized_output_path = 'file://' + os.path.abspath(output_path)
244073d9abc1 Uploaded
crs4
parents:
diff changeset
38 cmd = [ 'seal', 'merge_alignments' ] + sys.argv[1:-1]
244073d9abc1 Uploaded
crs4
parents:
diff changeset
39 cmd.append(hadoopized_output_path)
244073d9abc1 Uploaded
crs4
parents:
diff changeset
40 print "running command:", str(cmd)
244073d9abc1 Uploaded
crs4
parents:
diff changeset
41 subprocess.check_call(cmd)