在单个位置将基因与参考序列进行比较

2024-04-19 06:49:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个家庭作业问题,我从fasta文件中检索数据。现在,我需要检查“slim”位置,看看基数是否是SNP(例如,reference是T,而alternate是a)。如何在参考序列中定位基准以进行比较

我试着运行一个For循环,但我不知道它是否真的在序列中运行

lymphoma = []
lymphoma_variants = []
outfileLymphoma = open("lymphoma_variants.txt", 'w')
print('IndividualID', 'variantID', 'GeneDiseaseInfo', sep = '\t', file = outfileLymphoma)
#want to compare the Non-h Lymphoma variants

for position in range(len(seqlist)):

    if position == 246708:
        if reference == 'G':

            lymphoma.append(lymphoma_variants[0:])
            print(name, rsid, geneinfo, sep = '\t', file = outfileLymphoma)
        else:
            continue
    else:
        continue

    if position == 248722:
        if reference == 'A':

            lymphoma.append(lymphoma_variants[0:])
            print(name, rsid, geneinfo, sep = '\t', file = outfileLymphoma)
        else:
            continue
    else:
        continue

理想情况下,代码将检查每个个体的序列,如果存在淋巴瘤的SNP,它将输出到一个文件中。唯一输出的是标题和随机个体的数据。谢谢你的建议


Tags: 文件数据ifposition序列elsesepfile