Example #1
0
if(os.path.exists(Output_file)):
    os.remove(Output_file)
    

UW_chr_specific_file = log_dir+"/UW_"+chrName+".bed"
RG_chr_specific_file = log_dir+"/RG_"+chrName+".bed"

cmd1 = 'grep -e "^'+chrName+'\t" '+  RGLAB_MAPPABLE_FILE+' > '+RG_chr_specific_file
cmd2 = 'grep -e "^'+chrName+'\t" '+  WU_MAPPABLE_FILE+' > '+UW_chr_specific_file
commands.getstatusoutput(cmd1) #run first command
commands.getstatusoutput(cmd2) #run second command


op_file = log_dir+"/"+chrName+"_%J.output"
er_file = log_dir+"/"+chrName+"_%J.err"
cpp_cmd = 'bsub -o '+op_file+' -e '+ er_file+' -M'+memory+'000 -R"select[mem>'+memory+'] rusage[mem='+memory+']" '+ cpp_binary_file+" "+UW_chr_specific_file+" "+RG_chr_specific_file+" "+Output_file
commands.getstatusoutput(cpp_cmd)

while not os.path.exists(Output_file):
    time.sleep(1)
#print cpp_cmd
GET_UNION_OF_FEATURES.visualize_overlaps(Output_file,chrName)

#clean up the log dir
files = os.listdir(log_dir)
for f in files:
    fullpath = os.path.join(log_dir,f)
    print fullpath
    os.remove(fullpath)
#os.remove(Output_file)
print numpy.version.version



import GET_UNION_OF_FEATURES

arg = sys.argv
    
UW_mappable_file = arg[1]
RGLAB_mappable_file = arg[2]
result_file         = arg[3]
res_file = open(result_file,'w')

print result_file

UW_coverage    = GET_UNION_OF_FEATURES.get_coverage(UW_mappable_file)
RGLAB_coverage = GET_UNION_OF_FEATURES.get_coverage(RGLAB_mappable_file)
intersect      = UW_coverage.intersection(RGLAB_coverage)
UW_not_RG      = UW_coverage.difference(RGLAB_coverage)
RG_not_UW      = RGLAB_coverage.difference(UW_coverage)
union          = UW_coverage.union(RGLAB_coverage)
inter_len      = len(intersect)
U_not_R_len    = len(UW_not_RG)
R_not_U_len    = len(RG_not_UW)
union_len      = len(union)
del UW_coverage
del RGLAB_coverage
del intersect 
del UW_not_RG
del RG_not_UW
res_file.write("intersection\t UW_but_not_RG\t RG_but_not_UW\t union\n ")