o
    Uݢg                     @  sJ   d Z ddlmZ ddlmZ ddlZG dd deZG dd dejZdS )	zEInterface for the pyfasta.Fasta API that uses pyfaidx under the hood.    )annotations)
NamedTupleNc                   @  s:   e Zd ZU dZded< ded< ded< ded< ded< d	S )
BedCoordzCoordinates in BED format.strchromintstartendnamestrandN)__name__
__module____qualname____doc____annotations__ r   r   ]/oak/stanford/groups/akundaje/marinovg/programs/cellranger-9.0.1/lib/python/common/pyfasta.pyr      s   
 r   c                      s.   e Zd ZdZdd fddZdd
dZ  ZS )FastaIndexeda  A wrapper around pyfaidx.Fasta that implements a `pyfasta.Fasta` interface.

    This helps upgrade old code that was dependent on `pyfasta.Fasta`. Any new code should directly use pyfaidx.

    .. deprecated::4.0
       Do not use for new code.  Use `pyfaidx` instead.
    FreturnNonec                   s   t  j|d|d dS )zCreate a pyfaidx.Fasta object from a fasta file. Note that the header after the first.

        " " is ignored. And we use 0-based half-open intervals for indexing.
        F)filenameZone_based_attributesbuild_indexN)super__init__)selfZ
fasta_namer   	__class__r   r   r       s   zFastaIndexed.__init__	bed_coordr   pyfaidx.Sequencec                 C  s<   |j dv sJ d|j  | j|j|jd |j|j dkdS )z{Get sequence from chrom, [start, end) and reverse complement if strand.

        (either `+` or `-` or `.`) is `-`
        )-+.zInvalid strand =    r   )r
   r   r	   rc)r   Zget_seqr   r   r	   )r   r   r   r   r   get_sequence_region'   s   z FastaIndexed.get_sequence_region)F)r   r   )r   r   r   r   )r   r   r   r   r   r$   __classcell__r   r   r   r   r      s    r   )	r   
__future__r   typingr   pyfaidxr   ZFastar   r   r   r   r   <module>   s   
