o
    Rŀg                     @   s^  d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ G dd	 d	eZG d
d deZ	G dd deZ
G dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG d d! d!eZG d"d# d#eZG d$d% d%eZed&krdd'lmZ e  d(S d(S ))z"Command line wrapper for samtools.    )	_Argument)_ArgumentList)_Option)_StaticArgument)_Switch)AbstractCommandlinec                   @      e Zd ZdZdddZdS )SamtoolsViewCommandlinea  Command line wrapper for samtools view.

    Extract/print all or sub alignments in SAM or BAM format, equivalent to::

        $ samtools view [-bchuHS] [-t in.refList] [-o output] [-f reqFlag]
                        [-F skipFlag] [-q minMapQ] [-l library] [-r readGroup]
                        [-R rgFile] <in.bam>|<in.sam> [region1 [...]]

    See http://samtools.sourceforge.net/samtools.shtml for more details

    Examples
    --------
    >>> from Bio.Sequencing.Applications import SamtoolsViewCommandline
    >>> input_file = "/path/to/sam_or_bam_file"
    >>> samtools_view_cmd = SamtoolsViewCommandline(input_file=input_file)
    >>> print(samtools_view_cmd)
    samtools view /path/to/sam_or_bam_file

    samtoolsc                 K   sT  || _ tdtddgdtddgdtdd	gd
tddgdtddgdtddgdtddgddddd dtddgddddd dtd d!gd"dd#d d$td%d&gd'dd(d d$td)d*gd+dd,d d$td-d.gd/dd0d d$td1d2gd3ddd4d dtd5d6gd7dd8d d$td9d:gd;td<d=gd>ddd?td@gdAddBg| _tj| |fi | dCS )DInitialize the class.view-bbzOutput in the BAM formatz-cczInstead of printing the alignments, only count them and
                    print the total number.

                    All filter options, such as '-f', '-F' and '-q',
                    are taken into account-hhz Include the header in the output-uuzOutput uncompressed BAM.

                    This option saves time spent on compression/decompression
                    and is thus preferred when the output is piped to
                    another samtools commandz-HHzOutput the header only-SSzuInput is in SAM.
                    If @SQ header lines are absent,
                    the '-t' option is required.z-tta
  This file is TAB-delimited.
                    Each line must contain the reference name and the
                    length of the reference, one line for each
                    distinct reference; additional fields are ignored.

                    This file also defines the order of the reference
                    sequences in sorting.
                    If you run   'samtools faidx <ref.fa>',
                    the resultant index file <ref.fa>.fai can be used
                    as this <in.ref_list> file.TFc                 S   
   t | tS N
isinstancestrx r   Y/var/www/html/myenv/lib/python3.10/site-packages/Bio/Sequencing/Applications/_samtools.py<lambda>U      
 z2SamtoolsViewCommandline.__init__.<locals>.<lambda>filenameequatechecker_function-ooOutput filec                 S   r   r   r   r   r   r   r    r!   \   r"   -ffzYOnly output alignments with all bits in
                    INT present in the FLAG fieldc                 S   r   r   r   intr   r   r   r    r!   c   r"   r%   r&   -FFz(Skip alignments with bits present in INTc                 S   r   r   r,   r   r   r   r    r!   i   r"   -qqz*Skip alignments with MAPQ smaller than INTc                 S   r   r   r,   r   r   r   r    r!   o   r"   -rrz#Only output reads in read group STRc                 S   r   r   r   r   r   r   r    r!   u   r"   -RRz*Output reads in read groups listed in FILEc                 S   r   r   r   r   r   r   r    r!   |   r"   -llz Only output reads in library STRc                 S   r   r   r   r   r   r   r    r!      r"   -1fast_bamz3Use zlib compression level 1 to compress the outputinput
input_filezInput File Namer$   is_requiredregionRegion)r>   Nprogram_namer   r   r   r   
parametersr   __init__selfcmdkwargsr   r   r    rD   )   s   
dz SamtoolsViewCommandline.__init__Nr
   __name__
__module____qualname____doc__rD   r   r   r   r    r	          r	   c                   @   r   )SamtoolsMpileupCommandlinea  Command line wrapper for samtools mpileup.

    Generate BCF or pileup for one or multiple BAM files, equivalent to::

        $ samtools mpileup [-EBug] [-C capQcoef] [-r reg] [-f in.fa]
                           [-l list] [-M capMapQ] [-Q minBaseQ]
                           [-q minMapQ] in.bam [in2.bam [...]]

    See http://samtools.sourceforge.net/samtools.shtml for more details

    Examples
    --------
    >>> from Bio.Sequencing.Applications import SamtoolsMpileupCommandline
    >>> input = ["/path/to/sam_or_bam_file"]
    >>> samtools_mpileup_cmd = SamtoolsMpileupCommandline(input_file=input)
    >>> print(samtools_mpileup_cmd)
    samtools mpileup /path/to/sam_or_bam_file

    r
   c                 K   s  || _ tdtddgdtddgdtdd	gd
tddgdtddgdddd dtddgdddd dtddgddddd dtdd gd!ddd"d dtd#d$gd%dd&d dtd'd(gd)dd*d dtd+d,gd-dd.d dtd/d0gd1td2d3gd4td5d6gd7ddd8d dtd9d:gd;dd<d dtd=d>gd?td@dAgdBtdCdDgdEddFd dtdGdHgdIddJd dtdKdLgdMtdNdOgdPddQd dtdRdSgdTddUd dtdVdWgdXddYd dtdZgd[ddd\g| _tj| |fi | d]S )^r   mpileup-EEzExtended BAQ computation.
                    This option helps sensitivity especially
                    for MNPs, but may hurt specificity a little bitz-BBaP  Disable probabilistic realignment for the
                    computation of base alignment quality (BAQ).

                    BAQ is the Phred-scaled probability of a read base being
                    misaligned.
                    Applying this option greatly helps to reduce false SNPs
                    caused by misalignmentsz-ggz`Compute genotype likelihoods and output them in the
                    binary call format (BCF)r   r   zkSimilar to -g except that the output is
                    uncompressed BCF, which is preferred for piping-CCa  Coefficient for downgrading mapping quality for
                    reads containing excessive mismatches.

                    Given a read with a phred-scaled probability q of
                    being generated from the mapped position,
                    the new mapping quality is about sqrt((INT-q)/INT)*INT.
                    A zero value disables this functionality;
                    if enabled, the recommended value for BWA is 50Fc                 S   r   r   r,   r   r   r   r    r!      r"   z5SamtoolsMpileupCommandline.__init__.<locals>.<lambda>r.   r3   r4   z"Only generate pileup in region STRc                 S   r   r   r   r   r   r   r    r!      r"   r*   r+   zyThe faidx-indexed reference file in the FASTA format.

                    The file can be optionally compressed by razipTc                 S   r   r   r   r   r   r   r    r!      r"   r#   r7   r8   z{BED or position list file containing a list of regions
                    or sites where pileup or BCF should be generatedc                 S   r   r   r   r   r   r   r    r!      r"   z-MMzCap Mapping Quality at Mc                 S   r   r   r,   r   r   r   r    r!      r"   r1   r2   z3Minimum mapping quality for an alignment to be usedc                 S   r   r   r,   r   r   r   r    r!      r"   -QQz0Minimum base quality for a base to be consideredc                 S   r   r   r,   r   r   r   r    r!      r"   z-6illumina_13z3Assume the quality is in the Illumina 1.3+ encoding-AAz4Do not skip anomalous read pairs in variant calling.r   r   z*List of input BAM files, one file per linec                 S   r   r   r   r   r   r   r    r!   	  r"   z-ddz5At a position, read maximally INT reads per input BAMc                 S   r   r   r,   r   r   r   r    r!     r"   z-DDzOutput per-sample read depthr   r   zROutput per-sample Phred-scaled
                                strand bias P-value-eezqPhred-scaled gap extension sequencing error probability.

                    Reducing INT leads to longer indelsc                 S   r   r   r,   r   r   r   r    r!     r"   r   r   zCoefficient for modeling homopolymer errors.

                    Given an l-long homopolymer run, the sequencing error
                    of an indel of size s is modeled as INT*s/lc                 S   r   r   r,   r   r   r   r    r!   &  r"   -IIzDo not perform INDEL callingz-LLzSSkip INDEL calling if the average per-sample
                    depth is above INTc                 S   r   r   r,   r   r   r   r    r!   .  r"   r'   r(   zpPhred-scaled gap open sequencing error probability.

                    Reducing INT leads to more indel calls.c                 S   r   r   r,   r   r   r   r    r!   6  r"   z-ppa.  Comma delimited list of platforms (determined by @RG-PL)
                    from which indel candidates are obtained.

                    It is recommended to collect indel candidates from
                    sequencing technologies that have low indel error rate
                    such as ILLUMINAc                 S   r   r   r   r   r   r   r    r!   A  r"   r<   z!Input File for generating mpileupr=   N)rB   r   r   r   r   rC   r   rD   rE   r   r   r    rD      s   
		   z#SamtoolsMpileupCommandline.__init__NrI   rJ   r   r   r   r    rP      rO   rP   c                   @   r   )SamtoolsReheaderCommandlinea  Command line wrapper for samtools reheader.

    Replace the header in in.bam with the header
    in in.header.sam, equivalent to::

    $ samtools reheader <in.header.sam> <in.bam>

    See http://samtools.sourceforge.net/samtools.shtml for more details

    Examples
    --------
    >>> from Bio.Sequencing.Applications import SamtoolsReheaderCommandline
    >>> input_header = "/path/to/header_sam_file"
    >>> input_bam = "/path/to/input_bam_file"
    >>> reheader_cmd = SamtoolsReheaderCommandline(input_header=input_header,
    ...                                            input_bam=input_bam)
    >>> print(reheader_cmd)
    samtools reheader /path/to/header_sam_file /path/to/input_bam_file

    r
   c                 K   N   || _ tdtg dddddtg dddddg| _tj| |fi | dS )	r   reheader)input_header
header_samsam_filezSam file with headerTr=   )	input_bamr<   bam_filezBAM file for writing header toNrB   r   r   rC   r   rD   rE   r   r   r    rD   c      z$SamtoolsReheaderCommandline.__init__NrI   rJ   r   r   r   r    rf   M      rf   c                   @   r   )SamtoolsCatCommandlineat  Command line wrapper for samtools cat.

    Concatenate BAMs, equivalent to::

        $ samtools cat [-h header.sam] [-o out.bam] <in1.bam> <in2.bam> [ ... ]

    See http://samtools.sourceforge.net/samtools.shtml for more details

    Examples
    --------
    >>> from Bio.Sequencing.Applications import SamtoolsCatCommandline
    >>> input_bam1 = "/path/to/input_bam1"
    >>> input_bam2 = "/path/to/input_bam2"
    >>> input_bams = [input_bam1, input_bam2]
    >>> samtools_cat_cmd = SamtoolsCatCommandline(input_bam=input_bams)
    >>> print(samtools_cat_cmd)
    samtools cat /path/to/input_bam1 /path/to/input_bam2

    r
   c              	   K   sl   || _ tdtddgddddd d	td
dgddddd d	tg dddddg| _tj| |fi | dS )r   catr   r   zHeader SAM fileTFc                 S   r   r   r   r   r   r   r    r!     r"   z1SamtoolsCatCommandline.__init__.<locals>.<lambda>r#   r'   r(   zOutput SAM filec                 S   r   r   r   r   r   r   r    r!     r"   )r;   rl   bamszInput BAM filesr=   N)rB   r   r   r   rC   r   rD   rE   r   r   r    rD     s0   zSamtoolsCatCommandline.__init__NrI   rJ   r   r   r   r    rq   x  rO   rq   c                   @   r   ) SamtoolsVersion0xSortCommandlineag  Command line wrapper for samtools version 0.1.x sort.

    Concatenate BAMs, equivalent to::

    $ samtools sort [-no] [-m maxMem] <in.bam> <out.prefix>

    See http://samtools.sourceforge.net/samtools.shtml for more details

    Examples
    --------
    >>> from Bio.Sequencing.Applications import SamtoolsVersion0xSortCommandline
    >>> input_bam = "/path/to/input_bam"
    >>> out_prefix = "/path/to/out_prefix"
    >>> samtools_sort_cmd = SamtoolsVersion0xSortCommandline(input=input_bam, out_prefix=out_prefix)
    >>> print(samtools_sort_cmd)
    samtools sort /path/to/input_bam /path/to/out_prefix

    r
   c                 K   sx   || _ tdtddgdtddgdtdd	gd
ddd dtdgddddtdgddddg| _tj| |fi | dS )r   sortr'   r(   zUOutput the final alignment
                                    to the standard output-nn]Sort by read names rather
                                    than by chromosomal coordinates-mm)Approximately the maximum required memoryFc                 S   r   r   r,   r   r   r   r    r!     r"   z;SamtoolsVersion0xSortCommandline.__init__.<locals>.<lambda>r.   r;   zInput BAM fileTr=   
out_prefixzOutput prefixNrA   rE   r   r   r    rD     s(   z)SamtoolsVersion0xSortCommandline.__init__NrI   rJ   r   r   r   r    rt         rt   c                   @   r   ) SamtoolsVersion1xSortCommandlinea  Command line wrapper for samtools version 1.3.x sort.

    Concatenate BAMs, equivalent to::

    $ samtools sort [-n] [-T FREFIX] [-o file] [-I INT] [-m maxMem] <in.bam>

    See http://samtools.sourceforge.net/samtools.shtml for more details

    Examples
    --------
    >>> from Bio.Sequencing.Applications import SamtoolsVersion1xSortCommandline
    >>> input_bam = "/path/to/input_bam"
    >>> FREFIX = "/path/to/out_prefix"
    >>> file_name = "/path/to/out_file"
    >>> samtools_sort_cmd = SamtoolsVersion1xSortCommandline(input=input_bam, T=FREFIX, o=file_name)
    >>> print(samtools_sort_cmd)
    samtools sort -o /path/to/out_file -T /path/to/out_prefix /path/to/input_bam

    r
   c                 K   s   || _ tdtddgdtddgddd	d
 dtddgdddd
 dtddgdddd
 dtddgdddd
 dtddgdddd
 dtdgddddg| _tj| |fi | d S )!r   ru   rv   rw   rx   r'   r(   z`(file) Write the final sorted output to FILE,
                    rather than to standard outputFc                 S   r   r   r   r   r   r   r    r!     r"   z;SamtoolsVersion1xSortCommandline.__init__.<locals>.<lambda>r.   z-OOz4(FORMAT) Write the final output as sam, bam, or cramc                 S   r   r   r   r   r   r   r    r!     r"   z-TTz(PREFIX) Write temporary files to PREFIX.nnnn.bam, or if the specified PREFIX
                    is an existing directory, to PREFIX/samtools.mmm.mmm.tmp.nnnn.bam,
                    where mmm is unique to this invocation of the sort commandc                 S   r   r   r   r   r   r   r    r!     r"   rb   rc   a  (INT) Set the desired compression level for the final output file,
                    ranging from 0 (uncompressed) or 1 (fastest but minimal compression)
                    to 9 (best compression but slowest to write), similarly to gzip(1)'s compression level setting.c                 S   r   r   r   r   r   r   r    r!     r"   ry   rz   r{   c                 S   r   r   r,   r   r   r   r    r!     r"   r;   zInput SAM/BAM/CRAM fileTr=   NrA   rE   r   r   r    rD     sR   
.z)SamtoolsVersion1xSortCommandline.__init__NrI   rJ   r   r   r   r    r~     rO   r~   c                   @   r   )SamtoolsMergeCommandlinea  Command line wrapper for samtools merge.

    Merge multiple sorted alignments, equivalent to::

        $ samtools merge [-nur1f] [-h inh.sam] [-R reg]
                         <out.bam> <in1.bam> <in2.bam> [...]

    See http://samtools.sourceforge.net/samtools.shtml for more details

    Examples
    --------
    >>> from Bio.Sequencing.Applications import SamtoolsMergeCommandline
    >>> out_bam = "/path/to/out_bam"
    >>> in_bam = ["/path/to/input_bam1", "/path/to/input_bam2"]
    >>> merge_cmd = SamtoolsMergeCommandline(out_bam=out_bam,
    ...                                      input_bam=in_bam)
    >>> print(merge_cmd)
    samtools merge /path/to/out_bam /path/to/input_bam1 /path/to/input_bam2

    r
   c                 K   s   || _ tdtddgdtddgdtdd	gd
tddgdtddgdtddgddddd dtddgdddd dtg ddddd tg d!d"ddd g
| _tj| |fi | d#S )$r   mergerv   rw   zhThe input alignments are sorted by read names
                    rather than by chromosomal coordinatesr3   r4   zaAttach an RG tag to each alignment.
                    The tag value is inferred from file namesr   r   zUncompressed BAM outputr9   r:   z^Use zlib compression level 1
                                           to compress the outputr*   r+   zQForce to overwrite the
                                    output file if presentr   r   z`Use the lines of FILE as '@'
                                    headers to be copied to out.bamTFc                 S   r   r   r   r   r   r   r    r!   \  r"   z3SamtoolsMergeCommandline.__init__.<locals>.<lambda>r#   r5   r6   z4Merge files in the specified region indicated by STRc                 S   r   r   r   r   r   r   r    r!   b  r"   r.   )
output_bamout_bamoutoutputzOutput BAM filer=   )rl   in_bamr;   bam	Input BAMN)	rB   r   r   r   r   r   rC   r   rD   rE   r   r   r    rD   <  s\   2z!SamtoolsMergeCommandline.__init__NrI   rJ   r   r   r   r    r   &  rp   r   c                   @   r   )SamtoolsIndexCommandlinea  Command line wrapper for samtools index.

    Index sorted alignment for fast random access, equivalent to::

    $ samtools index <aln.bam>

    See http://samtools.sourceforge.net/samtools.shtml for more details

    Examples
    --------
    >>> from Bio.Sequencing.Applications import SamtoolsIndexCommandline
    >>> input = "/path/to/aln_bam"
    >>> samtools_index_cmd = SamtoolsIndexCommandline(input_bam=input)
    >>> print(samtools_index_cmd)
    samtools index /path/to/aln_bam

    r
   c                 K   6   || _ tdtg ddg| _tj| |fi | dS )r   indexr;   r   rl   BAM file to be indexedNrn   rE   r   r   r    rD     
   z!SamtoolsIndexCommandline.__init__NrI   rJ   r   r   r   r    r   t      r   c                   @   r   )SamtoolsIdxstatsCommandlinea  Command line wrapper for samtools idxstats.

    Retrieve and print stats in the index file, equivalent to::

    $ samtools idxstats <aln.bam>

    See http://samtools.sourceforge.net/samtools.shtml for more details

    Examples
    --------
    >>> from Bio.Sequencing.Applications import SamtoolsIdxstatsCommandline
    >>> input = "/path/to/aln_bam"
    >>> samtools_idxstats_cmd = SamtoolsIdxstatsCommandline(input_bam=input)
    >>> print(samtools_idxstats_cmd)
    samtools idxstats /path/to/aln_bam

    r
   c                 K   r   )r   idxstatsr   r   Nrn   rE   r   r   r    rD     r   z$SamtoolsIdxstatsCommandline.__init__NrI   rJ   r   r   r   r    r     r   r   c                   @   r   )SamtoolsFaidxCommandlinea  Command line wrapper for samtools faidx.

    Retrieve and print stats in the index file, equivalent to::

    $ samtools faidx <ref.fasta> [region1 [...]]

    See http://samtools.sourceforge.net/samtools.shtml for more details

    Examples
    --------
    >>> from Bio.Sequencing.Applications import SamtoolsFaidxCommandline
    >>> reference = "/path/to/reference.fasta"
    >>> samtools_faidx_cmd = SamtoolsFaidxCommandline(reference=reference)
    >>> print(samtools_faidx_cmd)
    samtools faidx /path/to/reference.fasta

    r
   c                 K   s<   || _ tdtg dddddg| _tj| |fi | dS )r   faidx	referencereference_fastarefReference FASTA to be indexedTr=   Nrn   rE   r   r   r    rD     s   	z!SamtoolsFaidxCommandline.__init__NrI   rJ   r   r   r   r    r     r   r   c                   @   r   )SamtoolsFixmateCommandlinea  Command line wrapper for samtools fixmate.

    Fill in mate coordinates, ISIZE and mate related
    flags from a name-sorted alignment, equivalent to::

    $ samtools fixmate <in.nameSrt.bam> <out.bam>

    See http://samtools.sourceforge.net/samtools.shtml for more details

    Examples
    --------
    >>> from Bio.Sequencing.Applications import SamtoolsFixmateCommandline
    >>> in_bam = "/path/to/in.nameSrt.bam"
    >>> out_bam = "/path/to/out.bam"
    >>> fixmate_cmd = SamtoolsFixmateCommandline(input_bam=in_bam,
    ...                                          out_bam=out_bam)
    >>> print(fixmate_cmd)
    samtools fixmate /path/to/in.nameSrt.bam /path/to/out.bam

    r
   c                 K   rg   )	r   fixmater   
sorted_bamrl   r;   r<   Name Sorted Alignment File Tr=   r   r   r   output_filer)   Nrn   rE   r   r   r    rD     ro   z#SamtoolsFixmateCommandline.__init__NrI   rJ   r   r   r   r    r     rp   r   c                   @   r   )SamtoolsRmdupCommandlinea{  Command line wrapper for samtools rmdup.

    Remove potential PCR duplicates, equivalent to::

    $ samtools rmdup [-sS] <input.srt.bam> <out.bam>

    See http://samtools.sourceforge.net/samtools.shtml for more details

    Examples
    --------
    >>> from Bio.Sequencing.Applications import SamtoolsRmdupCommandline
    >>> input_sorted_bam = "/path/to/input.srt.bam"
    >>> out_bam = "/path/to/out.bam"
    >>> rmdup_cmd = SamtoolsRmdupCommandline(input_bam=input_sorted_bam,
    ...                                      out_bam=out_bam)
    >>> print(rmdup_cmd)
    samtools rmdup /path/to/input.srt.bam /path/to/out.bam

    r
   c              
   K   sf   || _ tdtddgdtddgdtg dd	d
d
dtg ddd
d
dg| _tj| |fi | dS )r   rmdupz-sszRemove duplicates for single-end reads.

                    By default, the command works for paired-end
                    reads onlyr   r   zNTreat paired-end reads
                                    as single-end readsr   r   Tr=   r   r)   N)rB   r   r   r   rC   r   rD   rE   r   r   r    rD     s0   z!SamtoolsRmdupCommandline.__init__NrI   rJ   r   r   r   r    r     rO   r   c                   @   r   )SamtoolsCalmdCommandlinea  Command line wrapper for samtools calmd.

    Generate the MD tag, equivalent to::

    $ samtools calmd [-EeubSr] [-C capQcoef] <aln.bam> <ref.fasta>

    See http://samtools.sourceforge.net/samtools.shtml for more details

    Examples
    --------
    >>> from Bio.Sequencing.Applications import SamtoolsCalmdCommandline
    >>> input_bam = "/path/to/aln.bam"
    >>> reference_fasta = "/path/to/reference.fasta"
    >>> calmd_cmd = SamtoolsCalmdCommandline(input_bam=input_bam,
    ...                                      reference=reference_fasta)
    >>> print(calmd_cmd)
    samtools calmd /path/to/aln.bam /path/to/reference.fasta

    r
   c                 K   s   || _ tdtddgdtddgdtdd	gd
tddgdtddgdtddgdtddgdtddgdddd dtg ddd d d!tg d"d#d d d!g| _tj| |fi | d$S )%r   calmdrR   rS   zExtended BAQ calculation.
                    This option trades specificity for sensitivity,
                    though the effect is minor.r`   ra   zConvert the read base to = if it is
                    identical to the aligned reference base.

                    Indel caller does not support the = bases
                    at the moment.r   r   zOutput uncompressed BAMr   r   zOutput compressed BAM r   r   z#The input is SAM with header lines r3   r4   zYCompute the BQ tag (without -A)
                    or cap base quality by BAQ (with -A).r\   r]   z^When used jointly with -r this option overwrites
                    the original base qualityrV   rW   zCoefficient to cap mapping quality
                    of poorly mapped reads.

                    See the pileup command for details.Fc                 S   r   r   r,   r   r   r   r    r!   m  r"   z3SamtoolsCalmdCommandline.__init__.<locals>.<lambda>r.   )r;   r<   r   infilerl   r   Tr=   r   r   NrA   rE   r   r   r    rD   F  sR   	3z!SamtoolsCalmdCommandline.__init__NrI   rJ   r   r   r   r    r   1  rO   r   c                   @   r   )SamtoolsTargetcutCommandlinea  Command line wrapper for samtools targetcut.

    This command identifies target regions by examining the continuity
    of read depth, computes haploid consensus sequences of targets
    and outputs a SAM with each sequence corresponding to a target,
    equivalent to::

        $ samtools targetcut [-Q minBaseQ] [-i inPenalty] [-0 em0]
                             [-1 em1] [-2 em2] [-f ref] <in.bam>

    See http://samtools.sourceforge.net/samtools.shtml for more details

    Examples
    --------
    >>> from Bio.Sequencing.Applications import SamtoolsTargetcutCommandline
    >>> input_bam = "/path/to/aln.bam"
    >>> samtools_targetcut_cmd = SamtoolsTargetcutCommandline(input_bam=input_bam)
    >>> print(samtools_targetcut_cmd)
    samtools targetcut /path/to/aln.bam

    r
   c                 K   s   || _ tdtddgdddd dtd	d
gdddd dtddgddddd dtddgdddd dtddgdddd dtddgdddd dtg dddddg| _tj| |fi | dS ) r   	targetcutrY   rZ   zMinimum Base Quality Fc                 S   r   r   r,   r   r   r   r    r!     r"   z7SamtoolsTargetcutCommandline.__init__.<locals>.<lambda>r.   z-iizInsertion Penaltyc                 S   r   r   r,   r   r   r   r    r!     r"   r*   r+   zReference FilenameTc                 S   r   r   r   r   r   r   r    r!     r"   r#   z-0em0c                 S   r   r   r   r   r   r   r    r!     r"   r9   em1c                 S   r   r   r   r   r   r   r    r!     r"   z-2em2c                 S   r   r   r   r   r   r   r    r!     r"   r;   rl   r   
Input filer=   N)rB   r   r   r   rC   r   rD   rE   r   r   r    rD     s^   .z%SamtoolsTargetcutCommandline.__init__NrI   rJ   r   r   r   r    r     s    r   c                   @   r   )SamtoolsPhaseCommandlinea9  Command line wrapper for samtools phase.

    Call and phase heterozygous SNPs, equivalent to::

        $ samtools phase [-AF] [-k len] [-b prefix]
                         [-q minLOD] [-Q minBaseQ] <in.bam>

    See http://samtools.sourceforge.net/samtools.shtml for more details

    Examples
    --------
    >>> from Bio.Sequencing.Applications import SamtoolsPhaseCommandline
    >>> input_bam = "/path/to/in.bam"
    >>> samtools_phase_cmd = SamtoolsPhaseCommandline(input_bam=input_bam)
    >>> print(samtools_phase_cmd)
    samtools phase /path/to/in.bam

    r
   c                 K   s   || _ tdtg dddddtddgdtd	d
gddddd dtddgdtddgdddd dtddgdddd dtddgdddd dg| _tj| |fi | d S )!r   phaser   r   Tr=   r\   r]   zDrop reads with ambiguous phaser   r   zPrefix of BAM outputFc                 S   r   r   r   r   r   r   r    r!     r"   z3SamtoolsPhaseCommandline.__init__.<locals>.<lambda>r#   r/   r0   z$Do not attempt to fix chimeric readsz-kkz Maximum length for local phasingc                 S   r   r   r,   r   r   r   r    r!     r"   r.   r1   r2   zCMinimum Phred-scaled LOD to
                    call a heterozygotec                 S   r   r   r,   r   r   r   r    r!     r"   rY   rZ   zBMinimum base quality to be
                    used in het callingc                 S   r   r   r,   r   r   r   r    r!     r"   N)rB   r   r   r   r   rC   r   rD   rE   r   r   r    rD     sJ   &z!SamtoolsPhaseCommandline.__init__NrI   rJ   r   r   r   r    r     r}   r   __main__)run_doctestN)rN   Bio.Applicationr   r   r   r   r   r   r	   rP   rf   rq   rt   r~   r   r   r   r   r   r   r   r   r   rK   
Bio._utilsr   r   r   r   r    <module>   s6    ;+21KN"+6NK@
