def __init__(self, **keywords): """ 2008-11-10 """ ProcessOptions.process_function_arguments( keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self ) if self.phenotype_method_id_ls: self.phenotype_method_id_ls = getListOutOfStr(self.phenotype_method_id_ls, data_type=int) self.which_PC_index_ls = getListOutOfStr(self.which_PC_index_ls, data_type=int) self.run_whole_matrix = { 1: self._kruskal_wallis_whole_matrix, 2: self.LM_whole_matrix, 3: self.Emma_whole_matrix, 4: self.LM_with_PCs_whole_matrix, 5: self.LM_with_PCs_whole_matrix, 6: self.LM_with_PCs_whole_matrix, 7: self.Emma_whole_matrixForNoNAGenotypeMatrix, 8: self.EMMAX, } self.output_results = { 1: self.output_kw_results, 2: self.output_lm_results, 3: self.output_lm_results, 7: self.output_emma_results, }
def __init__(self, **keywords): """ 2008-07-09 """ #2013.1.10 backwards compatibility keywords = self._setInputArgumentsEquivalentValue(keywords=keywords, argument1Name='username', argument2Name='db_user') keywords = self._setInputArgumentsEquivalentValue(keywords=keywords, argument1Name='password', argument2Name='db_passwd') keywords = self._setInputArgumentsEquivalentValue(keywords=keywords, argument1Name='database', argument2Name='dbname') from pymodule import ProcessOptions ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) if self.echo_pool: #2010-9-19 passing echo_pool to create_engine() causes error. all pool log disappeared. #2010-9-19 Set up a specific logger with our desired output level import logging #import logging.handlers logging.basicConfig() #LOG_FILENAME = '/tmp/sqlalchemy_pool_log.out' my_logger = logging.getLogger('sqlalchemy.pool') # Add the log message handler to the logger #handler = logging.handlers.RotatingFileHandler(LOG_FILENAME, maxBytes=1000000, backupCount=5) # create formatter #formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") # add formatter to handler #handler.setFormatter(formatter) #my_logger.addHandler(handler) my_logger.setLevel(logging.DEBUG) #self.setup_engine() #2012.12.18 it needs __metadata__ , __session__ from each db-definition file itself self.READMEClass = None #2012.12.18 required to figure out data_dir self._data_dir = None #2012.11.13 if hasattr(self, 'debug') and self.debug: import pdb pdb.set_trace()
def __init__(self, **keywords): """ 2009-4-18 """ from pymodule import ProcessOptions ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)
def __init__(self, **keywords): """ 2009-2-12 """ ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, \ class_to_have_attr=self) if self.chromosome ==0 or self.chromosome=='0': self.chromosome = None
def __init__(self, **keywords): """ 2008-10-29 database to control cluster jobs """ from pymodule import ProcessOptions ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) self.setup_engine(metadata=__metadata__, session=__session__, entities=entities)
def __init__(self, **keywords): from pymodule import ProcessOptions ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) self._threadlocal = threading.local() self.tables = {} self.mappers = {} self._engine = None
def __init__(self, **keywords): """ 2009-2-12 """ ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)
def __init__(self, **keywords): """ 2008-04-28 use ProcessOptions, newer option handling class 2008-04-16 """ from pymodule import ProcessOptions ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)
def __init__(self, **keywords): """ 2008-10-23 simplified, relegate stuff to ElixirDB 2008-07-09 """ from pymodule import ProcessOptions ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) self.setup_engine(metadata=__metadata__, session=__session__, entities=entities)
def __init__(self, **keywords): """ 2008-06-02 use ProcessOptions 2007-07-11 2007-07-13 input_fname is useless """ from pymodule import ProcessOptions ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)
def __init__(self, **keywords): """ 2009-4-10 simplified further by moving db-common lines to ElixirDB 2008-08-11 """ from pymodule.ProcessOptions import ProcessOptions ProcessOptions.process_function_arguments( keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self ) self.setup_engine(metadata=__metadata__, session=__session__, entities=entities)
def __init__(self, **keywords): """ 2008-05-01 use ProcessOptions """ from pymodule import ProcessOptions ProcessOptions.process_function_arguments( keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self ) if not self.output_fname: self.output_fname = "%s_w%s.npute" % (self.input_fname, self.single_window_size)
def __init__(self, **keywords): """ 2008-06-02 use ProcessOptions 2007-07-16 """ from pymodule import ProcessOptions ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) cutoff_ls = self.max_row_NA_max_col_NA_min_log_prob.split(',') self.row_cutoff, self.col_cutoff, self.min_log_prob = map(float, cutoff_ls)
def __init__(self, **keywords): """ 2008-05-01 use ProcessOptions """ from pymodule import ProcessOptions ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) if not self.output_fname: self.output_fname = '%s_w%s.npute' % (self.input_fname, self.single_window_size)
def __init__(self, **keywords): """ 2008-11-10 """ ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) self.phenotype_method_id_ls = getListOutOfStr( self.phenotype_method_id_ls, data_type=int) self.cofactors = getListOutOfStr(self.cofactors, data_type=str) self.cofactor_phenotype_id_ls = getListOutOfStr( self.cofactor_phenotype_id_ls, data_type=int)
def __init__(self, **keywords): """ 2008-09-29 add option min_LD_to_output and min_MAF """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)
def __init__(self, **keywords): """ 2008-05-27 add user & password 2007-12-29 add processing_bits """ ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) processing_bits = self.processing_bits self.processing_bits = [0]*len(processing_bits) for i in range(len(processing_bits)): self.processing_bits[i] = int(processing_bits[i]) self.data_type2data_table = {0:'at.locus', 1:'chip.snp_combined_may_9_06_no_van'}
def __init__(self, inputFnameLs, **keywords): """ 2011-7-11 """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, \ class_to_have_attr=self)
def __init__(self, **keywords): """ 2008-09-05 """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) self.call_method_id_ls = getListOutOfStr(self.call_method_id_ls, data_type=int)
def __init__(self, **keywords): """ 2008-12-02 modelled after ConvertYuSNPFormat2Bjarni.py """ from pymodule import ProcessOptions self.ad=ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)
def __init__(self, refNameLs, **keywords): """ 2011-7-11 """ self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, \ class_to_have_attr=self) self.refNameLs = refNameLs
def __init__(self, **keywords): """ 2011-7-12 """ self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, \ class_to_have_attr=self) self.discoverFuncDict = {1: self.discoverFromVCF, 2: self.discoverFromBAM, 3:self.discoverFromVCFWithoutFilter}
def __init__(self, **keywords): """ 2008-11-14 """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) self.pic_area = self.pic_area.split(',') self.pic_area = map(int, self.pic_area)
def __init__(self, **keywords): """ 2008-07-24 split results_method_id_ls if it exists, to accomodate MpiGeneListRankTest which removed this option 2008-07-10 """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)
def __init__(self, **keywords): """ 2008-10-19 """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) if self.output_dir and not os.path.isdir(self.output_dir): os.makedirs(self.output_dir)
def __init__(self, inputFnameLs=None, **keywords): """ """ AbstractVervetMapper.__init__(self, inputFnameLs=inputFnameLs, **keywords) listArgumentName_data_type_ls = [("site_id_ls", int), ('country_id_ls', int), ('tax_id_ls', int)] listArgumentName2hasContent = ProcessOptions.processListArguments(listArgumentName_data_type_ls,\ emptyContent=[], class_to_have_attr=self)
def __init__(self, inputFnameLs=None, **keywords): """ """ AbstractVCFMapper.__init__(self, inputFnameLs=inputFnameLs, **keywords) listArgumentName_data_type_ls = [("inputHeaderLs", str)] listArgumentName2hasContent = ProcessOptions.processListArguments(listArgumentName_data_type_ls,\ emptyContent=[], class_to_have_attr=self)
def __init__(self, **keywords): """ 2008-05-11 """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) if self.ecotype_id_ls: self.ecotype_id_ls = getListOutOfStr(self.ecotype_id_ls, data_type=str) #str because ecotype ids in SNPData are not converted to integers
def __init__(self, **keywords): """ 2008-05-18 add argument array_id_2nd_column 2008-5-12 """ from pymodule import ProcessOptions self.ad=ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)
def __init__(self, **keywords): """ 2008-4-4 """ #argument dictionary #self.ad = process_function_arguments(keywords, argument_default_dict, error_doc=__doc__, class_to_have_attr=self) from pymodule import ProcessOptions self.ad=ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)
def __init__(self, **keywords): """ 2008-06-02 use ProcessOptions 2007-07-13 add output_type, need_heterozygous_call, with_header_line, nt_alphabet 2007-07-16 change snpacc_fname to popid2snpid_table 2007-07-16 """ from pymodule import ProcessOptions ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) self.OutputPop_dict = {1: self.OutputPopMatrixFormat, 2: self.OutputPopRMES, 3: self.OutputPopMIH}
def __init__(self, **keywords): """ 2009-1-5 """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, \ class_to_have_attr=self) self.get_closest = 1 #2011-01-26, the argument has been commented out. set it to 1 here.
def __init__(self, inputFnameLs, **keywords): """ 2011-7-11 """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, \ class_to_have_attr=self) self.inputFnameLs = inputFnameLs
def __init__(self, **keywords): """ 2008-04-08 """ from pymodule import ProcessOptions self.ad=ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) if self.array_id_ls: self.array_id_ls = getListOutOfStr(self.array_id_ls, data_type=str)
def __init__(self, **keywords): ''' 2009-10-6 self.snps is the data structure holding all the SNP data. It's a list of encoded (0,1, or ?)strings. each string corresponds to alleles of one SNP across all accessions. self.nucs is a list of tuples, which encode the major/minor alleles of each SNP. allele 0 (major) is the nucleotide at index 0 of the tuple. self.sdps is a set of unique strings from self.snps. 05/09/08 change interface, inFile could be a data structure Constructor reads in data file, generates mismatch vectors and upper triangular matrix extract indices, and reports stats of data. ''' from pymodule import ProcessOptions ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) start = time.time() #if isinstance(inFile, str) and os.path.isfile(inFile): if self.input_file_format == 2: self.readInData(self.inFile) elif self.input_file_format == 1: self.snps, self.sdps, self.nucs, self.chosen_snps_name_ls = self.readOneChromosomeData( self.snps_name_ls, self.data_matrix, self.chromosome) self.numSamps = len(self.snps[0]) #elif isinstance(inFile, RawSnpsData): #05/07/08 it's snpsd data structure elif self.input_file_format == 3: snpsd = dataParsers.parseCSVData(self.inFile, withArrayIds=True) self.input_NA_char = 'NA' self.snps, self.sdps, self.nucs, self.numSamps = self.getDataStructureFromSNPsD( snpsd[0]) elif self.input_file_format == 4: self.snps, self.sdps, self.nucs, self.numSamps = self.getDataStructureFromSNPsD( self.inFile) else: sys.stderr.write('unsupported inFile format: %s\n' % self.input_file_format) self.genMismatchVectors() self.genExtractIndices() t = int(time.time() - start + 0.5) sys.stderr.write('Number of Samples: %d\n' % self.numSamps) sys.stderr.write('Number of SNPs: %d\n' % len(self.snps)) sys.stderr.write('Number of SDPs: %d' % len(self.sdps)) sys.stderr.write('Time to Process: %d m %d s\n' % (t / 60, t % 60))
def __init__(self, **keywords): """ 2011-7-11 """ self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, \ class_to_have_attr=self) if not self.outputFnamePrefix: self.outputFnamePrefix = utils.getRealPrefixSuffixOfFilenameWithVariableSuffix(self.inputFname)[0]
def __init__(self, inputFnameLs=None, **keywords): """ 2011-7-12 """ self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, \ class_to_have_attr=self) self.originalHeaderLength = 0 self.originalHeader = None self.col_name2index = {}
def __init__(self, **keywords): """ 2008-05-13 """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) plot_func_dict = {1:PlotQCCall._plot3D,\ 2:PlotQCCall._plotContour} self._plot = plot_func_dict[self.plot_type]
def __init__(self, inputFnameLs, **keywords): """ 2011-10-19 This class is the entry to all others. """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) self.inputFnameLs = inputFnameLs
def __init__(self, **keywords): """ 2008-05-08 add self.output_matrix_type, self.delimiter 2008-04-28 use ProcessOptions, newer option handling class 2008-04-25 use new option handling 2007-02-25 add argument toss_out_rows 2007-07-11 add mysql_connection 2007-09-23 use processing_bits to control processing steps """ from pymodule import ProcessOptions ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) #below are all default values, so that user doesn't have specify every bit in self.processing_bits on the commandline processing_bits_ls = [0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0] for i in range(len(self.processing_bits)): processing_bits_ls[i] = int(self.processing_bits[i]) #now pass all values self.only_include_strains_with_GPS,\ self.include_other_strain_info,\ self.resolve_duplicated_calls,\ self.toss_out_rows,\ self.need_heterozygous_call,\ self.with_header_line,\ self.nt_alphabet,\ self.discard_all_NA_strain,\ self.output_matrix_type, \ self.delimiter_type ,\ self.toss_contaminants = processing_bits_ls delimiter_dict = {0: '\t', \ 1: ','} self.delimiter = delimiter_dict[self.delimiter_type]
def __init__(self, **keywords): """ 2008-12-02 modelled after ConvertYuSNPFormat2Bjarni.py """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments( keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)
def __init__(self, **keywords): """ """ self.ad = ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, \ class_to_have_attr=self) self.inf = None self._initializeInput(inputFname=self.inputFname) self._seqTitle2sequence = None self._seqTitleList = None #2013.07.08 self.outf = None
def __init__(self, **keywords): from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments( keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) if self.phenotype_method_id_ls is not None: self.phenotype_method_id_ls = getListOutOfStr( self.phenotype_method_id_ls, data_type=int)
def __init__(self, **keywords): """ 2008-09-17 allow priority=3 or 4 2008-06-02 """ self.ad = ProcessOptions.process_function_arguments( keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)
def __init__(self, **keywords): """ 2008-12-05 This class is the entry to all others. """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments( keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)
def __init__(self, **keywords): """ 2008-04-08 """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments( keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) if self.array_id_ls: self.array_id_ls = getListOutOfStr(self.array_id_ls, data_type=str)
def __init__(self, **keywords): """ 2008-07-24 split results_method_id_ls if it exists, to accomodate MpiGeneListRankTest which removed this option 2008-07-10 """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments( keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)
def __init__(self, **keywords): """ 2008-10-10 add option min_gap to draw LD between loci at least this apart 2008-09-24 """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments( keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)
def __init__(self, **keywords): """ 2008-10-19 """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments( keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) if self.output_dir and not os.path.isdir(self.output_dir): os.makedirs(self.output_dir)
def __init__(self, **keywords): """ 2008-4-4 """ #argument dictionary #self.ad = process_function_arguments(keywords, argument_default_dict, error_doc=__doc__, class_to_have_attr=self) from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments( keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self)
def __init__(self, **keywords): """ 2008-06-02 use ProcessOptions 2007-07-13 add output_type, need_heterozygous_call, with_header_line, nt_alphabet 2007-07-16 change snpacc_fname to popid2snpid_table 2007-07-16 """ from pymodule import ProcessOptions ProcessOptions.process_function_arguments(keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) self.OutputPop_dict = { 1: self.OutputPopMatrixFormat, 2: self.OutputPopRMES, 3: self.OutputPopMIH }
def __init__(self, **keywords): """ 2008-05-13 """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments( keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) plot_func_dict = {1:PlotQCCall._plot3D,\ 2:PlotQCCall._plotContour} self._plot = plot_func_dict[self.plot_type]
def __init__(self, **keywords): """ 2008-09-18 use pymodule.ProcessOptions 2008-01-21 ecotype_duplicate2tg_ecotypeid_table, snp_locus_table1 and snp_locus_table2 are useless """ from pymodule import ProcessOptions self.ad = ProcessOptions.process_function_arguments( keywords, self.option_default_dict, error_doc=self.__doc__, class_to_have_attr=self) QualityControl.__init__(self, debug=self.debug)