ó
ólÀ[c           @   sî  d  d l  Z  d  d l Z d  d l Z d  d l m Z d d g Z d d d g Z d d	 g Z e e Z e g  e D] Z	 e	 d
 ^ qo 7Z e g  e D] Z	 e	 d
 ^ q 7Z e g  e D] Z	 e	 d
 ^ q± 7Z d Z
 d d d d d g Z i d d 6d d 6d d 6d d 6d d 6Z d d d d d d g Z d  Z d! Z d" Z d# Z d$ Z d% Z d& Z d' Z d( d) d* g Z d+ Z d, Z d- Z d. Z d/ Z d0 Z d1 Z d2 Z d3 d4 g Z d5 d3 d. g a  d5 d3 d. d6 g a! d5 d3 d. d6 d7 d, g a" d+ Z# d8 Z$ d a& e' a( e' Z) e' a* e' Z+ e' Z, e' a- e' Z. e' Z/ e' a0 d a1 d a2 d a3 e' Z4 d a5 d Z6 d a7 d a8 d a9 d a: d a; d9 a< e' Z= d a> d a? d Z@ d aA d aB d ZC d ZD d aE d ZF d ZG d ZH d aI d aJ d aK d aL d aM d aN d aO d aP d aQ d aR d aS d aT d aU d aV d aW d aX d ZY e' ZZ e' a[ e' a\ e' a] d Z^ d a_ e` ƒ  Za e` ƒ  Zb d: jc ƒ  Zd d; Ze g  Zf xØ eg e
 ƒ D]Ê Zh xÁ e ji ƒ  D]³ Zj ej d k r®ef d< eh d+ g 7Zf q„ej d k råef d= ek ej eh d+ g d> ƒ jc ƒ  7Zf q„ef d? ek ej eh d+ g d@ ƒ jc ƒ  7Zf ej d k r„ef dA ej eh d+ f g 7Zf q„q„WqqWef el em dB „  e ƒ ƒ 7Zf ed ef 7Zd el em dC „  ef ƒ ƒ Zf ef e 7Zf dD „  Zn d dE „ Zo e' d dF „ Zp dG „  Zq dH „  Zr dI „  Zs dJ „  Zt dK „  Zu dL „  Zv dM „  Zw d S(N   iÿÿÿÿN(   t   basenames   2.4-2.7s   3.2+s   .fqs   .fastqs   .bams   .fas   .fastas   .gzi	   s   --12s   -1s   -2s   -ss   --mergeds
   paired-endt   pet   singlet   ss
   mate-pairst   mps   hq-mate-pairst   hqmpt   nxmatet   pacbiot   sangert   nanoporet   tslrs   trusted-contigss   untrusted-contigss   contigs.fastas   scaffolds.fastas   assembly_graph.fastgs!   assembly_graph_with_scaffolds.gfas   contigs.pathss   scaffolds.pathss   transcripts.fastas   transcripts.pathst   hardt   softt   defaulti   i   i   i7   i   i
   i   iú   i!   i1   i   iM   ic   t   tmpt   offsP  12= merged= threads= memory= tmp-dir= iterations= phred-offset= sc iontorrent meta large-genome rna plasmid ss-fr ss-rf fast fast:false only-error-correction only-assembler disable-gzip-output disable-gzip-output:false disable-rr disable-rr:false help version test debug debug:false reference= series-analysis= config-file= dataset= bh-heap-check= spades-heap-check= read-buffer-size= help-hidden mismatch-correction mismatch-correction:false careful careful:false save-gp save-gp:false continue restart-from= truseq cov-cutoff= hidden-cov-cutoff= read-cov-threshold= configs-dir= stop-after=s   o:1:2:s:k:t:m:i:hvs   s%d=s   %s%d-1= %s%d-2=i   s8   %s%d-1= %s%d-2= %s%d-12= %s%d-s= %s%d-rf %s%d-fr %s%d-ffi   s   %s%d-m=c         C   s   |  d S(   Nt   =(    (   t   x(    (    se   /home/psgendb/BIRCHDEV/pkg/SPAdes-3.13.0/linux-x86_64/share/spades/spades_pipeline/options_storage.pyt   <lambda>¤   s    c         C   s   d |  j  d ƒ d S(   Ns   --R   i    (   t   split(   R   (    (    se   /home/psgendb/BIRCHDEV/pkg/SPAdes-3.13.0/linux-x86_64/share/spades/spades_pipeline/options_storage.pyR   §   s    c          C   sp   d  }  t t j d ƒ d k r( d }  nD t t j d ƒ d k rJ d }  n" t t j d ƒ d k rl d }  n  |  S(   Ni    s   rnaspades.pyt   rnas   plasmidspades.pyt   plasmids   metaspades.pyt   meta(   t   NoneR    t   syst   argv(   t   mode(    (    se   /home/psgendb/BIRCHDEV/pkg/SPAdes-3.13.0/linux-x86_64/share/spades/spades_pipeline/options_storage.pyt   get_mode«   s    			c         C   sz   t  j j d t |  ƒ ƒ | d  k r2 t ƒ  } n  | d  k	 rY t  j j d | d ƒ n  t  j j d ƒ t  j j ƒ  d  S(   Ns   SPAdes vs    [s   SPAdes mode]s   
(   R   t   stdoutt   writet   strR   R   t   flush(   t   spades_versionR   (    (    se   /home/psgendb/BIRCHDEV/pkg/SPAdes-3.13.0/linux-x86_64/share/spades/spades_pipeline/options_storage.pyt   version¶   s    c         C   s  t  j j d t |  ƒ ƒ | d  k r2 t ƒ  } n  | d  k	 rY t  j j d | d ƒ n  t  j j d ƒ t  j j d t t  j d ƒ d d ƒ t  j j dc ƒ t  j j dd ƒ t  j j d d ƒ | d  k rt  j j d d ƒ t  j j d d ƒ t  j j d ƒ t  j j d ƒ n  t  j j d d ƒ t  j j d d ƒ t  j j d d ƒ t  j j d d ƒ t  j j de ƒ t  j j df ƒ t  j j d d ƒ t  j j d d ƒ t  j j d d ƒ t  j j d d ƒ t  j j d d ƒ | d k rd } n d t t ƒ } t  j j d | d ƒ t  j j d | d ƒ t  j j d | d ƒ t  j j d  | d ƒ t  j j d! | d ƒ t  j j d" | d ƒ t  j j d# | d ƒ | dg k rÍt  j j d% d ƒ t  j j d& d ƒ t  j j d' d ƒ t  j j d( d ƒ t  j j d) d ƒ t  j j d* d ƒ t  j j d+ d ƒ t  j j d, d ƒ t  j j d- d ƒ t  j j d. d ƒ t  j j d/ d ƒ t  j j d0 d ƒ t  j j d1 ƒ n  | d$ k st  j j d2 ƒ t  j j d3 ƒ t  j j d4 ƒ n  | d k s;t  j j d5 ƒ t  j j d6 ƒ n  | d$ k rZt  j j d7 ƒ n  t  j j dh ƒ t  j j di ƒ t  j j d9 d ƒ t  j j d: d ƒ | dj k rÅt  j j d; d ƒ n  t  j j d< d ƒ | d$ k rüt  j j d= d ƒ n t  j j d> d ƒ t  j j d? d ƒ t  j j d@ d ƒ t  j j dk ƒ t  j j dl ƒ t  j j dB d ƒ | d$ k r‹t  j j dC ƒ n  t  j j dD d ƒ t  j j dE t ƒ t  j j dF d ƒ t  j j dE t	 ƒ t  j j dG d ƒ t  j j dH d ƒ | d$ k rLt  j j dI d ƒ t  j j dJ t t
 dK ƒ dL d ƒ n" t  j j dM t t
 dK ƒ dN ƒ | dm k r‘t  j j dO d ƒ n  t  j j dP d ƒ t  j j dQ d ƒ | r
t  j j dn ƒ t  j j do ƒ t  j j dS d ƒ t  j j dT d ƒ t  j j dU ƒ t  j j dV d ƒ t  j j dW d ƒ t  j j dX d ƒ t  j j dY d ƒ t  j j dZ t ƒ t  j j d[ ƒ t  j j d\ d ƒ t  j j d] d ƒ t  j j d^ ƒ t  j j d_ ƒ t  j j d` ƒ t  j j da ƒ t  j j db d ƒ n  t  j j ƒ  d  S(p   Ns   SPAdes genome assembler vs    [s   SPAdes mode]s   

s   Usage: i    s    [options] -o <output_dir>s   
t    s   Basic options:sE   -o	<output_dir>	directory to store all the resulting files (required)s7   --sc			this flag is required for MDA (single-cell) datas:   --meta			this flag is required for metagenomic sample datas0   --rna			this flag is required for RNA-Seq data 
s>   --plasmid		runs plasmidSPAdes pipeline for plasmid detection 
s7   --iontorrent		this flag is required for IonTorrent datas#   --test			runs SPAdes on toy datasets$   -h/--help		prints this usage messages   -v/--version		prints versions   Input data:sI   --12	<filename>	file with interlaced forward and reverse paired-end readss0   -1	<filename>	file with forward paired-end readss0   -2	<filename>	file with reverse paired-end readss&   -s	<filename>	file with unpaired readssI   --merged	<filename>	file with merged forward and reverse paired-end readsR   t   1s   1,2,...,s]   --pe<#>-12	<filename>	file with interlaced reads for paired-end library number <#> (<#> = %s)sY   --pe<#>-1	<filename>	file with forward reads for paired-end library number <#> (<#> = %s)sY   --pe<#>-2	<filename>	file with reverse reads for paired-end library number <#> (<#> = %s)sZ   --pe<#>-s	<filename>	file with unpaired reads for paired-end library number <#> (<#> = %s)sX   --pe<#>-m	<filename>	file with merged reads for paired-end library number <#> (<#> = %s)sa   --pe<#>-<or>	orientation of reads for paired-end library number <#> (<#> = %s; <or> = fr, rf, ff)sZ   --s<#>		<filename>	file with unpaired reads for single reads library number <#> (<#> = %s)R   sb   --mp<#>-12	<filename>	file with interlaced reads for mate-pair library number <#> (<#> = 1,2,..,9)s^   --mp<#>-1	<filename>	file with forward reads for mate-pair library number <#> (<#> = 1,2,..,9)s^   --mp<#>-2	<filename>	file with reverse reads for mate-pair library number <#> (<#> = 1,2,..,9)s_   --mp<#>-s	<filename>	file with unpaired reads for mate-pair library number <#> (<#> = 1,2,..,9)sf   --mp<#>-<or>	orientation of reads for mate-pair library number <#> (<#> = 1,2,..,9; <or> = fr, rf, ff)sq   --hqmp<#>-12	<filename>	file with interlaced reads for high-quality mate-pair library number <#> (<#> = 1,2,..,9)sm   --hqmp<#>-1	<filename>	file with forward reads for high-quality mate-pair library number <#> (<#> = 1,2,..,9)sm   --hqmp<#>-2	<filename>	file with reverse reads for high-quality mate-pair library number <#> (<#> = 1,2,..,9)sn   --hqmp<#>-s	<filename>	file with unpaired reads for high-quality mate-pair library number <#> (<#> = 1,2,..,9)su   --hqmp<#>-<or>	orientation of reads for high-quality mate-pair library number <#> (<#> = 1,2,..,9; <or> = fr, rf, ff)sg   --nxmate<#>-1	<filename>	file with forward reads for Lucigen NxMate library number <#> (<#> = 1,2,..,9)sg   --nxmate<#>-2	<filename>	file with reverse reads for Lucigen NxMate library number <#> (<#> = 1,2,..,9)s+   --sanger	<filename>	file with Sanger reads
s+   --pacbio	<filename>	file with PacBio reads
s/   --nanopore	<filename>	file with Nanopore reads
s)   --tslr	<filename>	file with TSLR-contigs
s7   --trusted-contigs	<filename>	file with trusted contigs
s;   --untrusted-contigs	<filename>	file with untrusted contigs
sJ   --ss-<type>	strand specific data, <type> = fr (normal) and rf (antisense)
s   Pipeline options:sL   --only-error-correction	runs only read error correction (without assembling)sE   --only-assembler	runs only assembling (without read error correction)s@   --careful		tries to reduce number of mismatches and short indelss<   --continue		continue run from the last available check-pointsl   --restart-from	<cp>	restart run with updated options and from the specified check-point ('ec', 'as', 'last')s|   --restart-from	<cp>	restart run with updated options and from the specified check-point ('ec', 'as', 'k<int>', 'mc', 'last')sQ   --disable-gzip-output	forces error correction not to compress the corrected readss<   --disable-rr		disables repeat resolution stage of assemblings   Advanced options:sA   --dataset	<filename>	file with dataset description in YAML formatsU   --fast				speeds up isoform detection, but may miss short and low-expressed isoforms
s%   -t/--threads	<int>		number of threadss   				[default: %s]
sF   -m/--memory	<int>		RAM limit for SPAdes in Gb (terminates if exceeded)s1   --tmp-dir	<dirname>	directory for temporary filess   				[default: <output_dir>/tmp]sF   -k		<int,int,...>	comma-separated list of k-mer sizes (must be odd ands   				less than i   s   ) [default: 'auto']s1   -k		<int>		k-mer size (must be odd and less than s   ) [default: 'auto']
sk   --cov-cutoff	<float>		coverage cutoff value (a positive float number, or 'auto', or 'off') [default: 'off']sL   --phred-offset	<33 or 64>	PHRED quality offset in the input reads (33 or 64)s   				[default: auto-detect]s   HIDDEN options:s@   --debug				runs SPAdes in debug mode (keeps intermediate output)sd   --stop-after	<cp>	runs SPAdes until the specified check-point ('ec', 'as', 'k<int>', 'mc') inclusives&   --truseq			runs SPAdes in TruSeq mode
sU   --mismatch-correction		runs post processing correction of mismatches and short indelssQ   --reference	<filename>	file with reference for deep analysis (only in debug mode)sP   --series-analysis	<filename>	config for metagenomics-series-augmented reassemblys2   --configs-dir	<configs_dir>	directory with configssT   -i/--iterations	<int>		number of iterations for read error correction [default: %s]
sI   --read-buffer-size	<int>		sets size of read buffer for graph constructionsL   --bh-heap-check		<value>	sets HEAPCHECK environment variable for BayesHammersJ   --spades-heap-check	<value>	sets HEAPCHECK environment variable for SPAdess8   --large-genome	Enables optimizations for large genomes 
sU   --save-gp	Enables saving graph pack before repeat resolution (even without --debug) 
sª   --hidden-cov-cutoff	<float>		coverage cutoff value deeply integrated in simplification (a positive float number). Base coverage! Will be adjusted depending on K and RL! 
sR   --read-cov-threshold	<int>		read median coverage threshold (non-negative integer)
s?   --help-hidden	prints this usage message with all hidden optionss   
s   Basic options:
s   
s   Input data:
(   R   R   s   
s   Pipeline options:
(   R   R   s   
s   Advanced options:
(   R   R   s   
s   HIDDEN options:
(   R   t   stderrR   R   R   R   R   t   MAX_LIBS_NUMBERt   THREADSt   MEMORYt   MAX_Kt
   ITERATIONSR   (   R    t   show_hiddenR   t   allowed_lib_ids(    (    se   /home/psgendb/BIRCHDEV/pkg/SPAdes-3.13.0/linux-x86_64/share/spades/spades_pipeline/options_storage.pyt   usageÀ   s   )	)"c           C   s!   t  o  t o  t o  t o  t S(   N(   t   k_merst   single_cellt
   iontorrentR   R   (    (    (    se   /home/psgendb/BIRCHDEV/pkg/SPAdes-3.13.0/linux-x86_64/share/spades/spades_pipeline/options_storage.pyt   auto_K_allowedb  s    c           C   s9  t  d  k r t a  n  t d  k rT t j ƒ  rK t t t t j ƒ  ƒ ƒ a qT t a n  t	 d  k ri t
 a	 n  t d  k r~ t a n  t d  k r“ t a n  t d  k r¨ t a n  t d  k r½ t a n  t d  k rÒ t a n  t d k rç d  a n  t d  k rü d a n  t d  k r t j j t t ƒ a n  t d  k r5t a n  d  S(   Nt   autoR   (   t   threadsR   R&   t   memoryt   supportt   get_available_memoryt   intt   minR'   t
   iterationsR)   t   disable_gzip_outputt   Falset
   disable_rrt   carefult   mismatch_correctort   developer_modet   qvoffsett
   cov_cutofft   tmp_dirt   ost   patht   joint
   output_dirt   TMP_DIRt   fast(    (    (    se   /home/psgendb/BIRCHDEV/pkg/SPAdes-3.13.0/linux-x86_64/share/spades/spades_pipeline/options_storage.pyt   set_default_valuesg  s4    										c           C   s(   t  j j d ƒ a t a t a t a d  S(   Nt   spades_test(	   RB   RC   t   abspathRE   R:   R.   R   t   Truet	   test_mode(    (    (    se   /home/psgendb/BIRCHDEV/pkg/SPAdes-3.13.0/linux-x86_64/share/spades/spades_pipeline/options_storage.pyt   set_test_options’  s    c         C   s  t  r t j d |  ƒ n  t r2 t j d |  ƒ n  t rK t j d |  ƒ n  t rd t j d |  ƒ n  t r} t j d |  ƒ n  t r– t j d |  ƒ n  t d  k	 rµ t j d |  ƒ n  t
 a t a t a t a t a t a t a t a t a t a t a t  a! t" a# t$ a% t& a' d  S(   Ns8   you cannot specify --dataset with --restart-from option!s3   you cannot specify --sc with --restart-from option!s5   you cannot specify --meta with --restart-from option!s;   you cannot specify --iontorrent with --restart-from option!s?   you cannot specify --only-assembler with --restart-from option!sF   you cannot specify --only-error-correction with --restart-from option!sV   you cannot specify strand specificity (--ss-rf or --ss-fr) with --restart-from option!((   t   dataset_yaml_filenameR4   t   errorR.   R   R/   t   only_assemblert   only_error_correctiont   strand_specificityR   R-   t   restart_k_mersR<   t   restart_carefulR=   t   restart_mismatch_correctorR9   t   restart_disable_gzip_outputR;   t   restart_disable_rrR2   t   restart_threadsR3   t   restart_memoryRA   t   restart_tmp_dirR?   t   restart_qvoffsetR@   t   restart_cov_cutoffR>   t   restart_developer_modet	   referencet   restart_referencet   configs_dirt   restart_configs_dirt   read_buffer_sizet   restart_read_buffer_sizeRG   t   restart_fast(   t   log(    (    se   /home/psgendb/BIRCHDEV/pkg/SPAdes-3.13.0/linux-x86_64/share/spades/spades_pipeline/options_storage.pyt   save_restart_optionsž  s:    c           C   sT  t  r* t a t  d k r! d  a q* t  a n  t d  k	 r? t a n  t d  k	 rT t a n  t d  k	 ri t	 a n  t
 d  k	 r~ t
 a n  t d  k	 r“ t a n  t d  k	 r¨ t a n  t d  k	 r½ t a n  t d  k	 rÒ t a n  t d  k	 rç t a n  t d  k	 rü t a n  t d  k	 rt a n  t d  k	 r&t a n  t d  k	 r;t a n  t d  k	 rPt a n  d  S(   NR1   (    RS   R-   t   original_k_mersR   RT   R<   RU   R=   R9   RV   RW   R;   RX   R2   RY   R3   RZ   RA   R[   R?   R\   R@   R]   R>   R_   R^   Ra   R`   Rc   Rb   Rd   RG   (    (    (    se   /home/psgendb/BIRCHDEV/pkg/SPAdes-3.13.0/linux-x86_64/share/spades/spades_pipeline/options_storage.pyt   load_restart_optionsÏ  sB    															c           C   s^   d d d d g a  d d d d d g a d d d d d d d g a t a t a t a t a d  S(   Ni   i!   i-   i7   iM   ic   i   (   t   K_MERS_SHORTt
   K_MERS_150t
   K_MERS_250RK   t   truseq_modet   correct_scaffoldst   run_truseq_postprocessingRP   (    (    (    se   /home/psgendb/BIRCHDEV/pkg/SPAdes-3.13.0/linux-x86_64/share/spades/spades_pipeline/options_storage.pyt   enable_truseq_mode  s    	c         C   s:   x3 |  D]+ \ } } | d k s. | j  d ƒ r t Sq Wt S(   Ns
   --continues   --restart-from(   t
   startswithRK   R:   (   t   optionst   optt   arg(    (    se   /home/psgendb/BIRCHDEV/pkg/SPAdes-3.13.0/linux-x86_64/share/spades/spades_pipeline/options_storage.pyt
   will_rerun  s    (x   RB   R   R4   t   os.pathR    t   SUPPORTED_PYTHON_VERSIONSt   BH_ALLOWED_READS_EXTENSIONSt    CONTIGS_ALLOWED_READS_EXTENSIONSt   ALLOWED_READS_EXTENSIONSR   R%   t   OLD_STYLE_READS_OPTIONSt   SHORT_READS_TYPESt   LONG_READS_TYPESt   contigs_namet   scaffolds_namet   assembly_graph_namet   assembly_graph_name_gfat   contigs_pathst   scaffolds_pathst   transcripts_namet   transcripts_pathst   filtering_typest   MIN_KR(   t	   RNA_MIN_Kt   RNA_MAX_LOWER_Kt    THRESHOLD_FOR_BREAKING_SCAFFOLDSt)   THRESHOLD_FOR_BREAKING_ADDITIONAL_CONTIGSR&   R'   t
   K_MERS_RNARi   Rj   Rk   R)   RF   R   RE   R:   R.   R/   R   R   t   large_genomeRL   R   RQ   RP   R9   R;   R<   t   continue_modeR>   RN   R2   R3   RA   R-   R?   R@   t   save_gpR=   R^   t   series_analysisR`   R8   t   bh_heap_checkt   spades_heap_checkRb   t   lcer_cutofft   read_cov_thresholdt   restart_fromRT   RU   RV   RW   RX   RY   RZ   RS   Rg   R[   R\   R]   R_   Ra   Rc   Rd   t
   stop_aftert   run_completedRl   Rm   Rn   RR   RG   t   dictt   dict_of_prefixest   dict_of_rel2absR   t   long_optionst   short_optionst   reads_optionst   ranget   it   keyst   typet   tuplet   listt   mapR   R!   R,   R0   RH   RM   Rf   Rh   Ro   Rt   (    (    (    se   /home/psgendb/BIRCHDEV/pkg/SPAdes-3.13.0/linux-x86_64/share/spades/spades_pipeline/options_storage.pyt   <module>
   sô   
!!!)			+(&

	
¢		+		1	6	