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