Beispiel #1
0
 def filter_out_seq_from_files(self, final_paths):
     """Filter out a sequence"""
     pattern = self.options.new_parser_filter_out_seq
     for path in final_paths:
         if path.lower().endswith('.gz'):
             f, out = gzip.open(path, 'rb'), gzip.open(path + '.temp', 'wb')
         else:
             f, out = open(path, 'r'), open(path + '.temp', 'w')
         for rec in barcode_splitter.read_fastq(f):
             rec['seq'], rec['qual'] = self.filter_out_from_seq(
                 pattern, rec['seq'], rec['qual'])
             if rec['seq']:
                 #Don't write out a record if we've filtered the whole read
                 out.write(barcode_splitter.fastq_string(rec))
         f.close()
         out.close()
         shutil.move(path + '.temp', path)
Beispiel #2
0
 def filter_out_seq_from_files(self, final_paths):
     """Filter out a sequence"""
     pattern = self.options.new_parser_filter_out_seq
     for path in final_paths:
         if path.lower().endswith('.gz'):
             f, out = gzip.open(path, 'rb'), gzip.open(path + '.temp', 'wb')
         else:
             f, out = open(path, 'r'), open(path + '.temp', 'w')
         for rec in barcode_splitter.read_fastq(f):
             rec['seq'], rec['qual'] = self.filter_out_from_seq(
                 pattern, rec['seq'], rec['qual'])
             if rec['seq']:
                 #Don't write out a record if we've filtered the whole read
                 out.write(barcode_splitter.fastq_string(rec))
         f.close()
         out.close()
         shutil.move(path + '.temp', path)