comparison SeqSero2/SeqSero2_package.py @ 12:4ac593d4b40f

planemo upload
author jpayne
date Wed, 14 Aug 2019 17:45:41 -0400
parents eefafc531698
children
comparison
equal deleted inserted replaced
11:f6f0702de3b4 12:4ac593d4b40f
1170 print("assembling...") 1170 print("assembling...")
1171 if int(threads)>4: 1171 if int(threads)>4:
1172 t="4" 1172 t="4"
1173 else: 1173 else:
1174 t=threads 1174 t=threads
1175 new_fasta = None
1175 if os.path.getsize(combined_fq)>100 and (fnameB=="" or os.path.getsize(mapped_fq1)>100):#if not, then it's "-:-:-" 1176 if os.path.getsize(combined_fq)>100 and (fnameB=="" or os.path.getsize(mapped_fq1)>100):#if not, then it's "-:-:-"
1176 if fnameB!="": 1177 if fnameB!="":
1177 subprocess.check_output("spades.py --careful --pe1-s "+combined_fq+" --pe1-1 "+mapped_fq1+" --pe1-2 "+mapped_fq2+" -t "+t+" -o "+outdir,shell=True, stderr=subprocess.STDOUT) 1178 subprocess.check_output("spades.py --careful --pe1-s "+combined_fq+" --pe1-1 "+mapped_fq1+" --pe1-2 "+mapped_fq2+" -t "+t+" -o "+outdir,shell=True, stderr=subprocess.STDOUT)
1178 else: 1179 else:
1179 subprocess.check_output("spades.py --careful --pe1-s "+combined_fq+" -t "+t+" -o "+outdir,shell=True, stderr=subprocess.STDOUT) 1180 subprocess.check_output("spades.py --careful --pe1-s "+combined_fq+" -t "+t+" -o "+outdir,shell=True, stderr=subprocess.STDOUT)
1189 xmlfile="NA" 1190 xmlfile="NA"
1190 return xmlfile,new_fasta 1191 return xmlfile,new_fasta
1191 1192
1192 def judge_subspecies(fnameA): 1193 def judge_subspecies(fnameA):
1193 #seqsero2 -a; judge subspecies on just forward raw reads fastq 1194 #seqsero2 -a; judge subspecies on just forward raw reads fastq
1194 salmID_output=subprocess.check_output("../SalmID/SalmID.py -i "+fnameA, shell=True, stderr=subprocess.STDOUT) 1195 salmID_output=subprocess.check_output(os.path.join(dirpath, "SalmID/SalmID.py") + ' -i ' +fnameA, shell=True, stderr=subprocess.STDOUT)
1195 #out, err = salmID_output.communicate() 1196 #out, err = salmID_output.communicate()
1196 #out=out.decode("utf-8") 1197 #out=out.decode("utf-8")
1197 out = salmID_output.decode("utf-8") 1198 out = salmID_output.decode("utf-8")
1198 file=open("data_log.txt","a") 1199 file=open("data_log.txt","a")
1199 file.write(out) 1200 file.write(out)
1254 #subprocess.check_output("cp "+dirpath+"/"+database+" "+" ".join(input_file)+" "+make_dir,shell=True, stderr=subprocess.STDOUT) 1255 #subprocess.check_output("cp "+dirpath+"/"+database+" "+" ".join(input_file)+" "+make_dir,shell=True, stderr=subprocess.STDOUT)
1255 subprocess.check_output("ln -srf "+dirpath+"/"+database+" "+" ".join(input_file)+" "+make_dir,shell=True, stderr=subprocess.STDOUT) 1256 subprocess.check_output("ln -srf "+dirpath+"/"+database+" "+" ".join(input_file)+" "+make_dir,shell=True, stderr=subprocess.STDOUT)
1256 ############################begin the real analysis 1257 ############################begin the real analysis
1257 if analysis_mode=="a": 1258 if analysis_mode=="a":
1258 if data_type in ["1","2","3"]:#use allele mode 1259 if data_type in ["1","2","3"]:#use allele mode
1260 H1_cont_stat_list = H2_cont_stat_list = []
1259 for_fq,rev_fq=get_input_files(make_dir,input_file,data_type,dirpath) 1261 for_fq,rev_fq=get_input_files(make_dir,input_file,data_type,dirpath)
1260 os.chdir(make_dir) 1262 os.chdir(make_dir)
1261 ###add a function to tell input files 1263 ###add a function to tell input files
1262 fnameA=for_fq.split("/")[-1] 1264 fnameA=for_fq.split("/")[-1]
1263 fnameB=rev_fq.split("/")[-1] 1265 fnameB=rev_fq.split("/")[-1]