diff segmentFracB.py @ 8:d5ed62b4d3ac draft default tip

planemo upload for repository https://github.com/sblanck/MPAgenomics4Galaxy/tree/master/mpagenomics_wrappers commit 689d0d8dc899a683ee18700ef385753559850233
author sblanck
date Tue, 12 May 2020 13:40:07 +0000
parents f2d24110f65a
children
line wrap: on
line diff
--- a/segmentFracB.py	Fri Apr 10 13:32:59 2020 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-import os
-import sys
-import subprocess
-import zipfile
-import getopt
-
-
-def main(argv):
-       
-    try:
-        opts, args = getopt.getopt(argv,"hc:i:o:f:s:og:fig:t:p:l:u:m:",["chrom=","input=","output=","new_file_path=","settings_type=","output_graph=","zip_figures=","settings_tumor=","outputlog=","log=","userid=","method="])
-    except getopt.GetoptError as err:
-        print str(err)
-        sys.exit(2)
-    for opt, arg in opts:
-        if opt == '-h':
-            print 'extractCNopts.py'
-            sys.exit()
-        elif opt in ("-c", "--chrom"):
-            chromosome = arg
-        elif opt in ("-i", "--input"):
-            input_file = arg
-        elif opt in ("-o", "--output"):
-            output_file = arg
-        elif opt in ("-f", "--new_file_path"):
-            tmp_dir = arg
-        elif opt in ("-s", "--settings_type"):
-            input_type = arg
-        elif opt in ("-og", "--output_graph"):
-            output_graph = arg
-        elif opt in ("-fig", "--zip_figures"):
-            zip_file = arg
-        elif opt in ("-t", "--settings_tumor"):
-            tumorcsv = arg
-        elif opt in ("-p", "--outputlog"):
-            outputlog = arg
-        elif opt in ("-l", "--log"):
-            log = arg
-        elif opt in ("-u", "--userid"):
-            user_id = arg
-        elif opt in ("-m", "--method"):
-            method = arg
-  
-    script_dir=os.path.dirname(os.path.abspath(__file__))
-    
-    iFile=open(input_file,'r')
-    dataSetLine=iFile.readline()
-    dataset=dataSetLine.split("\t")[1]
-    iFile.close()
-      
-
-    if input_type=="dataset":
-        input_type=dataset
-
-    if (outputlog=="TRUE"):
-        errfile=open(log,'w')
-    else:
-        errfile=open(os.path.join(tmp_dir,"errfile.log"),'w')
-    
-    fig_dir=os.path.join("mpagenomics",user_id,"figures",dataset,"segmentation/fracB")
-
-    abs_fig_dir=os.path.join(tmp_dir,fig_dir)
-    if (os.path.isdir(abs_fig_dir)) and (output_graph=="TRUE"):
-        old_files=os.listdir(abs_fig_dir)
-        for ifile in old_files:
-            os.remove(os.path.join(abs_fig_dir,ifile))
-           
-        
-    retcode=subprocess.call(["Rscript", os.path.join(script_dir,"segmentFracB.R"),  chromosome, dataset, output_file, tmp_dir, input_type, output_graph, tumorcsv, user_id, method], stdout = errfile, stderr = errfile)
-    
-    errfile.close()
-     
-    if (retcode == 0):
-        if (os.path.isdir(abs_fig_dir)) and (output_graph=="TRUE"):
-        
-            new_files=os.listdir(abs_fig_dir)
-            zipbuf = zipfile.ZipFile(os.path.join(abs_fig_dir,zip_file), 'w', zipfile.ZIP_DEFLATED)
-            for current_file in new_files:
-                fn = os.path.join(abs_fig_dir,current_file)
-                relfn=fn[len(abs_fig_dir)+len(os.sep):]
-                zipbuf.write(fn,relfn)
-        sys.exit(retcode)
-    else:
-        sys.exit(retcode)
-
-if __name__ == "__main__":
-    main(main(sys.argv[1:]))