Structure做群体结构分析
用hmp数据做Structure的时候,要用数字1234代替AGCT,缺失为-9,我的hmp数据中有Y和R,请问用什么代替呢?
在Structure软件中,通常使用数字代替AGCT碱基,缺失值为-9。对于Y和R碱基,可以使用以下方式进行替换:
因此,在使用Structure分析hmp数据时,您可以将Y碱基替换为数字5,将R碱基替换为数字6,并将其它碱基(A、C、G、T)替换为1、2、3、4四个数字中的一个。请注意,在替换后,您需要将数据保存为Structure软件支持的输入格式,例如PED格式或PLINK格式,然后在Structure软件中进行进一步的分析。
不知道你这个问题是否已经解决, 如果还没有解决的话:import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--software", type=str, help="Enter the name or type of software you are using")
args = parser.parse_args()
software = args.software
import os
directory = "/path/to/data/directory"
extension = ".hmp"
files = [x for x in os.listdir(directory) if x.endswith(extension)]
if not files:
print("No suitable files found in directory")
else:
print("Found the following files for analysis: ", files)
import numpy as np
# create a numpy array representing the data
data = np.array([[0, 1, 2], [3, -1, 5], [6, 7, 0]])
# replace missing value with -1
data[data == -1] = np.nan
import re
data = "AGCTYR"
filtered_data = re.sub("[RY]", "X", data)