Mercurial > repos > andreu > qcma
annotate HumMeth27QCReport/HumMeth27QCReport.py @ 0:55561a945415 default tip
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
author | andreu |
---|---|
date | Tue, 07 Jun 2011 17:26:58 -0400 |
parents | |
children |
rev | line source |
---|---|
0
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
1 # Based on rgQC.py by ross lazarus (Version from 20100914) |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
2 |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
3 ######################################################################## |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
4 # HumMeth27QCReport.py a parser of the HumMeth27QCReport R package |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
5 # Copyright (C) 2011 Andreu Alibes (aalibes@gmail.com) |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
6 # |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
8 # it under the terms of the GNU General Public License as published by |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
10 # (at your option) any later version. |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
11 # |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
15 # GNU General Public License for more details. |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
16 # |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
17 # You should have received a copy of the GNU General Public License |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
19 ######################################################################## |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
20 from optparse import OptionParser |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
21 import os, sys |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
22 |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
23 if __name__ == "__main__": |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
24 u = """ called in xml as |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
25 <command interpreter="python"> |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
26 HumMeth27QCReport.py -a '$inputAVE' -c '$inputCTRL' -s '$inputSAMPLE' -d '$inputDISC' -l '$platform' -v '$pval' -m '$ClustMethod' -x '$ChrX' |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
27 -1 '$oQualityCheck' -2 '$oSample' -3 '$oInternalControl' -4 '$oExplorativeAnalysis' -5 '$oNormalizedMvalues' -6 '$oQC_Analysis' -p '$oQualityCheck.files_path' |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
28 </command> |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
29 |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
30 """ |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
31 progname = os.path.basename(sys.argv[0]) |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
32 if len(sys.argv) < 14: |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
33 print '%s requires at least 14 parameters - got %d = %s' % (progname,len(sys.argv),sys.argv) |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
34 sys.exit(1) |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
35 parser = OptionParser(usage=u, version="%prog 0.01") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
36 a = parser.add_option |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
37 a("-a","--avefile",dest="avefile") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
38 a("-c","--ctrfile",dest="ctrfile") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
39 a("-s","--smplfile",dest="smplfile") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
40 a("-d","--discfile",dest="discfile") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
41 a("-l","--platf",dest="platf") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
42 a("-v","--pval",dest="pval") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
43 a("-m","--clustmethd",dest="clustmethd") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
44 a("-x","--chrx",dest="chrx") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
45 a("-1","--oQualityCheck",dest="oQualityCheck") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
46 a("-2","--oSample",dest="oSample") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
47 a("-3","--oInternalControl",dest="oInternalControl") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
48 a("-4","--oExplorativeAnalysis",dest="oExplorativeAnalysis") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
49 a("-5","--oNormalizedMvalues",dest="oNormalizedMvalues") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
50 a("-6","--oQC_Analysis",dest="oQC_Analysis") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
51 a("-p","--patho",dest="newfpath") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
52 |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
53 (options,args) = parser.parse_args() |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
54 avefile = options.avefile |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
55 ctrfile = options.ctrfile |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
56 smplfile = options.smplfile |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
57 discfile = options.discfile |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
58 platf = options.platf |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
59 pval = options.pval |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
60 clustmethd = options.clustmethd |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
61 chrx = options.chrx |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
62 oQualityCheck = options.oQualityCheck |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
63 oSample = options.oSample |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
64 oInternalControl = options.oInternalControl |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
65 oExplorativeAnalysis = options.oExplorativeAnalysis |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
66 oNormalizedMvalues = options.oNormalizedMvalues |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
67 oQC_Analysis = options.oQC_Analysis |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
68 |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
69 newfpath = options.newfpath |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
70 newfpath = os.path.realpath(newfpath) |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
71 try: |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
72 os.makedirs(newfpath) |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
73 except: |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
74 pass |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
75 try: |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
76 os.system("cp " + avefile + " " + newfpath+"/AvgBeta.txt") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
77 os.system("cp " + ctrfile + " " + newfpath+"/Control.txt") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
78 os.system("cp " + smplfile + " " + newfpath+"/Sample.txt") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
79 if(discfile != 'None'): |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
80 os.system("cp " + discfile + " " + newfpath+"/Discard.txt") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
81 |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
82 execstring = "/data/apache/galaxy.test.crg/htdocs/galaxy-dist/tools/CRG-Tools/HumMeth27QCReport.R \"Directory=\'"+newfpath+"\'\" \"Plat=\'"+platf+"\'\" \"pvalue=\'"+pval+"\'\" \"chrom=\'"+chrx+"\'\" \"method=\'"+clustmethd+"\'\"" |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
83 os.system(execstring + " 2> /dev/null") |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
84 os.system("cd " + newfpath + "; mv Sample.pdf " + oSample + "; mv InternalControl.pdf " + oInternalControl + ";mv QualityCheck.pdf " + oQualityCheck + ";mv ExplorativeAnalysis.pdf " + oExplorativeAnalysis + ";mv NormalizedMvalues.txt " + oNormalizedMvalues + ";mv QC_Analysis.xls " + oQC_Analysis ) |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
85 except: |
55561a945415
Migrated tool version 1.0 from old tool shed archive to new tool shed repository
andreu
parents:
diff
changeset
|
86 pass |