def addTranslateIDInIBDCheckResultJob(self, workflow=None, plinkIBDCheckOutputFile=None, pop_country_id_ls_str=None, \
										pop_site_id_ls_str=None, popHeader=None,\
										readGroupFile=None, parentJobLs=None, sampleIDHeader='sampleID',\
										transferOutput=False):
		"""
		2012.10.24
			moved from popgen/CompareAlleleFrequencyOfTwoPopulationFromOneVCFFolder.py
		2012.10.15
		"""
		job = None
		if plinkIBDCheckOutputFile:
			pop_country_id_set = set(getListOutOfStr(pop_country_id_ls_str))
			pop_site_id_set = set(getListOutOfStr(pop_site_id_ls_str))
			if 447 in pop_site_id_set or 135 in pop_country_id_set:	#either site = VRC or country = USA
				commonPrefix = os.path.splitext(plinkIBDCheckOutputFile.name)[0]
				outputFile = File('%s_%s_withReadGroup.tsv'%(commonPrefix, popHeader))
				extraArgumentList = [" --readGroupFname", readGroupFile, "--readGroupHeader %s"%(sampleIDHeader), \
									'--replaceColumnHeaderLs IID1,IID2']
				job = self.addAbstractMatrixFileWalkerJob(workflow=workflow, executable=self.ReplaceIndividualIDInMatrixFileWithReadGroup, \
							inputFileList=None, inputFile=plinkIBDCheckOutputFile, outputFile=outputFile, \
							outputFnamePrefix=None, whichColumn=None, whichColumnHeader=sampleIDHeader, \
							minNoOfTotal=0,\
							samplingRate=1.0, \
							parentJob=None, parentJobLs=parentJobLs, \
							extraDependentInputLs=[readGroupFile], \
							extraArgumentList=extraArgumentList, transferOutput=transferOutput,  job_max_memory=1000,\
							sshDBTunnel=self.needSSHDBTunnel, \
							objectWithDBArguments=self,)
		
		return job
    def __init__(self, **keywords):
        """
		2011-7-11
		"""
        AbstractVariationWorkflow.__init__(self, **keywords)

        if getattr(self, 'result_id_ls', None):
            self.result_id_ls = getListOutOfStr(self.result_id_ls,
                                                data_type=int)
            self.result_id_ls.sort()
        else:
            self.result_id_ls = []

        if getattr(self, 'analysis_method_id_ls', None):
            self.analysis_method_id_ls = getListOutOfStr(
                self.analysis_method_id_ls, data_type=int)
            self.analysis_method_id_ls.sort()
        else:
            self.analysis_method_id_ls = []
        if getattr(self, 'phenotype_method_id_ls', None):
            self.phenotype_method_id_ls = getListOutOfStr(
                self.phenotype_method_id_ls, data_type=int)
            self.phenotype_method_id_ls.sort()
        else:
            self.phenotype_method_id_ls = []
    def __init__(self, **keywords):
        """
		2012.6.5
			to replace MpiAssociation.py
		"""
        AbstractVariationWorkflow.__init__(self, **keywords)

        if getattr(self, 'call_method_id_ls', None):
            self.call_method_id_ls = getListOutOfStr(self.call_method_id_ls,
                                                     data_type=int)
            self.call_method_id_ls.sort()
        else:
            self.call_method_id_ls = []

        if getattr(self, 'analysis_method_id_ls', None):
            self.analysis_method_id_ls = getListOutOfStr(
                self.analysis_method_id_ls, data_type=int)
            self.analysis_method_id_ls.sort()
        else:
            self.analysis_method_id_ls = []
        if getattr(self, 'phenotype_method_id_ls', None):
            self.phenotype_method_id_ls = getListOutOfStr(
                self.phenotype_method_id_ls, data_type=int)
            self.phenotype_method_id_ls.sort()
        else:
            self.phenotype_method_id_ls = []
Beispiel #4
0
    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,
        }
Beispiel #5
0
	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.analysis_method_id_ls = getListOutOfStr(self.analysis_method_id_ls, data_type=int)
		self.phenotype_method_id_ls = getListOutOfStr(self.phenotype_method_id_ls, data_type=int)
Beispiel #6
0
	def __init__(self,  **keywords):
		"""
		2008-08-20
		"""
		TopSNPTest.__init__(self, **keywords)
		self.list_type_id_ls = getListOutOfStr(self.list_type_id_ls, data_type=int)
		self.analysis_method_id_ls = getListOutOfStr(self.analysis_method_id_ls, data_type=int)
		self.phenotype_method_id_ls = getListOutOfStr(self.phenotype_method_id_ls, data_type=int)
	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.analysis_method_id_ls:
			self.analysis_method_id_ls = getListOutOfStr(self.analysis_method_id_ls, data_type=int)
		if self.phenotype_method_id_ls:
			self.phenotype_method_id_ls = getListOutOfStr(self.phenotype_method_id_ls, data_type=int)
Beispiel #8
0
    def __init__(self, **keywords):
        """
		2008-08-20
		"""
        TopSNPTest.__init__(self, **keywords)
        self.list_type_id_ls = getListOutOfStr(self.list_type_id_ls,
                                               data_type=int)
        self.analysis_method_id_ls = getListOutOfStr(
            self.analysis_method_id_ls, data_type=int)
        self.phenotype_method_id_ls = getListOutOfStr(
            self.phenotype_method_id_ls, data_type=int)
Beispiel #9
0
	def __init__(self,  **keywords):
		"""
		2008-11-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)
		
		self.phenotype_id_ls = getListOutOfStr(self.phenotype_id_ls, data_type=int)
		self.analysis_method_id_ls = getListOutOfStr(self.analysis_method_id_ls, data_type=int)
		if self.output_dir and not os.path.isdir(self.output_dir):
			os.makedirs(self.output_dir)
    def __init__(self, **keywords):
        """
		2008-11-19
		"""
        AbstractVariationMappe.__init__(self, **keywords)

        self.phenotype_id_ls = getListOutOfStr(self.phenotype_id_ls,
                                               data_type=int)
        self.analysis_method_id_ls = getListOutOfStr(
            self.analysis_method_id_ls, data_type=int)
        if self.output_dir and not os.path.isdir(self.output_dir):
            os.makedirs(self.output_dir)
Beispiel #11
0
    def __init__(self, **keywords):
        RunGADA.__init__(self, **keywords)
        self.aAlpha_ls = getListOutOfStr(self.aAlpha_ls, data_type=float)
        self.TBackElim_ls = getListOutOfStr(self.TBackElim_ls, data_type=float)
        self.MinSegLen_ls = getListOutOfStr(self.MinSegLen_ls, data_type=int)

        # 2010-5-30
        self.communicator = MPI.world.duplicate()
        MPIwrapper.__init__(self,
                            self.communicator,
                            debug=self.debug,
                            report=self.report)
    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):
		"""
		2012.2.8
		"""
		AbstractNGSWorkflow.__init__(self, **keywords)
		if self.isq_id_ls:
			self.isq_id_ls = getListOutOfStr(self.isq_id_ls, data_type=int)
Beispiel #14
0
    def __init__(self, **keywords):
        """
		2008-07-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.getIntensityFuncDict = {
            1: self.getQCIntensityLs,
            2: self.getIntensityLsFromOutputGivenProbeSubset,
            3: self.getAllIntensityFromArray
        }

        self.xlim = getListOutOfStr(self.xlim, data_type=float)
        self.array_id_ls = getListOutOfStr(self.array_id_ls, int)
Beispiel #15
0
	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):
        """
		2011-7-11
		"""
        AbstractVervetWorkflow.__init__(self, **keywords)

        if self.ind_seq_id_ls:
            self.ind_seq_id_ls = getListOutOfStr(self.ind_seq_id_ls, data_type=int)
Beispiel #17
0
	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
Beispiel #18
0
    def __init__(self, **keywords):
        """
		2010-3-8
			add argument min_score, phenotype_id_ls
		2009-2-16
		"""
        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.analysis_method_id_ls = getListOutOfStr(
            self.analysis_method_id_ls, data_type=int)
        self.phenotype_id_ls = getListOutOfStr(self.phenotype_id_ls,
                                               data_type=int)
Beispiel #19
0
    def __init__(self, **keywords):
        """
		2008-10-20
		"""
        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.results_method_id_ls = getListOutOfStr(self.results_method_id_ls,
                                                    data_type=int)
        self.list_type_id_ls = getListOutOfStr(self.list_type_id_ls,
                                               data_type=int)

        if self.output_dir and not os.path.isdir(self.output_dir):
            os.makedirs(self.output_dir)
Beispiel #20
0
    def __init__(self, **keywords):
        """
		2008-08-27
			inherit from TopSNPTest
		"""
        TopSNPTest.__init__(self, **keywords)
        if self.phenotype_method_id_ls:
            self.phenotype_method_id_ls = getListOutOfStr(
                self.phenotype_method_id_ls, data_type=int)
Beispiel #21
0
    def __init__(self, **keywords):
        """
		2012.2.28
		"""
        AbstractVariationWorkflow.__init__(self, **keywords)
        self.inputFolder = os.path.abspath(self.inputFolder)
        if getattr(self, 'analysis_method_id_ls', None):
            self.analysis_method_id_ls = getListOutOfStr(
                self.analysis_method_id_ls, data_type=int)
            self.analysis_method_id_ls.sort()
        else:
            self.analysis_method_id_ls = []
        if getattr(self, 'phenotype_method_id_ls', None):
            self.phenotype_method_id_ls = getListOutOfStr(
                self.phenotype_method_id_ls, data_type=int)
            self.phenotype_method_id_ls.sort()
        else:
            self.phenotype_method_id_ls = []
Beispiel #22
0
    def __init__(self, inputFnameLs, **keywords):
        """
		"""
        AbstractVariationMapper.__init__(self, inputFnameLs, **keywords)
        if self.list_type_id_list:
            self.list_type_id_list = getListOutOfStr(self.list_type_id_list,
                                                     data_type=int)
        else:
            self.list_type_id_list = []

        self.result_id_peak_type_id_ls = getListOutOfStr(
            self.result_id_peak_type_id_ls, data_type=str)
        result_id_peak_type_id_ls = []
        for result_id_peak_type_id in self.result_id_peak_type_id_ls:
            result_id_peak_type_id = result_id_peak_type_id.split(':')
            result_id_peak_type_id = map(int, result_id_peak_type_id)
            result_id_peak_type_id_ls.append(result_id_peak_type_id)
        self.result_id_peak_type_id_ls = result_id_peak_type_id_ls
Beispiel #23
0
	def __init__(self, **keywords):
		"""
		2008-11-25
			change option phenotype_index_ls to phenotype_method_id_ls to pick phenotypes. phenotype_method_id is more intuitive.
		"""
		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, inputFnameLs, **keywords):
        """
		"""
        AssociationPeak2AssociationLocus.__init__(self, inputFnameLs,
                                                  **keywords)

        self.call_method_id_ls = getListOutOfStr(self.call_method_id_ls,
                                                 data_type=int)
        self.analysis_method_id_ls = getListOutOfStr(
            self.analysis_method_id_ls, data_type=int)
        self.phenotype_id_ls = getListOutOfStr(self.phenotype_id_ls,
                                               data_type=int)
        self.phenotype_id_ls.sort()
        self.result_peak_type_id_ls = getListOutOfStr(
            self.result_peak_type_id_ls, data_type=int)

        self.phenotype_id_set = set(self.phenotype_id_ls)
        self.call_method_id_set = set(self.call_method_id_ls)
        self.analysis_method_id_set = set(self.analysis_method_id_ls)
	def __init__(self, inputFnameLs=None, **keywords):
		"""
		"""
		AbstractVariationMapper.__init__(self, inputFnameLs=inputFnameLs, **keywords)
		AbstractPlot.__init__(self, inputFnameLs=inputFnameLs, **keywords)
		
		if self.list_type_id_list:
			self.list_type_id_list = getListOutOfStr(self.list_type_id_list, data_type=int)
		else:
			self.list_type_id_list = []
Beispiel #26
0
	def __init__(self,  **keywords):
		"""
		2008-07-01 chop off most functions, inherit from QC_250k
		2008-04-20
		"""
		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.call_info_id_ls:
			self.call_info_id_ls = getListOutOfStr(self.call_info_id_ls, data_type=int)
		self.QCMethod_class = QCMethod
	def __init__(self,  **keywords):
		"""
		2012.3.29
			default to stage out final output.
			Argument stageOutFinalOutput morphs into notStageOutFinalOutput.
		2011-7-11
		"""
		ShortRead2AlignmentWorkflow.__init__(self, **keywords)
		
		if self.ind_seq_id_ls:
			self.ind_seq_id_ls = getListOutOfStr(self.ind_seq_id_ls, data_type=int)
	def __init__(self,  **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)
		if self.ind_seq_id_ls:
			self.ind_seq_id_ls = getListOutOfStr(self.ind_seq_id_ls, data_type=int)
		
		self.vervetSrcPath = self.vervetSrcPath%self.home_path
    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.jumpStep is None:
            self.jumpStep = self.blockSize / 4
        if self.minNoOfProbesPerBlock is None:
            self.minNoOfProbesPerBlock = self.blockSize * self.blockSize / 6
        self.array_id_ls = getListOutOfStr(self.array_id_ls, data_type=int)
        self.x_range = getListOutOfStr(self.x_range, data_type=int)
        self.y_range = getListOutOfStr(self.y_range, data_type=int)

        self.communicator = MPI.world.duplicate()
        MPIwrapper.__init__(self,
                            self.communicator,
                            debug=self.debug,
                            report=self.report)
	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)
		#record it as string
		self.trio_set_str = self.trio_id
		if self.trio_id:
			self.trio_id = getListOutOfStr(self.trio_id, data_type=str)
		
		self.allNumberPattern = re.compile(r'^\d+')
Beispiel #31
0
    def __init__(self, inputLs, **keywords):
        """
		2012.2.28
		"""
        AbstractVariationWorkflow.__init__(self, **keywords)

        if getattr(self, 'phenotype_method_id_ls', None):
            self.phenotype_method_id_ls = getListOutOfStr(
                self.phenotype_method_id_ls, data_type=int)
            self.phenotype_method_id_ls.sort()
        else:
            self.phenotype_method_id_ls = []

        self.call_analysis_peak_type_id_list = getListOutOfStr(
            self.call_analysis_peak_type_id_list, data_type=str)
        call_analysis_peak_type_id_list = []
        for call_analysis_peak_type_id in self.call_analysis_peak_type_id_list:
            call_analysis_peak_type_id = call_analysis_peak_type_id.split(':')
            call_analysis_peak_type_id = map(int, call_analysis_peak_type_id)
            call_analysis_peak_type_id_list.append(call_analysis_peak_type_id)
        self.call_analysis_peak_type_id_list = call_analysis_peak_type_id_list
Beispiel #32
0
	def __init__(self,  **keywords):
		"""
		2008-07-24
			split results_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)
		
		self.phenotype_id_ls = getListOutOfStr(self.phenotype_id_ls, data_type=int)
		if self.output_dir and not os.path.isdir(self.output_dir):
			os.makedirs(self.output_dir)
Beispiel #33
0
    def __init__(self, **keywords):
        """
		2008-12-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.which_array_id_ls = getListOutOfStr(self.which_array_id_ls,
                                                 data_type=int)
Beispiel #34
0
    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
Beispiel #35
0
	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)
		if self.individualSequenceIDList:
			self.individualSequenceIDList = getListOutOfStr(self.individualSequenceIDList, data_type=int)	
		
		# 2010-5-30
		#self.communicator = MPI.world.duplicate()
		self.communicator = MPI.COMM_WORLD
		MPI4pywrapper.__init__(self, self.communicator, debug=self.debug, report=self.report)
Beispiel #36
0
    def __init__(self, **keywords):
        """
		2008-11-25
			change option phenotype_index_ls to phenotype_method_id_ls to pick phenotypes. phenotype_method_id is more intuitive.
		"""
        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)
Beispiel #37
0
    def __init__(self, **keywords):
        """
		2008-07-01 chop off most functions, inherit from QC_250k
		2008-04-20
		"""
        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.call_info_id_ls:
            self.call_info_id_ls = getListOutOfStr(self.call_info_id_ls,
                                                   data_type=int)
        self.QCMethod_class = QCMethod
	def __init__(self,  **keywords):
		"""
		2011-7-11
		"""
		parentClass.__init__(self, **keywords)
		if self.alnId2targetDepth:
			alnId2targetDepthLs = getListOutOfStr(self.alnId2targetDepth, data_type=str)
			self.alnId2targetDepth = {}
			for alnIdTargetDepth in alnId2targetDepthLs:
				alnIdTargetDepth = alnIdTargetDepth.split(':')
				alnIdTargetDepth = map(int, alnIdTargetDepth)
				alnId, targetDepth = alnIdTargetDepth
				self.alnId2targetDepth[alnId] = targetDepth
		else:
			self.alnId2targetDepth = {}
    def __init__(self, **keywords):
        """
		2008-07-24
			split results_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)

        self.phenotype_id_ls = getListOutOfStr(self.phenotype_id_ls,
                                               data_type=int)
        if self.output_dir and not os.path.isdir(self.output_dir):
            os.makedirs(self.output_dir)
	def filterTableRowByPhenotypeVector(self, tableObject=None, phenotypeIDList=None):
		"""
		2013.2.19
			modify the tableObject and gets rid of phenotypes in (overlap_phenotype_ls_in_str,
					input1_only_phenotype_ls_in_str, input2_only_phenotype_ls_in_str)
				that are not in phenotypeIDList
		"""
		if phenotypeIDList:
			phenotypeIDSet = set(phenotypeIDList)
		else:	#return it without modifying
			return tableObject
		phenotypeRelatedAttributeNameList = [['total_phenotype_ls_in_str', 'no_of_total_phenotypes', 'fraction_of_total_phenotypes'],\
						['overlap_phenotype_ls_in_str', 'no_of_overlap_phenotypes', 'fraction_of_overlap_phenotypes'],\
						['input1_only_phenotype_ls_in_str', 'no_of_input1_only_phenotypes', 'fraction_of_input1_only_phenotypes'], \
						['input2_only_phenotype_ls_in_str', 'no_of_input2_only_phenotypes', 'fraction_of_input2_only_phenotypes']]
		no_of_total_phenotypes = None	#no of total significant phenotypes
		for phenotypeRelatedAttributeName in phenotypeRelatedAttributeNameList:
			phenotypeListAttributeName = phenotypeRelatedAttributeName[0]
			dependentAttributeNameList = phenotypeRelatedAttributeName[1:]
			phenotypeListAttributeValue = getattr(tableObject, phenotypeListAttributeName, None)
			givenPhenotypeIDList = getListOutOfStr(phenotypeListAttributeValue)
			modified_phenotypeIDList = []
			for phenotype_id in givenPhenotypeIDList:
				if phenotype_id in phenotypeIDSet:
					modified_phenotypeIDList.append(phenotype_id)
			#modify the list attribute
			modified_phenotypeIDListInStr = utils.getSuccinctStrOutOfList(modified_phenotypeIDList)
			setattr(tableObject, phenotypeListAttributeName, modified_phenotypeIDListInStr)
			
			#modify the #phenotypes & phenotypeFraction attributes
			noOfPhenotypeAttributeName, phenotypeFractionAttributeName = dependentAttributeNameList[:2]
			noOfPhenotypes = len(modified_phenotypeIDList)
			#calculate fraction of phenotypes
			if noOfPhenotypeAttributeName=='no_of_total_phenotypes':	# this fraction is #significant-phenotypes/#all-phenotypes-in-association
				no_of_total_phenotypes = noOfPhenotypes
				oldNoOfPhenotypes = getattr(tableObject, noOfPhenotypeAttributeName, None)
				oldPhenotypeFraction = getattr(tableObject, phenotypeFractionAttributeName, None)
				phenotypeFraction = noOfPhenotypes/float(oldNoOfPhenotypes/oldPhenotypeFraction)
			elif no_of_total_phenotypes is not None and no_of_total_phenotypes>0:
				phenotypeFraction = noOfPhenotypes/float(no_of_total_phenotypes)
			else:
				phenotypeFraction = None
			setattr(tableObject, noOfPhenotypeAttributeName,  noOfPhenotypes)
			setattr(tableObject, phenotypeFractionAttributeName,  phenotypeFraction)
		return tableObject
Beispiel #41
0
	def __init__(self, **keywords):
		"""
		2008-12-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)
		
		processing_bits_ls = [1,1,1,1,1]
		
		for i in range(len(self.processing_bits)):
			processing_bits_ls[i] = int(self.processing_bits[i])
		#now pass all values
		self.quantile_normalization,\
		self.need_to_subtract_ref,\
		self.subtract_column_median,\
		self.subtract_row_median,\
		self.split_genome_into_chromosomes = processing_bits_ls
		
		self.reference_arrays = getListOutOfStr(self.reference_arrays, data_type=int)
Beispiel #42
0
    def __init__(self, **keywords):
        """
		2008-12-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)

        processing_bits_ls = [1, 1, 1, 1, 1]

        for i in range(len(self.processing_bits)):
            processing_bits_ls[i] = int(self.processing_bits[i])
        #now pass all values
        self.quantile_normalization,\
        self.need_to_subtract_ref,\
        self.subtract_column_median,\
        self.subtract_row_median,\
        self.split_genome_into_chromosomes = processing_bits_ls

        self.reference_arrays = getListOutOfStr(self.reference_arrays,
                                                data_type=int)
Beispiel #43
0
 def __init__(self, **keywords):
     RunGADA.__init__(self, **keywords)
     self.aAlpha_ls = getListOutOfStr(self.aAlpha_ls, data_type=float)
     self.TBackElim_ls = getListOutOfStr(self.TBackElim_ls, data_type=float)
     self.MinSegLen_ls = getListOutOfStr(self.MinSegLen_ls, data_type=int)
Beispiel #44
0
	def type(cls, id=None, TypeClass=model.Stock_250kDB.CandidateGeneTopSNPTestRMType, \
			template='/display_top_snp_test_rm_type.html', \
			phenotype_id_ls_str = '1-7,39-61,80-82,9-13,32-38,65-74', \
			list_type_id_ls_str = '3,6,8,28,51,64,65,68,71,76,129,24,29,30,130,131',\
			analysis_method_id_ls_str = '1,5,6,7',\
			figure_type=1, call_method_id=17):
		"""
		2009-10-13
			allow user to specify phenotype_id_ls_str and list_type_id_ls_str in URL
			add figure_type argument:
				1: candidate vs non-candidate ratio (in db beforehand)
				2: 2D matrix-plot of pvalue for enrichment statistic. row is cutoff. column is distance between gene and SNP.
			add call_method_id argument
			add argument analysis_method_id_ls_str
		2008-10-30
			generalized so that DisplayResultsGene could call it
		"""
		ResultsMethod = model.Stock_250kDB.ResultsMethod
		
		if id is None:
			id = request.params.get('id', '1')
		
		phenotype_id_ls_str = request.params.get('phenotype_id_ls_str', phenotype_id_ls_str)	# 2009-10-13
		list_type_id_ls_str = request.params.get('list_type_id_ls_str', list_type_id_ls_str)	# 2009-10-13
		analysis_method_id_ls_str  = request.params.get('analysis_method_id_ls_str', analysis_method_id_ls_str)	# 2009-10-13
		c.figure_type = request.params.get('figure_type', figure_type)	# 2009-10-13
		call_method_id = request.params.get('call_method_id', call_method_id)	# 2009-10-13
		
		phenotype_id_ls = getListOutOfStr(phenotype_id_ls_str, data_type=str)
		
		list_type_id_ls = getListOutOfStr(list_type_id_ls_str, data_type=str)
		analysis_method_id_ls = getListOutOfStr(analysis_method_id_ls_str, data_type=int)
		
		#extra_tables = ' %s c '%(CandidateGeneTopSNPTestRM.table.name)
		extra_condition = 'p.id in (%s)'%(','.join(phenotype_id_ls))
		
		c.phenotype_info  = hc.getPhenotypeInfo(extra_condition=extra_condition, extra_tables=None)
		#extra_condition = 's.type_id =%s'%id
		extra_condition = 'p.id in (%s)'%(','.join(list_type_id_ls))
		
		c.list_info = hc.getListTypeInfo(extra_condition=extra_condition)
		
		data_matrix = []
		no_of_rows = len(c.list_info.list_type_id_ls)
		no_of_cols = len(c.phenotype_info.phenotype_method_id_ls)
		for i in range(no_of_rows):
			data_matrix.append([None]*no_of_cols)
		
		c.type = TypeClass.get(id)
		
		#2008-10-29 a faster way to come up the data_matrix but data is not guaranteed inside
		rows = ResultsMethod.query.filter(ResultsMethod.phenotype_method_id.in_(map(int, phenotype_id_ls))).\
			filter(ResultsMethod.analysis_method_id.in_(analysis_method_id_ls)).\
			filter_by(call_method_id=call_method_id).\
			order_by(ResultsMethod.analysis_method_id)
		counter = 0
		for row in rows:
			col_index = c.phenotype_info.phenotype_method_id2index.get(row.phenotype_method_id)
			if col_index is None:
				continue
			for list_type_id, row_index in c.list_info.list_type_id2index.iteritems():
				if list_type_id>0:
					if data_matrix[row_index][col_index] is None:
						data_matrix[row_index][col_index] = []
					data_matrix[row_index][col_index].append((row.id, row.analysis_method.short_name))
					counter +=1
		"""
		rows = CandidateGeneTopSNPTestRM.query.filter_by(type_id=id)
		
		for row in rows:
			row_index = c.list_info.list_type_id2index[row.list_type_id]
			col_index = c.phenotype_info.phenotype_method_id2index[row.result.phenotype_method_id]
			if data_matrix[row_index][col_index] is None:
				data_matrix[row_index][col_index] = Set()
			data_matrix[row_index][col_index].add(row.results_id)
			counter +=1
		"""
		c.counter = counter
		c.data_matrix = data_matrix
		return render(template)
Beispiel #45
0
    def __init__(self, inputFnameLs, **keywords):
        """
		"""
        AbstractVariationMapper.__init__(self, inputFnameLs, **keywords)
        self.peak_id_ls = getListOutOfStr(self.peak_id_ls, data_type=int)
        self.peak_id_ls.sort()
	def __init__(self, inputFnameLs=None, **keywords):
		"""
		"""
		SelectRowsWithinCoverageRange.__init__(self, inputFnameLs=inputFnameLs, **keywords)
		#self.connectDB() called within its __init__()
		self.replaceColumnHeaderLs = getListOutOfStr(self.replaceColumnHeaderLs, data_type=str)
Beispiel #47
0
	def __init__(self,  **keywords):
		GeneListRankTest.__init__(self, **keywords)
		self.list_type_id_ls = getListOutOfStr(self.list_type_id_ls, data_type=int)
		self.analysis_method_id_ls = getListOutOfStr(self.analysis_method_id_ls, data_type=int)
		self.phenotype_method_id_ls = getListOutOfStr(self.phenotype_method_id_ls, data_type=int)
	def __init__(self,  **keywords):
		GeneListRankTest.__init__(self, **keywords)
		self.list_type_id_ls = getListOutOfStr(self.list_type_id_ls, data_type=int)
		self.analysis_method_id_ls = getListOutOfStr(self.analysis_method_id_ls, data_type=int)
		self.phenotype_method_id_ls = getListOutOfStr(self.phenotype_method_id_ls, data_type=int)