Set<SignalKey> getExpressedSignals(final boolean external) { // calculate the signal concentrations final HashSet<SignalKey> allSignals = new HashSet<SignalKey>(); for (AbstractWaveletGene waveletGene : this.sequencedGenes) { // if the current gene doesnt express a signal then skip it. if (!(waveletGene instanceof SignalGene)) continue; // convert the gene's type final SignalGene gene = (SignalGene) waveletGene; // check if the gene's signal is internal or external. continue if // it doesnt match if (external) { // if its not an outward pointing external gene then just skip it if (!(gene instanceof ExternalSignalGene)) continue; else if (!((ExternalSignalGene) gene).isOutward()) continue; } else { // if its an outward pointing external than just skip it. if ((gene instanceof ExternalSignalGene) && (((ExternalSignalGene) gene).isOutward())) continue; } allSignals.add(gene.getOutputSignal()); } return Collections.unmodifiableSet(allSignals); }
@Override public WaveletChromatid clone() { try { final WaveletChromatid copy = (WaveletChromatid) super.clone(); copy.centromerePosition = this.centromerePosition; copy.mutability = this.mutability; copy.sequencedGenes = new ArrayList<AbstractWaveletGene>(); copy.promoters = new ArrayList<PromoterGene>(); copy.localSignalGenes = new ArrayList<SignalGene>(); copy.externalSignalGenes = new ArrayList<ExternalSignalGene>(); for (AbstractWaveletGene currentGene : this.sequencedGenes) copy.sequencedGenes.add(currentGene.clone()); for (PromoterGene currentGene : this.promoters) copy.promoters.add(currentGene.clone()); for (SignalGene currentGene : this.localSignalGenes) copy.localSignalGenes.add(currentGene.clone()); for (ExternalSignalGene currentGene : this.externalSignalGenes) copy.externalSignalGenes.add(currentGene.clone()); return copy; } catch (CloneNotSupportedException caught) { LOGGER.error("CloneNotSupportedException caught but not expected!", caught); throw new UnexpectedDannError("CloneNotSupportedException caught but not expected", caught); } }
public WaveletChromatid(WaveletChromatid copy) { this.centromerePosition = copy.centromerePosition; this.mutability = copy.mutability; this.sequencedGenes = new ArrayList<AbstractWaveletGene>(); this.promoters = new ArrayList<PromoterGene>(); this.localSignalGenes = new ArrayList<SignalGene>(); this.externalSignalGenes = new ArrayList<ExternalSignalGene>(); for (AbstractWaveletGene currentGene : copy.sequencedGenes) this.sequencedGenes.add(currentGene.clone()); for (PromoterGene currentGene : copy.promoters) this.promoters.add(currentGene.clone()); for (SignalGene currentGene : copy.localSignalGenes) this.localSignalGenes.add(currentGene.clone()); for (ExternalSignalGene currentGene : copy.externalSignalGenes) this.externalSignalGenes.add(currentGene.clone()); }