def parser(self, log_file): """ @summary : Parse the command results to add information in log_file. @log_file : [str] Path to the sample process log file. """ # Parse output FH_output_seq = SequenceFileReader.factory( self.output_seq ) nb_cleaned = 0 for record in FH_output_seq: nb_cleaned += 1 FH_output_seq.close() # Write result FH_log = Logger( log_file ) FH_log.write( 'Results:\n' ) FH_log.write( "\tnb seq with 3' primer : " + str(nb_cleaned) + '\n' ) FH_log.close()
def parser(self, log_file): """ @summary : Parse the command results to add information in log_file. @log_file : [str] Path to the sample process log file. """ # Parse output FH_output_seq = SequenceFileReader.factory(self.output_seq) nb_cleaned = 0 for record in FH_output_seq: nb_cleaned += 1 FH_output_seq.close() # Write result FH_log = Logger(log_file) FH_log.write('Results:\n') FH_log.write("\tnb seq with 3' primer : " + str(nb_cleaned) + '\n') FH_log.close()
def get_seq_length( input_file, size_separator=None ): """ @summary: Returns the number of sequences by sequences lengths. @param input_file: [str] The sequence file path. @param size_separator: [str] If it exists the size separator in sequence ID. @return: [dict] By sequences lengths the number of sequence. """ nb_by_length = dict() FH_seq = SequenceFileReader.factory( input_file ) for record in FH_seq: nb_seq = 1 if size_separator is not None: nb_seq = int(record.id.rsplit(size_separator, 1)[-1]) seq_length = len(record.string) if not nb_by_length.has_key(str(seq_length)): nb_by_length[str(seq_length)] = 0 nb_by_length[str(seq_length)] += nb_seq FH_seq.close() return nb_by_length
def get_seq_length(input_file, size_separator=None): """ @summary: Returns the number of sequences by sequences lengths. @param input_file: [str] The sequence file path. @param size_separator: [str] If it exists the size separator in sequence ID. @return: [dict] By sequences lengths the number of sequence. """ nb_by_length = dict() FH_seq = SequenceFileReader.factory(input_file) for record in FH_seq: nb_seq = 1 if size_separator is not None: nb_seq = int(record.id.rsplit(size_separator, 1)[-1]) seq_length = len(record.string) if not nb_by_length.has_key(str(seq_length)): nb_by_length[str(seq_length)] = 0 nb_by_length[str(seq_length)] += nb_seq FH_seq.close() return nb_by_length