示例#1
0
文件: hase.py 项目: urmovosa/hase
                phenotype=tuple(i.folder._data for i in phen),
                genotype=tuple(i.folder._data for i in gen),
                covariates=tuple(i.folder._data.metadata for i in pard))
            if row_index[2].shape[0] != np.sum(
                [i.folder._data.metadata['id'].shape[0] for i in pard]):
                raise ValueError(
                    'Partial Derivatives covariates have different number of subjects {} than genotype and phenotype {}'
                    .format(
                        row_index[2].shape[0],
                        np.sum([
                            i.folder._data.metadata['id'].shape[0]
                            for i in pard
                        ])))
        while True:
            if mapper.cluster == 'n':
                SNPs_index, keys = mapper.get()
            else:
                ch = mapper.chunk_pop()
                if ch is None:
                    SNPs_index = None
                    break
                SNPs_index, keys = mapper.get(chunk_number=ch)

            if isinstance(SNPs_index, type(None)):
                break

            Analyser.rsid = keys
            if np.sum(PD) == 0:
                genotype = np.array([])
                with Timer() as t_g:
                    genotype = merge_genotype(gen, SNPs_index, mapper)
示例#2
0
文件: hase.py 项目: roshchupkin/hase
			meta_phen=MetaPhenotype(phen)

			N_studies=len(args.genotype)

			gen=[]
			for i,j in enumerate(args.genotype):
				gen.append(Reader('genotype'))
				gen[i].start(j,hdf5=args.hdf5, study_name=args.study_name[i], ID=False)

			#for i in gen:
			#	i._data.link()
			row_index, ids =  study_indexes(phenotype=tuple(i.folder._data for i in phen),genotype=tuple(i.folder._data for i in gen),covariates=tuple(i.folder._data.metadata for i in pard))

		while True:
			if mapper.cluster=='n':
				SNPs_index, keys=mapper.get()
			else:
				ch=mapper.chunk_pop()
				if ch is None:
					SNPs_index=None
					break
				print ch
				SNPs_index, keys=mapper.get(chunk_number=ch)

			if isinstance(SNPs_index, type(None)):
				break

			Analyser.rsid=keys
			if np.sum(PD)==0:
				genotype=np.array([])
				genotype=merge_genotype(gen, SNPs_index, mapper, flip_flag=False)