
>dc           @   sj   d  d l  m Z m Z d  d l m Z d  d l m Z d Z d Z d Z	 d d  Z
 d	   Z d
   Z d S(   i(   t	   Fast5Filet   Fast5FileTypeError(   t   _clean(   t   MultiFast5Files
   multi-reads   single-readt   bulkt   rc         C   s*   t  |   r t |  |  St |  |  Sd  S(   N(   t   is_multi_readR   R    (   t   filepatht   mode(    (    sF   /tmp/pip-install-m8tpmx/ont-fast5-api/ont_fast5_api/fast5_interface.pyt   get_fast5_file   s    c         C   s   y t  |  j j d  SWnx t k
 r t |  j  d k rA t St g  |  j D] } | j d  rN | ^ qN  d k r| t Sd |  j k r t Sn Xt d j	 |  j
    d  S(   Nt	   file_typei    t   read_t   UniqueGlobalKeysO   Fast5 file type could not be identified as single- or multi-read. 
Filepath: {}(   R   t   handlet   attrst   KeyErrort   lent
   MULTI_READt
   startswitht   SINGLE_READt	   TypeErrort   formatt   filename(   t   f5_filet   read(    (    sF   /tmp/pip-install-m8tpmx/ont-fast5-api/ont_fast5_api/fast5_interface.pyt   check_file_type   s    7	c         C   s   t  |  d d o } t |  } | t k r1 t S| t k rA t S| t k re t d j |     n  t	 d j | |     Wd QXd S(   sy   
    Determine if a file is a MultiFast5File, True if it is, False if it is a single Fast5File error for other types
    R   R   s2   ont_fast5_api does not support bulk fast files: {}s$   Unknown file type: '{}' for file: {}N(
   R   R   R   t   TrueR   t   Falset
   BULK_FAST5t   NotImplementedErrorR   R   (   R   R   R
   (    (    sF   /tmp/pip-install-m8tpmx/ont-fast5-api/ont_fast5_api/fast5_interface.pyR   $   s    N(   t   ont_fast5_api.fast5_fileR    R   t   ont_fast5_api.fast5_infoR   t   ont_fast5_api.multi_fast5R   R   R   R   R	   R   R   (    (    (    sF   /tmp/pip-install-m8tpmx/ont-fast5-api/ont_fast5_api/fast5_interface.pyt   <module>   s   	