人体细胞的有丝分裂

发布于 2024-10-24 22:51:00 字数 474 浏览 1 评论 0 原文

我正在为我的项目用java编写遗传过程,我想模拟人类细胞的有丝分裂。人体细胞含有23对染色体。有丝分裂基本上是细胞分裂或繁殖,其中一个细胞产生两个基因相同的子细胞。您可以在这里找到有关它的图片(稍微向下滚动页面):

有丝分裂

我认为这种有丝分裂就像“Cell”类中的 java 方法。所以我用它自己的方法创建了一个类 Chromosome 来表示单个染色体,并创建了一个包含 23 对染色体的“Cell”类。我计划将有丝分裂方法放入 Cell 类中,但问题是该方法应返回 2 个相同的细胞,并且我认为不可能创建一个在此类中返回 2 个细胞的方法。 我想过创建一个返回 2 个单元格数组的方法,但它不起作用。 关于如何创建此方法有什么建议吗?或者也许是我正在使用的方法之外的另一种方法?谢谢。

I'm programming genetic processes in java for my project and I want simulate the mitosis of a human cell. A human cell contains 23 pairs of chromosome. Mitosis is basically a cell division, or reproduction, in which a cell gives rise to two genetically identical daughter cells. You can find a picture about it here (scroll a little bit down the page):

Mitosis

I think that this mitosis would be like a java method in a class "Cell" for example. So i made a class Chromosome with it's own methods to represent a single chromosome and made a class "Cell" containing 23 pairs of chromosomes. I plan on putting the method mitosis in the class Cell but the problem is that this method should return 2 identical cells and I think it's impossible to create a method that returns 2 cells in this class.
I thought about making a method that would return an array of 2 cells it doesn't work.
Any suggestions an how to create this method? Or maybe another approach than the one i'm using? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

送你一个梦 2024-10-31 22:51:01

作为Cloneable的替代方案,请考虑复制构造函数复制工厂,复制构造函数的静态工厂模拟。

As an alternative to Cloneable, consider a copy constructor or a copy factory, the static factory analog of a copy constructor.

转身以后 2024-10-31 22:51:01

事实证明,这是您在真正的 Java 程序中必须做的事情——查看 可克隆界面。

This turns out to be something you have to do in real Java programs---check out the Cloneable interface.

九歌凝 2024-10-31 22:51:00

实际上,我什至用它来克隆我的细胞。但这不是我的问题,而是“有丝分裂”方法应该返回的内容。只要涉及有丝分裂(生物学上),就会产生两个相同的细胞。

您正沉迷于试图让 Java 表现得像现实世界的对象一样。

您应该关注的是有丝分裂后拥有正确数量的正确类型的细胞,而不是使方法签名直接反映现实世界的事件。

有丝分裂是一个细胞分裂成两个的过程。 IMO,以下任何一个都是 Java 中的有效“模型”:

  • 此 Cell 上返回另一个的方法:

    公共细胞有丝分裂() {
        返回 this.clone(); // ... 或同等内容
    }
    
  • 此 Cell 上的一个方法返回两个单元格:

    public Cell[] 有丝分裂() {
        返回新的 Cell[]{this, this.clone()}; // ...注意 - 必须将其作为一个返回 
                                                // 对象的
    }
    
  • 返回两个单元格的静态方法:

    public static Cell[] 有丝分裂(细胞一){
        返回新的 Cell[]{one, one.clone()}; 
    }
    

即使下面的可能是正确的......如果调用者注意删除对原始单元格的所有引用。

    public static Cell[] mitosis(Cell original) {
        return new Cell[]{original.clone(), original.clone()}; 
    }

但我的观点是,签名是什么并不重要。重要的是,在方法(和调用者)完成这些操作之后,新模型在正确的关系中具有正确的 Cell 对象。

Actually that's what I'm even using to clone my cells. But it's not the cloning of the cells that's my problem, it's what the method "mitosis" should return. As long as mitosis(biologically) is concerned, two identical cells are produced.

You are getting hung up over trying to make Java behave like a real world object.

What you should be focusing on is having the right number of the right kind of cells after mitosis, not on making the method signatures directly mirror the real-world events.

Mitosis is where one cell splits into two. IMO, any of the following are valid "models" in Java:

  • a method on this Cell that returns the other one:

    public Cell mitosis() {
        return this.clone();  // ... or equivalent
    }
    
  • a method on this Cell that returns two cells:

    public Cell[] mitosis() {
        return new Cell[]{this, this.clone()};  // ... note - must return this as one 
                                                // of the objects
    }
    
  • a static method that returns two cells:

    public static Cell[] mitosis(Cell one) {
        return new Cell[]{one, one.clone()}; 
    }
    

Even the following might be right ... if the caller takes care to remove all references to the original cell.

    public static Cell[] mitosis(Cell original) {
        return new Cell[]{original.clone(), original.clone()}; 
    }

But my point is that it doesn't really matter what the signatures are. What matters is that after the method (and the caller) have done there stuff, the new model has the right Cell objects in the right relationships.

饮惑 2024-10-31 22:51:00

我建议 Cell 实现 Cloneable 并使用 复制构造函数 习惯用法clone() 方法。

Cell 中的 doMitosis() 方法上,您基本上会执行以下操作:

public Cell[] doMitosis() {
    Cell[] cells = new Cell[]{this.clone(), this.clone()};
    return cells;
}

PS。代码只是一个粗略的草图,而不是实际的实现。此外,此代码还考虑到父单元格必须被杀死(并进行垃圾收集),以便 2 个相同的单元格可以拥有通行权。

I would suggest that Cell implements Cloneable and use the copy constructor idiom on clone() method.

On doMitosis() method in Cell you basically do something like this:

public Cell[] doMitosis() {
    Cell[] cells = new Cell[]{this.clone(), this.clone()};
    return cells;
}

PS. Code is a rough sketch, not actual implementation. Also, this code takes into consideration that the parent cell must be killed (and garbage collected) so that the 2 identical cells can have right of way.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文