comparison RM_custom_search.py @ 11:16150c85fb3a draft

Uploaded
author petr-novak
date Tue, 04 Feb 2020 07:39:32 -0500
parents a4cd8608ef6b
children 62fefa284036
comparison
equal deleted inserted replaced
10:768883847008 11:16150c85fb3a
17 try: 17 try:
18 z=zipfile.ZipFile(f) 18 z=zipfile.ZipFile(f)
19 # extract only dirCLXXXX/reads.fas 19 # extract only dirCLXXXX/reads.fas
20 seq_list = [] 20 seq_list = []
21 for filein in z.namelist(): 21 for filein in z.namelist():
22 if filein.lower().startswith("seqclust/clustering/clusters/dir_cl") and filein.endswith("reads.fas"): 22 c1 = filein.lower().startswith("seqclust/clustering/clusters/dir_cl")
23 c2 = filein.endswith("reads.fas")
24 c3 = filein.endswith("reads.fasta") # in newer RE2 versions
25 if c1 and (c2 or c3):
23 outdir = filein.split("/")[3] 26 outdir = filein.split("/")[3]
24 outfile = outdir +"/reads.fas" 27 outfile = outdir +"/reads.fas"
25 source = z.open(filein) 28 source = z.open(filein)
26 os.mkdir(outdir) 29 os.mkdir(outdir)
27 target = open(outfile, "wb") 30 target = open(outfile, "wb")