我在cophyloplot
的{{1}}包中使用ape
来制作两个与链接面对面的系统发育树(树根植于提示1)。
R
但是,如果我旋转一些节点,则可以操纵一棵树,以便更多链接显示为水平/直线(即树更加镜像)。
有没有办法自动绘制带有链接的树,以便默认情况下它们是彼此最佳匹配/镜像?即尽可能多的链接是水平的?
编辑:是否还有统计测量树木的相似程度?或者是library(ape)
set.seed(1)
tree1 <-read.nexus("tree1.nex", tree.names = NULL)
tree2 <-read.nexus("tree2.nex", tree.names = NULL)
tree1$tip.label<-(1:28)
tree2$tip.label<-(1:28)
a <- c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28)
b <- c(1,15,3,4,6,5,23,26,28,27,16,14,22,18,19,10,9,8,7,11,25,24,2,21,12,13,17,20)
association <- cbind(a, b)
cophyloplot(tree1, tree2, assoc = association, length.line = 4, space = 30, gap = 3,col="red", show.tip.label=FALSE)
给出的?
答案 0 :(得分:0)
“最佳拟合”可以使用 R 包 phytools 直接可视化。
使用 from django.db import models
from django.conf import settings
from django.contrib.auth.models import AbstractUser, BaseUserManager
from django.utils.translation import ugettext_lazy as _
class UserManager(BaseUserManager):
"""Define a model manager for User model with no username field."""
pass
class CustomUser(AbstractUser):
"""Model representing a User with some extended fields and email as username field"""
username = None
email = models.EmailField(max_length=100, unique=True)
is_admin = models.BooleanField(default=False)
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = []
class Meta:
ordering = ['email']
db_table = 'users'
objects = UserManager()
def __str__(self):
"""String for representing the Model object."""
return self.email
class Group(models.Model):
"""Model representing a Group"""
name = models.CharField(max_length=200)
members = models.ManyToManyField(settings.AUTH_USER_MODEL, through='UserGroup', related_name='user_groups')
class Meta:
ordering = ['name']
db_table = 'groups'
def __str__(self):
return self.name
class UserGroup(models.Model):
"""Model representing a User's Group"""
group = models.ForeignKey(Group, on_delete=models.CASCADE, verbose_name = 'group')
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, verbose_name = 'user')
class Meta:
db_table = 'user_groups'
函数(其作用与 ape 的 cophylo()
相同)并将旋转设置为 TRUE。
cophyloplot()