在家谱中,我们使用 DNA 来寻找匹配项。Y-DNA 发现父系匹配。执行此操作的 neo4j 查询(其中 RN 是一个人的唯一标识符)是:
MATCH (n{RN:1}) match p=n-[r:father*..22]->m return m.RN as RN,m.fullname as FullName,m.sex as Sex,m.bd as BD,m.dd as DD,length(p) as generation,case when left(m.bd,4)>'1930' and rtrim(m.dd)='' then 'Y' else 'N' end as mtDNA_Candidate, reduce(srt2 ='|', q IN nodes(p)| srt2 + q.RN + '|') AS PathOrder order by generation desc,PathOrder desc
或者我们使用线粒体 DNA 进行母系匹配:
`MATCH (n{RN:1}) match p=n-[r:mother*..22]->m return m.RN as RN,m.fullname as FullName,m.sex as Sex,m.bd as BD,m.dd as DD,length(p) as generation,case when left(m.bd,4)>'1930' and rtrim(m.dd)='' then 'Y' else 'N' end as mtDNA_Candidate, reduce(srt2 ='|', q IN nodes(p)| srt2 + q.RN + '|') AS PathOrder order by generation desc,PathOrder desc`
我的问题与 X 染色体 DNA 有关。一位父亲只给他的女儿一个 X 染色体,一位母亲给她所有的孩子一个。因此,我需要一个密码查询,当在最近的时间一代中有一个女儿时,它可以获取所有母亲的信息,但只有父亲的信息。后世若有子,则除父。我在节点中有一个属性“性别”,其值为 M 或 F。出生日期并不总是已知的,因此它不能用于确定方向性
我试过这个,但得到一个错误:
`MATCH (n{RN:1}) match p=n-[r:mother*..22|father*..1]->m return m.RN as RN,m.fullname as FullName,m.sex as Sex,m.bd as BD,m.dd as DD,length(p) as generation,case when left(m.bd,4)>'1930' and rtrim(m.dd)='' then 'Y' else 'N' end as mtDNA_Candidate, reduce(srt2 ='|', q IN nodes(p)| srt2 + q.RN + '|') AS PathOrder order by generation desc,PathOrder desc`