ó
›¢yZc        	   @   s±  d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l m Z e j j e j j e j j e j j	 e
 ƒ ƒ ƒ ƒ Z d Z e j j e e ƒ Z d Z d d g Z d Z d Z e j ƒ  d	 k rÊ d
 Z n% e j ƒ  d d k ré d Z n d Z d Z g  Z d Z d Z d Z d Z d Z e Z e Z  e Z! d Z" d Z# e Z$ d a& d Z' d Z( d Z) d Z* e Z+ e Z, e Z- e Z. e Z/ e Z0 e Z1 e Z2 e Z3 e Z4 e Z5 e Z6 e Z7 e Z8 e Z9 e Z: e Z; e Z< e Z= e Z> e Z? d Z@ e ZA e ZB e ZC d ZD e ZE d ZF d ZG d e  j  jH ƒ  jI d ƒ ZJ e ZK d ZL d ZM d ZN d  ZO d! ZP d" ZQ d# ZR d$ ZS d% ZT d& ZU d' ZV d( ZW d) ZX d* ZY d+ ZZ d, Z[ d- Z\ d. Z] d/ Z^ e Z_ e Z` d0 Za d1 Zb d2 Zc d Zd d Ze e Zf e Zg d3 Zh d4 Zi d5 Zj d6 Zk d7 Zl d8 Zm d9 Zn d: Zo d; Zp d< Zq d= Zr d> Zs d? Zt d Zu d@ Zv dA Zw dB Zx dA Zy d Zz d Z{ dC Z| dD Z} d@ Z~ e} Z dE Z€ dF Z dG Z‚ dH Zƒ e Z„ e Z… dI Z† dJ Z‡ dK Zˆ dC Z‰ i  ZŠ g  Z‹ g  ZŒ dL Z d ZŽ dI Z dM Z i  Z‘ dE Z’ dA Z“ d Z” e Z• dN Z– dO Z— dO Z˜ dI Z™ dP Zš dQ dR dP dS dT dU dV dW dX g	 Z› d Zœ d Z d Zž d ZŸ d Z  d Z¡ d Z¢ d Z£ d Z¤ d Z¥ d Z¦ d Z§ dY „  Z¨ dZ „  Z© d[ „  Zª e d\ „ Z« e e e e j¬ d] „ Z­ d S(^   iÿÿÿÿN(   t   LooseVersiont
   quast_libss5   https://raw.githubusercontent.com/ablab/quast/master/s   2.5+s   3.3+t   quastt	   metaquastt   Darwint   macosxi    t   64bitt   linux_64t   linux_32iüÿÿi€ðús   0,1000,5000,10000,25000,50000iô  s   0,300,1500,3000t    t   oneg®Gáz®ï?iA   g     ÀW@t   quast_test_outputt   quast_resultst   results_s   %Y_%m_%d_%H_%M_%St   jsont   quast_corrected_inputs
   report.pdft   reportt   transposed_reportt   gage_t   report_html_auxs   contigs_report_%ss   all_alignments_%s.tsvt   nucmer_outputt   quast_downloaded_referencest   runs_per_referencet   summaryt   not_alignedt   combined_referencet   krona_chartss   combined_reference.fastagš™™™™™¹?s   unique_contigs_%s.tsvt   structural_variationss   trivial_deletions.beds   manta_sv.beds
   icarus.csss   build_icarus.jst   icarus_viewerss   icarus.htmls   icarus_menu_templ.htmls   viewers_template.htmls   View in Icarus contig browsers   contig_size_viewer.htmls   Contig size viewers   Contig alignment viewert   alignment_viewert   alignment_viewer_part_s   alignment_viewer.htmliè  i'  gš™™™™™©?i   iU   i
   gffffffî?i   i   i2   id   g      ð?iÜ  gÍÌÌÌÌÌì?iP   i,  t   pdft   emft   epst   pngt   pst   rawt   rgbat   svgt   svgzc          C   s-  d „  }  t  j j ƒ  d } g  } xÊ t D]Â } | d } d | k r] | j d ƒ \ } } n- | j d ƒ r€ | d  | } } n
 | } } |  | ƒ } | j d | | j d d ƒ f ƒ t | ƒ t | ƒ k oâ t | ƒ k  n r) t Sq) Wt  j	 j
 d | d	 d
 d j | ƒ d ƒ t  j d ƒ d  S(   Nc         S   sq   |  j  d ƒ } xR t t t | ƒ ƒ ƒ D]8 } | | j ƒ  r( t t | | ƒ d ƒ | | <Pq( q( Wd j | ƒ S(   Nt   .i   (   t   splitt   reversedt   ranget   lent   isdigitt   strt   intt   join(   t   versiont
   componentst   i(    (    sN   /data/home/pitagoras/public_html/gigas/quast/quast-4.6.3/quast_libs/qconfig.pyt   __next_version×   s    i    t   -t   +iÿÿÿÿs   Python%s: %ss    and highers   ERROR! Python version s    is not supported!
s   Supported versions are s   , s   
i   (   t   sysR1   R)   t   SUPPORTED_PYTHON_VERSIONSt   endswitht   appendt   replaceR    t   Truet   stderrt   writeR0   t   exit(   R4   t   current_versiont   supported_versions_msgt   supported_versionst   majort   min_inct   max_inct   max_exc(    (    sN   /data/home/pitagoras/public_html/gigas/quast/quast-4.6.3/quast_libs/qconfig.pyt   check_python_versionÖ   s"    	

#.	$c         C   s„   t  d  k r€ y) d d  l } t d | j ƒ  d ƒ a  Wn* t t f k
 ra |  j d ƒ t a  n X|  j	 d t
 t  ƒ d ƒ n  d  S(   Niÿÿÿÿi   i   s&   Failed to determine the number of CPUss$   Maximum number of threads is set to s*    (use --threads option to set it manually)(   t   max_threadst   Nonet   multiprocessingt   maxt	   cpu_countt   ImportErrort   NotImplementedErrort   warningt   DEFAULT_MAX_THREADSt   noticeR.   (   t   loggerRJ   (    (    sN   /data/home/pitagoras/public_html/gigas/quast/quast-4.6.3/quast_libs/qconfig.pyt   set_max_threadsò   s    
c          C   sÃ   d  }  y& d d l m } | j } | j }  Wnz t k
 r¨ t t j j	 t
 d ƒ ƒ } | j ƒ  j ƒ  j d ƒ } | j ƒ  | d } t | ƒ d k r© | d }  q© n X|  r» | d |  S| Sd  S(   Niÿÿÿÿ(   R1   s   VERSION.txts   
i    i   s   , (   RI   R   R1   t   __version__t   __git_revision__RM   t   opent   ost   pathR0   t
   QUAST_HOMEt   readt   stripR)   t   closeR,   (   t   revisionR1   t   verst   version_filet   lines(    (    sN   /data/home/pitagoras/public_html/gigas/quast/quast-4.6.3/quast_libs/qconfig.pyt   quast_versionÿ   s    	

c         C   sE   d t  ƒ  } |  r  | d 7} n  t j j | d ƒ t j j ƒ  d  S(   Ns   QUAST vs    (MetaQUAST mode)s   
(   Ra   R7   t   stdoutR>   t   flush(   t   metat   full_version(    (    sN   /data/home/pitagoras/public_html/gigas/quast/quast-4.6.3/quast_libs/qconfig.pyt   print_version#  s
    c         C   s  | j  d ƒ | r# | j  d ƒ n | j  d ƒ | j  d t ƒ  d ƒ | j  d ƒ | j  d t j d d ƒ | j  d ƒ | j  d	 ƒ | j  d
 ƒ | rÈ | j  d ƒ | j  d ƒ | j  d ƒ n | j  d ƒ | j  d ƒ | sø | j  d ƒ n  | j  d t ƒ | j  d ƒ | j  d ƒ | r9| j  d ƒ n,| j  d ƒ | j  d ƒ | j  d ƒ | j  d ƒ | j  d ƒ | r| j  d ƒ n | j  d ƒ | j  d ƒ | sÀ| j  d ƒ n  | j  d ƒ | j  d t ƒ | sô| j  d ƒ n8 | j  d  ƒ | j  d! t ƒ | j  d" ƒ | j  d# ƒ | j  d$ ƒ | j  d% t ƒ | j  d& ƒ | j  d' ƒ | j  d( t ƒ | j  d) t	 ƒ | j  d* ƒ | j  d+ t
 ƒ | j  d, ƒ | j  d- ƒ | j  d. t ƒ | rö| j  d/ ƒ | j  d0 t
 ƒ n  | j  d1 ƒ | j  d2 ƒ | j  d3 ƒ | j  d4 t ƒ | j  d5 ƒ | j  d6 t ƒ | j  d7 ƒ | j  d8 t ƒ | j  d9 ƒ | j  d: ƒ | j  d; t ƒ | j  d< ƒ | j  d= t ƒ | j  d> d? j t ƒ ƒ | j  d@ ƒ | j  dA ƒ | j  dB ƒ | j  dC ƒ | j  dD ƒ | j  dE ƒ | j  dF ƒ | j  dG ƒ | j  dH ƒ | j  dI ƒ | j  dJ ƒ | j  d ƒ | j  dK ƒ | j  dL ƒ | j  dM ƒ | j  dN ƒ | j  dO ƒ | j  dP ƒ | j  dQ ƒ | j  dR ƒ | j  dS ƒ | j  dT ƒ |  rª| j  d ƒ | j  dU ƒ | j  dV ƒ | j  dW ƒ | j  dX t ƒ | j  dY ƒ | j  dZ ƒ | rf| j  d[ ƒ n  | j  d\ ƒ | j  d] ƒ | j  d^ ƒ | j  d_ ƒ | j  d` ƒ n  | j  d ƒ | j  da ƒ | j  db ƒ | r| j  dc ƒ | j  dd ƒ | j  de ƒ | j  df ƒ n' | j  dg ƒ | j  dh ƒ | j  di ƒ | j  dj ƒ | j  dk ƒ |  re| j  dl ƒ n  | j  d ƒ | j  dm ƒ | j ƒ  d  S(n   NR	   s=   MetaQUAST: QUality ASsessment Tool for Metagenome Assemblies
s5   QUAST: QUality ASsessment Tool for Genome Assemblies
s	   Version: s   
s   Usage: python i    s     [options] <files_with_contigs>
s	   Options:
sn   -o  --output-dir  <dirname>   Directory to store all result files [default: quast_results/results_<datetime>]
sl   -R   <filename,filename,...>  Comma-separated list of reference genomes or directory with reference genomes
sa   --references-list <filename>  Text file with list of reference genomes for downloading from NCBI
sc   -G  --genes       <filename>  File with gene coordinates in the references (GFF, BED, NCBI or TXT)
s4   -R                <filename>  Reference genome file
sb   -G  --genes       <filename>  File with gene coordinates in the reference (GFF, BED, NCBI or TXT)
sd   -O  --operons     <filename>  File with operon coordinates in the reference (GFF, BED, NCBI or TXT)
sN   -m  --min-contig  <int>       Lower threshold for contig length [default: %s]
sO   -t  --threads     <int>       Maximum number of threads [default: 25% of CPUs]
s:   These are basic options. To see the full list, use --help
s   Advanced options:
sm   -s  --scaffolds                       Assemblies are scaffolds, split them and add contigs to the comparison
s|   -l  --labels "label, label, ..."      Names of assemblies to use in reports, comma-separated. If contain spaces, use quotes
s\   -L                                    Take assembly names from their parent directory names
s;   -e  --eukaryote                       Genome is eukaryotic
sG   -f  --gene-finding                    Predict genes using MetaGeneMark
sˆ   -f  --gene-finding                    Predict genes using GeneMarkS (prokaryotes, default) or GeneMark-ES (eukaryotes, use --eukaryote)
st       --glimmer                         Use GlimmerHMM for gene prediction (instead of the default finder, see above)
sv       --mgm                             Use MetaGeneMark for gene prediction (instead of the default finder, see above)
s|       --gene-thresholds <int,int,...>   Comma-separated list of threshold lengths of genes to search with Gene Finding module
s4                                         [default: %s]
so       --est-ref-size <int>              Estimated reference size (for computing NGx metrics without a reference)
sƒ       --max-ref-number <int>            Maximum number of references (per each assembly) to download after looking in SILVA database
sZ                                         Set 0 for not looking in SILVA at all [default: %s]
s…       --blast-db <filename>             Custom BLAST database (.nsq file). By default, MetaQUAST searches references in SILVA database
sŽ       --use-input-ref-order             Use provided order of references in MetaQUAST summary plots (default order: by the best average value).
sP       --gage                            Use GAGE (results are in gage_report.txt)
se       --contig-thresholds <int,int,...> Comma-separated list of contig length thresholds [default: %s]
sg   -u  --use-all-alignments              Compute genome fraction, # genes, # operons in QUAST v1.* style.
sk                                         By default, QUAST filters Nucmer's alignments to keep only best ones
se   -i  --min-alignment <int>             Nucmer's parameter: the minimum alignment length [default: %s]
sw       --min-identity <float>            Nucmer's parameter: the minimum alignment identity (80.0, 100.0) [default: %.1f]
sd   -a  --ambiguity-usage <none|one|all>  Use none, one, or all alignments of a contig when all of them
sd                                         are almost equally good (see --ambiguity-score) [default: %s]
s‚       --ambiguity-score <float>         Score S for defining equally good alignments of a single contig. All alignments are sorted 
s                                         by decreasing LEN * IDY% value. All alignments with LEN * IDY% < S * best(LEN * IDY%) are 
sa                                         discarded. S should be between 0.8 and 1.0 [default: %.2f]
sd       --unique-mapping                  Disable --ambiguity-usage=all for the combined reference run,
sk                                         i.e. use user-specified or default ('%s') value of --ambiguity-usage
sg       --strict-NA                       Break contigs in any misassembly event when compute NAx and NGAx
sx                                         By default, QUAST breaks contigs only by extensive misassemblies (not local ones)
sy   -x  --extensive-mis-size  <int>       Lower threshold for extensive misassembly size. All relocations with inconsistency
st                                         less than extensive-mis-size are counted as local misassemblies [default: %s]
su       --scaffold-gap-max-size  <int>    Max allowed scaffold gap length difference. All relocations with inconsistency
sz                                         less than scaffold-gap-size are counted as scaffold gap misassemblies [default: %s]
sy       --unaligned-part-size  <int>      Lower threshold for detecting partially unaligned contigs. Such contig should have
se                                         at least one unaligned fragment >= the threshold [default: %s]
sx       --fragmented                      Reference genome may be fragmented into small pieces (e.g. scaffolded reference) 
sy       --fragmented-max-indent  <int>    Mark translocation as fake if both alignments are located no further than N bases 
s]                                         from the ends of the reference fragments [default: %s]
sD                                         Requires --fragmented option.
sS       --plots-format  <str>             Save plots in specified format [default: %s]
s<                                         Supported formats: %s
s   , st       --memory-efficient                Run Nucmer using one thread, separately per each assembly and each chromosome
sh                                         This may significantly reduce memory consumption on large genomes
s       --space-efficient                 Create only reports and plots files. .stdout, .stderr, .coords and other aux files will not be created
sŽ                                         This may significantly reduce space consumption on large genomes. Icarus viewers also will not be built
s`   -1  --reads1  <filename>              File with forward reads (in FASTQ format, may be gzipped)
s`   -2  --reads2  <filename>              File with reverse reads (in FASTQ format, may be gzipped)
s9       --sam  <filename>                 SAM alignment file
s9       --bam  <filename>                 BAM alignment file
sn                                         Reads (or SAM/BAM file) are used for structural variation detection and
sL                                         coverage histogram building in Icarus
sX       --sv-bedpe  <filename>            File with structural variations (in BEDPE format)
s   Speedup options:
st       --no-check                        Do not check and correct input fasta files. Use at your own risk (see manual)
s8       --no-plots                        Do not draw plots
sS       --no-html                         Do not build html reports and Icarus viewers
sB       --no-icarus                       Do not build Icarus viewers
sx       --no-snps                         Do not report SNPs (may significantly reduce memory consumption on large genomes)
sM       --no-gc                           Do not compute GC% and GC-distribution
sy       --no-sv                           Do not run structural variation detection (make sense only if reads are specified)
sI       --no-gzip                         Do not compress large output files
s]       --fast                            A combination of all speedup options except --no-check
s   Hidden options:
s0   -d  --debug                 Run in a debug mode
sI   --no-portable-html          Do not embed CSS and JS files in HTML report
si   -c  --min-cluster   <int>   Nucmer's parameter: the minimum length of a cluster of matches [default: %s]
sD   -j  --save-json             Save the output also in the JSON format
sF   -J  --save-json-to <path>   Save the JSON output to a particular path
s‹   --read-support                   Use read coverage specified in contig names (SPAdes/Velvet style) for calculating Avg contig read support
sW   --cov  <filename>                File with read coverage (for Icarus alignment viewer)
s[   --phys-cov  <filename>           File with physical coverage (for Icarus alignment viewer)
s<   --no-icarus                      Do not create Icarus files
sL   --svg                            Draw contig alignment plot (in SVG format)
sT   --force-nucmer                   Use nucmer instead of E-MEM for aligning contigs. 
s   Other:
s}       --silent                          Do not print detailed information about each step to stdout (log file is not affected)
sw       --test                            Run MetaQUAST on the data from the test_data folder, output to quast_test_output
sŠ       --test-no-ref                     Run MetaQUAST without references on the data from the test_data folder, output to quast_test_output
s€                                         MetaQUAST will download SILVA 16S rRNA database (~170 Mb) for searching reference genomes
sF                                         Internet connection is required
ss       --test                            Run QUAST on the data from the test_data folder, output to quast_test_output
sz       --test-sv                         Run QUAST with structural variants detection on the data from the test_data folder,
sB                                         output to quast_test_output
s?   -h  --help                            Print full usage message
s4   -v  --version                         Print version
sW       --help-hidden                     Print this usage message with all hidden options
s?   Online QUAST manual is available at http://quast.sf.net/manual
(   R>   Ra   R7   t   argvt
   min_contigt   genes_lengthst   max_referencest   contig_thresholdst   min_alignmentt   min_IDYt   ambiguity_usaget   ambiguity_scoret   extensive_misassembly_thresholdt   scaffolds_gap_thresholdt   unaligned_part_sizet   MAX_INDEL_LENGTHt   plot_extensionR0   t   supported_plot_extensionst   min_clusterRc   (   t   show_hiddenRd   t   shortt   stream(    (    sN   /data/home/pitagoras/public_html/gigas/quast/quast-4.6.3/quast_libs/qconfig.pyt   usage+  sú    (®   t   datetimeRW   t   platformR7   t   distutils.versionR    RX   t   abspatht   dirnamet   realpatht   __file__RY   t   PACKAGE_NAMER0   t   LIBS_LOCATIONt   GIT_ROOT_URLR8   t   LOGGER_DEFAULT_NAMEt   LOGGER_META_NAMEt   systemt   platform_namet   architecturet   MAX_REFERENCE_LENGTHt   splitted_reft   MAX_REFERENCE_FILE_LENGTHRk   Rh   Ri   t	   ref_fpatht   Falset	   with_gageR<   t
   prokaryotet   gene_findingRn   Ro   t   use_all_alignmentsRI   RH   Rv   Rl   Rm   t   estimated_reference_sizet	   strict_NAt	   scaffoldst
   draw_plotst   html_reportt	   save_jsont   metagenemarkt   debugt   portable_htmlt   testt   test_svt   test_no_reft   no_checkt   no_check_metat   unique_mappingt   no_gct   no_svt   no_gzipt	   show_snpst   glimmert   is_combined_reft   check_for_fragmented_refRr   t   all_labels_from_dirst   force_nucmert   silentt   error_log_fpatht
   save_errort   test_output_dirnamet   default_results_root_dirnamet   nowt   strftimet   output_dirnamet   make_latest_symlinkt   default_json_dirnamet   corrected_dirnamet   plots_fnamet   report_prefixt   transposed_report_prefixt   gage_report_prefixt   html_aux_dirt   contig_report_fname_patternt   icarus_report_fname_patternt   nucmer_output_dirnamet   downloaded_dirnamet   per_ref_dirnamet   meta_summary_dirt   not_aligned_namet   combined_output_namet   krona_dirnamet   combined_ref_namet   downloaded_ref_min_aligned_ratet   unique_contigs_fname_patternt   calculate_read_supportt   use_input_ref_ordert   variation_dirnamet   trivial_deletions_fnamet   manta_sv_fnamet   used_colorst   used_lst   draw_svgt   create_icarus_htmlt   icarus_css_namet   icarus_script_namet   icarus_dirnamet   icarus_html_fnamet   icarus_menu_template_fnamet   icarus_viewers_template_fnamet   icarus_linkt   contig_size_viewer_fnamet   contig_size_viewer_namet   contig_alignment_viewer_namet   one_alignment_viewer_namet   alignment_viewer_part_namet   alignment_viewer_fpatht   MAX_SIZE_FOR_COMB_PLOTt   max_contigs_num_for_size_viewert   min_contig_for_size_viewert   contig_len_deltat   min_similar_contig_sizet	   cov_fpatht   phys_cov_fpatht   SHORT_INDEL_THRESHOLDRs   Rp   t   fragmented_max_indentt   BSS_MAX_SETS_NUMBERt   gap_filled_ns_thresholdRP   t   assemblies_numt   memory_efficientt   space_efficientt   min_gap_sizet   min_gene_overlapt   GC_bin_sizet   GC_contig_bin_sizet   assembly_labels_by_fpatht   assemblies_fpathst   potential_scaffolds_assembliest
   max_pointst   min_differencet   max_coverage_binst   pcnt_covered_for_histogramt   dict_of_broken_scaffoldst   Ns_break_thresholdRq   t   custom_blast_db_fpatht   downloaded_refst   identity_thresholdt
   min_lengtht   min_bitscoreRj   Rt   Ru   t   output_dirpatht	   referencet   genest   operonst   labelst   samt   bamt   bedt   forward_readst   reverse_readst   references_txtt   json_output_dirpathRG   RS   Ra   Rf   Rb   Rz   (    (    (    sN   /data/home/pitagoras/public_html/gigas/quast/quast-4.6.3/quast_libs/qconfig.pyt   <module>   sD  6		!			$