<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def genRegionTerm(self,X,vTot=0.1,pCausal=0.10,nCausal=None,pCommon=1.,nCommon=None,plot=False,distribution='biNormal'):
 """ Generate population structure term Population structure is simulated by background SNPs beta_pdf: pdf used to generate the regression weights for now either Normal or fixed variance: variance of the term percCausal: percentage of causal SNPs Xcausal: set of SNPs being causal """

        S = X.shape[1]

        # number of causal, common, specific
        if nCausal==None:
            nCausal=int(SP.floor(pCausal*S))
        if nCommon==None:
            nCommon = round(pCommon*nCausal)
        nSpecific = self.P*(nCausal-nCommon)

        # common SNPs
        if nCommon>0:
            if distribution=='biNormal':
                Bc  = SP.dot(genBinormal(nCommon,self.P),self.genTraitEffect(distribution=distribution))
            elif distribution=='normal':
                Bc  = SP.dot(self.genWeights(nCommon,self.P),self.genTraitEffect(distribution=distribution))
            Ic  = selectRnd(nCommon,S)
            Yc  = SP.dot(X[:,Ic],Bc)
            Yc *= SP.sqrt(nCommon/Yc.var(0).mean())
        else:

            Yc = SP.zeros((self.N,self.P))

        # indipendent signal
        if nSpecific>0:
            Is  = selectRnd(nSpecific,S*self.P).reshape(S,self.P)
            if distribution=='biNormal':
                Bi  = Is*genBinormal(S,self.P)
            elif distribution=='normal':
                Bi  = Is*SP.randn(S,self.P)
            Yi  = SP.dot(X,Bi)
            Yi *= SP.sqrt(nSpecific/(Yi.var(0).mean()*self.P))
        else:
            Yi = SP.zeros((self.N,self.P))


        Y   = Yc+Yi
        Yc *= SP.sqrt(vTot/Y.var(0).mean())
        Yi *= SP.sqrt(vTot/Y.var(0).mean())

        if plot:
            import pylab as PL
            PL.ion()
            for p in range(self.P):
                PL.subplot(self.P,1,p+1)
                PL.plot(SP.arange(S)[Ic],Bc[:,p],'o',color='y')
                _Is = Is[:,p]
                if _Is.sum()>0:
                    PL.plot(SP.arange(S)[_Is],Bi[_Is,p],'o',color='r')
                #PL.ylim(-2,2)
                PL.plot([0,S],[0,0],'k')

        return Yc, Yi