Esempio n. 1
0
 def propertyChange(self, evt):
     if self.ignoreChanges: return
     change = False
     if not self.isTemporal:
         if evt.getSource() == self.fst and evt.getPropertyName() == 'value':
             new = float(evt.getNewValue())
             old = float(evt.getOldValue())
             if new > 0.99:
                 evt.getSource().setValue(old)
             if new < -0.2:
                 evt.getSource().setValue(old)
             elif new< 0.0:
                 self.systemPanel.force.setSelected(False)
                 self.systemPanel.force.setEnabled(False)
             else:
                 self.systemPanel.force.setEnabled(True)
     else:
         if evt.getSource() == self.ne and evt.getPropertyName() == 'value':
             new = int(evt.getNewValue())
             old = int(evt.getOldValue())
             if new < 0:
                 evt.getSource().setValue(old)
     if self.isDominant and evt.getSource() in [self.theta, self.beta1,
         self.beta2, self.crit] and evt.getPropertyName() == 'value':
         new = float(evt.getNewValue())
         old = float(evt.getOldValue())
         if new > 0.99 or new < -0.2:
             evt.getSource().setValue(old)
     if evt.getSource() == self.sampleSize and evt.getPropertyName() == 'value':
         change = True
         new = int(evt.getNewValue())
         old = int(evt.getOldValue())
         if new > 50 and old > 4:
             warn(self, 'A sample size bigger than 50 is not expected to produce better results, while it slows the computation')
         if new < 5 and (new!=0 and not self.isDominant):
             evt.getSource().setValue(old)
     if evt.getSource() == self.pops and evt.getPropertyName() == 'value':
         change = True
         new = int(evt.getNewValue())
         old = int(evt.getOldValue())
         if new > 100:
             error(self, 'Maximum value for total populations is 100')
             evt.getSource().setValue(100)
         if new < self.knownPops:
             error(self,
             'Expected total populations has to be at least the same as the number of populations under study.'
             )
             evt.getSource().setValue(self.knownPops)
     if not self.isTemporal:
         if evt.getSource() == self.mut:
             change = True
     if not change: return
     if self.menuHandles['item5000'].isEnabled():
         self.menuHandles['item5000'].setEnabled(False)
         warn(self, "Changed parameter will require restarting simulations")
Esempio n. 2
0
 def actionPerformed(self, e):
     if e.getID() <> ActionEvent.ACTION_PERFORMED:
         return
     if e.getSource() == self.neutral:
         if self.isTemporal:
             warn(self, """
         Using a "neutral" mean Ne means doing a first simulation run to
         remove potential selected loci for computing the initial mean Ne.
         This effectively doubles the computation time, but it is the recommended
         option.
         If you are not sure of what you want, please check this option.
         """)
         else:
             warn(self, """
         Using a "neutral" mean Fst means doing a first simulation run to
         remove potential selected loci for computing the initial mean Fst.
         This effectively doubles the computation time, but it is the recommended
         option.
         If you are not sure of what you want, please check this option.
         """)
     elif e.getSource() == self.force:
         warn(self, """
         Simulating a PRECISE mean Fst is not possible outside ideal theoretical
         conditions (infinite populations, infinite allele model). SELWB can try to
         approximate a desired Fst, by running a bisection algorithm over repeated
         simulations.
         Checking this option will increase the computation time by a certain amount
         of time (in most cases it will double the computation time), this is still,
         the recommended option.
         If you are not sure of what you want, please check this option.
         """)
Esempio n. 3
0
 def actionPerformed(self, e):
     if e.getID() <> ActionEvent.ACTION_PERFORMED:
         return
     if e.getSource() == self.neutral:
         if self.isTemporal:
             warn(self, """
         Using a "neutral" mean Ne means doing a first simulation run to
         remove potential selected loci for computing the initial mean Ne.
         This effectively doubles the computation time, but it is the recommended
         option.
         If you are not sure of what you want, please check this option.
         """)
         else:
             warn(self, """
         Using a "neutral" mean Fst means doing a first simulation run to
         remove potential selected loci for computing the initial mean Fst.
         This effectively doubles the computation time, but it is the recommended
         option.
         If you are not sure of what you want, please check this option.
         """)
     elif e.getSource() == self.force:
         warn(self, """
         Simulating a PRECISE mean Fst is not possible outside ideal theoretical
         conditions (infinite populations, infinite allele model). SELWB can try to
         approximate a desired Fst, by running a bisection algorithm over repeated
         simulations.
         Checking this option will increase the computation time by a certain amount
         of time (in most cases it will double the computation time), this is still,
         the recommended option.
         If you are not sure of what you want, please check this option.
         """)
Esempio n. 4
0
    def propertyChange(self, evt):
        if self.ignoreChanges:
            return
        change = False
        if not self.isTemporal:
            if evt.getSource() == self.fst and evt.getPropertyName(
            ) == 'value':
                new = float(evt.getNewValue())
                old = float(evt.getOldValue())
                if new > 0.99:
                    evt.getSource().setValue(old)
                if new < -0.2:
                    evt.getSource().setValue(old)
                elif new < 0.0:
                    self.systemPanel.force.setSelected(False)
                    self.systemPanel.force.setEnabled(False)
                else:
                    self.systemPanel.force.setEnabled(True)
        else:
            if evt.getSource() == self.ne and evt.getPropertyName() == 'value':
                new = int(evt.getNewValue())
                old = int(evt.getOldValue())
                if new < 0:
                    evt.getSource().setValue(old)

        if self.isDominant and \
                evt.getSource() in [self.theta, self.beta1, self.beta2, self.crit] and \
                evt.getPropertyName() == 'value':
            new = float(evt.getNewValue())
            old = float(evt.getOldValue())
            if new > 0.99 or new < -0.2:
                evt.getSource().setValue(old)

        # Subsample size
        if evt.getSource() == self.sampleSize and evt.getPropertyName(
        ) == 'value':
            change = True
            new = int(evt.getNewValue())
            old = int(evt.getOldValue())
            if new > 50 and old > 4:
                warn(
                    self,
                    'A sample size bigger than 50 is not expected to produce better results, '
                    + 'while it slows the computation')
            if new < 5 and (new != 0 and not self.isDominant):
                evt.getSource().setValue(old)

        if evt.getSource() == self.pops and evt.getPropertyName() == 'value':
            change = True
            new = int(evt.getNewValue())
            old = int(evt.getOldValue())
            if new > 100:
                error(self, 'Maximum value for total populations is 100')
                evt.getSource().setValue(100)
            if new < self.knownPops:
                error(
                    self,
                    'Expected total populations has to be at least the same as the number of populations under study.'
                )
                evt.getSource().setValue(self.knownPops)

        if not self.isTemporal:
            if evt.getSource() == self.mut:
                change = True
        if not change:
            return
        if self.menuHandles['item5000'].isEnabled():
            self.menuHandles['item5000'].setEnabled(False)
            warn(self, "Changed parameter will require restarting simulations")