def set_read_type(self, rlen_sample_size=<NUM_LIT:10>, permissive=True):
<EOL>for attr in ["<STR_LIT>", "<STR_LIT>", "<STR_LIT>"]:<EOL><INDENT>if not hasattr(self, attr):<EOL><INDENT>_LOGGER.log(<NUM_LIT:5>, "<STR_LIT>",<EOL>attr)<EOL>setattr(self, attr, None)<EOL><DEDENT><DEDENT>if not self.ngs_inputs:<EOL><INDENT>return False<EOL><DEDENT>ngs_paths = "<STR_LIT:U+0020>".join(self.ngs_inputs)<EOL>existing_files = list()<EOL>missing_files = list()<EOL>for path in ngs_paths.split("<STR_LIT:U+0020>"):<EOL><INDENT>if not os.path.exists(path):<EOL><INDENT>missing_files.append(path)<EOL><DEDENT>else:<EOL><INDENT>existing_files.append(path)<EOL><DEDENT><DEDENT>_LOGGER.debug("<STR_LIT>".<EOL>format(len(existing_files), existing_files))<EOL>_LOGGER.debug("<STR_LIT>".<EOL>format(len(missing_files), missing_files))<EOL>files = list()<EOL>check_by_ftype = {"<STR_LIT>": check_bam, "<STR_LIT>": check_fastq}<EOL>for input_file in existing_files:<EOL><INDENT>try:<EOL><INDENT>file_type = parse_ftype(input_file)<EOL>read_lengths, paired = check_by_ftype[file_type](<EOL>input_file, rlen_sample_size)<EOL><DEDENT>except (KeyError, TypeError):<EOL><INDENT>message = "<STR_LIT>".format(<EOL>check_by_ftype.keys())<EOL>if not permissive:<EOL><INDENT>raise TypeError(message)<EOL><DEDENT>_LOGGER.error(message)<EOL>return<EOL><DEDENT>except NotImplementedError as e:<EOL><INDENT>if not permissive:<EOL><INDENT>raise<EOL><DEDENT>_LOGGER.warning(e.message)<EOL>return<EOL><DEDENT>except IOError:<EOL><INDENT>if not permissive:<EOL><INDENT>raise<EOL><DEDENT>_LOGGER.error("<STR_LIT>"<EOL>"<STR_LIT>", str(input_file))<EOL>for feat_name in self._FEATURE_ATTR_NAMES:<EOL><INDENT>if not hasattr(self, feat_name):<EOL><INDENT>setattr(self, feat_name, None)<EOL><DEDENT><DEDENT>return<EOL><DEDENT>except OSError as e:<EOL><INDENT>_LOGGER.error(str(e) + "<STR_LIT>".format(input_file))<EOL>for feat_name in self._FEATURE_ATTR_NAMES:<EOL><INDENT>if not hasattr(self, feat_name):<EOL><INDENT>setattr(self, feat_name, None)<EOL><DEDENT><DEDENT>return<EOL><DEDENT>rlen, _ = sorted(read_lengths.items(), key=itemgetter(<NUM_LIT:1>))[-<NUM_LIT:1>]<EOL>_LOGGER.log(<NUM_LIT:5>,<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(<EOL>rlen, read_lengths))<EOL>if paired > (rlen_sample_size / <NUM_LIT:2>):<EOL><INDENT>read_type = "<STR_LIT>"<EOL>paired = True<EOL><DEDENT>else:<EOL><INDENT>read_type = "<STR_LIT>"<EOL>paired = False<EOL><DEDENT>files.append([rlen, read_type, paired])<EOL><DEDENT>for i, feature in enumerate(self._FEATURE_ATTR_NAMES):<EOL><INDENT>feature_values = set(f[i] for f in files)<EOL>if <NUM_LIT:1> == len(feature_values):<EOL><INDENT>feat_val = files[<NUM_LIT:0>][i]<EOL><DEDENT>else:<EOL><INDENT>_LOGGER.log(<NUM_LIT:5>, "<STR_LIT>",<EOL>len(feature_values), len(files), feature)<EOL>feat_val = None<EOL><DEDENT>_LOGGER.log(<NUM_LIT:5>, "<STR_LIT>",<EOL>feature, self.__class__.__name__, feat_val)<EOL>setattr(self, feature, feat_val)<EOL>if getattr(self, feature) is None and len(existing_files) > <NUM_LIT:0>:<EOL><INDENT>_LOGGER.warning("<STR_LIT>",<EOL>feature, self.name)<EOL><DEDENT><DEDENT>
For a sample with attr `ngs_inputs` set, this sets the 
read type (single, paired) and read length of an input file.

:param int rlen_sample_size: Number of reads to sample to infer read type,
    default 10.
:param bool permissive: whether to simply log a warning or error message
    rather than raising an exception if sample file is not found or 
    otherwise cannot be read, default True.