comparison tools/ngs_simulation/grinder_multiple_outputs.py @ 2:27a15723d4f0

Uploaded
author fangly
date Tue, 04 Oct 2011 01:02:12 -0400
parents 7d26d64539b2
children
comparison
equal deleted inserted replaced
1:7d26d64539b2 2:27a15723d4f0
48 continue 48 continue
49 49
50 # Assign the dataset format 50 # Assign the dataset format
51 if extension == '.txt': 51 if extension == '.txt':
52 format = 'text' 52 format = 'text'
53 elif extension == '.fq':
54 format = 'fastqsanger'
55 elif extension == '.fastq':
56 format = 'fastqsanger'
53 elif extension == '.fa': 57 elif extension == '.fa':
54 format = 'fasta' 58 format = 'fasta'
55 elif extension == '.fna': 59 elif extension == '.fna':
56 format = 'fasta' 60 format = 'fasta'
57 elif extension == '.faa': 61 elif extension == '.faa':
58 format = 'fasta' 62 format = 'fasta'
59 elif extension == '.fasta': 63 elif extension == '.fasta':
60 format = 'fasta' 64 format = 'fasta'
61 elif extension == '.fq':
62 format = 'fastq'
63 elif extension == '.fastq':
64 format = 'fastq'
65 elif extension == '.qual': 65 elif extension == '.qual':
66 format = 'qual' 66 format = 'qual'
67 else: 67 else:
68 stop_err( 'Error: File %s had the unknown extension %s' % ( fname, extension ) ) 68 stop_err( 'Error: File %s had the unknown extension %s' % ( fname, extension ) )
69 69
70 # Assign the dataset name 70 # Assign the dataset name
71 name = '' 71 name = ''
72 match = q.search(basename) 72 match = q.search(basename)
73 if match != None: 73 if match != None:
74 lib_num = match.group(1) 74 lib_num = match.group(1)
75 name = 'lib%s' % lib_num 75 name = 'lib%s-' % lib_num
76 76
77 match = r.search(basename) 77 match = r.search(basename)
78 if match == None: 78 if match == None:
79 stop_err( 'Error: File with basename %s did not have a recognized name' % (basename) ) 79 stop_err( 'Error: File with basename %s did not have a recognized name' % (basename) )
80 80
81 lib_type = match.group(1) 81 lib_type = match.group(1)
82 if format == 'qual': 82 if format == 'qual':
83 lib_type = 'qual' 83 lib_type = 'qual'
84 84
85 name = name + '-' + lib_type 85 name = name + lib_type
86 86
87 # Move the dataset to the proper place 87 # Move the dataset to the proper place
88 optional_spec = 'asdf' 88 #db_ref = ''
89 destination = os.path.join( output_dir, 'primary_%s_%s_visible_%s_%s' % ( output_id, name, format, optional_spec ) ) 89 #destination = os.path.join( output_dir, 'primary_%s_%s_visible_%s_%s' % (output_id, name, format, db_ref) )
90 destination = os.path.join( output_dir, 'primary_%s_%s_visible_%s' % (output_id, name, format) )
90 91
91 print "moving %s to %s" % (source, destination) 92 print "moving %s to %s" % (source, destination)
92 93
93 try: 94 try:
94 os.rename(source, destination) 95 os.rename(source, destination)