저는 fasta 파일이 있고 다른 파일에 위치가 포함되어 있습니다. 각 시퀀스의 특정 위치를 기본 설정 (예 : 위치 파일)으로 바꾸려고합니다. a/c 120처럼 보입니다. 교체 표가/c와 비슷해 보이므로 w로 대체 된 120 개의 위치로 새로운 fasta 파일을 가져오고 싶습니다. [: 3 0], 내가 시퀀스 이름을 가지고 dna 시퀀스 파일의 특정 위치에있는 뉴클레오티드를 바꿉니다
프로그램
그래서 첫 번째 문제는 내가 my_seq_id를 사용한 경우 나, 예를 들어, 정확한 위치를 얻을 수있다파이썬
작성되었습니다! 시퀀스가 아니야. 위치 파일from Bio import SeqIO
import sys
import string
userInput1=raw_input("enter your sequence:")
userInput2=raw_input('enter your position file:')
fasta_file=userInput1
position_file=userInput2
result_file="outfile.txt"
id_list=list()
position_list=list()
nucleotide_list=list()
with open(position_file) as f:
for line in f:
line=line.strip()
headerline = line.split()
position=headerline[1]
ID=headerline[0]
nucleotide=headerline[2]
nucleotide_list.add(nucleotide)
position_list.add(position)
id_list.add(ID)
fasta_sequence=SeqIO.parse(open(fasta_file), 'fasta')
with open(result_file, 'w') as f:
if seq_record.id in wanted and nucleotide_list="A/C":
seq_record[position_list]="W\n"
SeqIO.write([seq_record], f, "fasta")
우리가 도와 줄 수 있도록 현재 구현 중 일부를 제공하십시오. SO는 귀하를 위해 귀하의 문제를 구현하는 것이 아니라 도움을주기 위해 존재합니다. 누군가가 당신을 위해 일하는 것에 관심이 있다면 [렌터 코더] (http://www.rent-acoder.com/)를 확인하십시오. – aglasser
나는 c와 함께 갈지 잘 모르겠다. 아마도 bash/awk/perl 명령어들 : https://www.biostars.org/p/17680/ – Jiminion
이 코드는 프로그래밍 언어 인 C와 비슷하지 않습니다. C-the-nucleotid와 C-the-language를 혼동하지 않을 것이라고 확신합니까 (CGAT에서와 같이)? – usr2564301