Mercurial > repos > sblanck > mpagenomics_wrappers
comparison mpagenomics_normalize-7dc6ce39fb89/extractCN.py @ 0:84b13b0e2b85
Uploaded
| author | sblanck |
|---|---|
| date | Thu, 07 May 2015 08:22:36 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:84b13b0e2b85 |
|---|---|
| 1 import os | |
| 2 import sys | |
| 3 import subprocess | |
| 4 import getopt | |
| 5 | |
| 6 def main(argv): | |
| 7 | |
| 8 symmetrize="False" | |
| 9 | |
| 10 try: | |
| 11 opts, args = getopt.getopt(argv,"hc:i:o:f:s:y:t:p:l:g:n:u:",["chrom=","input=","output=","new_file_path=","settings_type=","settings_tumor=","symmetrize=","outputlog=","log=","settings_signal=","settings_snp=","userid="]) | |
| 12 except getopt.GetoptError as err: | |
| 13 print str(err) | |
| 14 sys.exit(2) | |
| 15 for opt, arg in opts: | |
| 16 if opt == '-h': | |
| 17 print 'extractCN.py' | |
| 18 sys.exit() | |
| 19 elif opt in ("-c", "--chrom"): | |
| 20 chromosome = arg | |
| 21 elif opt in ("-i", "--input"): | |
| 22 input_file = arg | |
| 23 elif opt in ("-o", "--output"): | |
| 24 output_file = arg | |
| 25 elif opt in ("-f", "--new_file_path"): | |
| 26 tmp_dir = arg | |
| 27 elif opt in ("-s", "--settings_type"): | |
| 28 input_type = arg | |
| 29 elif opt in ("-t", "--settings_tumor"): | |
| 30 settings_tumor = arg | |
| 31 elif opt in ("-y", "--symmetrize"): | |
| 32 symmetrize = arg | |
| 33 elif opt in ("-p", "--outputlog"): | |
| 34 outputlog = arg | |
| 35 elif opt in ("-l", "--log"): | |
| 36 log = arg | |
| 37 elif opt in ("-g", "--settings_signal"): | |
| 38 signal = arg | |
| 39 elif opt in ("-n", "--settings_snp"): | |
| 40 snp = arg | |
| 41 elif opt in ("-u", "--userid"): | |
| 42 user_id = arg | |
| 43 | |
| 44 | |
| 45 | |
| 46 #=========================================================================== | |
| 47 #chromosome=sys.argv[1] | |
| 48 #input_file=sys.argv[2] | |
| 49 # output_file=sys.argv[3] | |
| 50 # tmp_dir=sys.argv[4] | |
| 51 # input_type=sys.argv[5] | |
| 52 # settings_tumor=sys.argv[6] | |
| 53 # outputlog=sys.argv[7] | |
| 54 # log=sys.argv[8] | |
| 55 # signal=sys.argv[9] | |
| 56 # snp=sys.argv[10] | |
| 57 # user_id=sys.argv[11] | |
| 58 #=========================================================================== | |
| 59 script_dir=os.path.dirname(os.path.abspath(__file__)) | |
| 60 | |
| 61 iFile=open(input_file,'r') | |
| 62 dataSetLine=iFile.readline() | |
| 63 dataset=dataSetLine.split("\t")[1] | |
| 64 iFile.close() | |
| 65 | |
| 66 if (outputlog=="TRUE"): | |
| 67 errfile=open(log,'w') | |
| 68 else: | |
| 69 errfile=open(os.path.join(tmp_dir,"errfile.log"),'w') | |
| 70 | |
| 71 retcode=subprocess.call(["Rscript", os.path.join(script_dir,"extractCN.R"), chromosome, dataset, output_file, tmp_dir, input_type, settings_tumor, signal,snp,user_id, symmetrize], stdout = errfile, stderr = errfile) | |
| 72 | |
| 73 errfile.close() | |
| 74 | |
| 75 sys.exit(retcode) | |
| 76 | |
| 77 if __name__ == "__main__": | |
| 78 main(main(sys.argv[1:])) |
