<s> """<STR_LIT>""" <EOL> import logging <EOL> from pbtools . pbtranscript . __init__ import get_version <EOL> from pbtools . pbtranscript . PBTranscriptOptions import add_fofn_arguments , add_cluster_root_dir_as_positional_argument <EOL> from pbtools . pbtranscript . Utils import nfs_exists <EOL> from pbtools . pbtranscript . ice . IceFiles import IceFiles <EOL> from pbtools . pbtranscript . ice . IcePartial import build_uc_from_partial , build_uc_from_partial_daligner <EOL> def add_ice_partial_i_arguments ( parser ) : <EOL> """<STR_LIT>""" <EOL> parser = add_cluster_root_dir_as_positional_argument ( parser ) <EOL> helpstr = "<STR_LIT>" <EOL> parser . add_argument ( "<STR_LIT:i>" , help = helpstr , type = int ) <EOL> parser . add_argument ( "<STR_LIT>" , <EOL> type = int , <EOL> dest = "<STR_LIT>" , <EOL> action = "<STR_LIT:store>" , <EOL> default = <NUM_LIT:12> , <EOL> help = "<STR_LIT>" ) <EOL> parser = add_fofn_arguments ( parser , ccs_fofn = True ) <EOL> return parser <EOL> class IcePartialI ( object ) : <EOL> """<STR_LIT>""" <EOL> desc = "<STR_LIT>" + "<STR_LIT>" + "<STR_LIT>" <EOL> prog = "<STR_LIT>" <EOL> def __init__ ( self , root_dir , i , ccs_fofn , blasr_nproc ) : <EOL> """<STR_LIT>""" <EOL> self . root_dir = root_dir <EOL> self . i = int ( i ) <EOL> self . ccs_fofn = ccs_fofn <EOL> self . blasr_nproc = int ( blasr_nproc ) <EOL> def getVersion ( self ) : <EOL> """<STR_LIT>""" <EOL> return get_version ( ) <EOL> def cmd_str ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _cmd_str ( root_dir = self . root_dir , i = self . i , <EOL> ccs_fofn = self . ccs_fofn , <EOL> blasr_nproc = self . blasr_nproc ) <EOL> def _cmd_str ( self , root_dir , i , ccs_fofn , blasr_nproc ) : <EOL> """<STR_LIT>""" <EOL> cmd = self . prog + "<STR_LIT>" . format ( d = root_dir ) + "<STR_LIT>" . format ( i = i ) <EOL> if ccs_fofn is not None : <EOL> cmd += "<STR_LIT>" . format ( ccs_fofn = ccs_fofn ) <EOL> if blasr_nproc is not None : <EOL> cmd += "<STR_LIT>" . format ( n = blasr_nproc ) <EOL> return cmd <EOL> def validate_inputs ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . _validate_inputs ( root_dir = self . root_dir , <EOL> i = self . i , ccs_fofn = self . ccs_fofn , <EOL> blasr_nproc = self . blasr_nproc ) <EOL> def _validate_inputs ( self , root_dir , i , ccs_fofn , blasr_nproc ) : <EOL> """<STR_LIT>""" <EOL> icef = IceFiles ( prog_name = "<STR_LIT>" . format ( i = i ) , <EOL> root_dir = root_dir , no_log_f = False ) <EOL> ref_fasta = icef . final_consensus_fa <EOL> ref_dazz = icef . final_dazz_db <EOL> input_fasta = icef . nfl_fa_i ( i ) <EOL> out_pickle = icef . nfl_pickle_i ( i ) <EOL> done_file = icef . nfl_done_i ( i ) <EOL> script_file = icef . nfl_script_i ( i ) <EOL> errMsg = "<STR_LIT>" <EOL> if not nfs_exists ( input_fasta ) : <EOL> errMsg = ( "<STR_LIT>" . format ( i = i ) + <EOL> "<STR_LIT>" . format ( f = input_fasta ) + <EOL> "<STR_LIT>" ) <EOL> elif not nfs_exists ( ref_fasta ) : <EOL> errMsg = ( "<STR_LIT>" + <EOL> "<STR_LIT>" . format ( f = ref_fasta ) + <EOL> "<STR_LIT>" ) <EOL> elif not nfs_exists ( ref_dazz ) : <EOL> errMsg = ( "<STR_LIT>" + <EOL> "<STR_LIT>" . format ( f = ref_dazz ) + <EOL> "<STR_LIT>" ) <EOL> if len ( errMsg ) != <NUM_LIT:0> : <EOL> raise ValueError ( errMsg ) <EOL> cmd = self . _cmd_str ( root_dir = root_dir , i = i , <EOL> ccs_fofn = ccs_fofn , <EOL> blasr_nproc = blasr_nproc ) <EOL> with open ( script_file , '<STR_LIT:w>' ) as writer : <EOL> writer . write ( cmd + "<STR_LIT:\n>" ) <EOL> icef . add_log ( "<STR_LIT>" . <EOL> format ( script_file = script_file ) ) <EOL> icef . close_log ( ) <EOL> return ( input_fasta , ref_fasta , ref_dazz , out_pickle , done_file ) <EOL> def run ( self ) : <EOL> """<STR_LIT>""" <EOL> logging . debug ( "<STR_LIT>" . format ( d = self . root_dir ) ) <EOL> logging . debug ( "<STR_LIT>" . format ( f = self . i ) ) <EOL> logging . debug ( "<STR_LIT>" . format ( ccs_fofn = self . ccs_fofn ) ) <EOL> input_fasta , ref_fasta , dazz_db , out_pickle , done_file = self . validate_inputs ( ) <EOL> logging . info ( "<STR_LIT>" ) <EOL> build_uc_from_partial_daligner ( input_fasta = input_fasta , <EOL> ref_fasta = ref_fasta , <EOL> out_pickle = out_pickle , <EOL> ccs_fofn = self . ccs_fofn , <EOL> done_filename = done_file , <EOL> use_finer_qv = False , <EOL> cpus = self . blasr_nproc , <EOL> no_qv_or_aln_checking = True ) </s>
