But I would not like to remove all gaps ... And according to the gaps of the reference sequence (lcl|NC_001477.1_cds_NP_059433.1_1/1-10179) , remove the characters or sequence of the second sequence (gb:AB189120|Organism:Dengue/1-10735 virus 1) of the organism or species. Is this option the most correct?
How to count a sequence and cut in the other sequence?
I have a reference sequence (CDS) and an aligned sequence in the same file. Format fasta.aln or aln.The alignment was done with MAFFT.
Input:
RefSeq - - - - - - AAGCTGC
Seq1 AAAAAAGGGGGG
Output I would like:
Seq1 GGGGGG
It would be a removal from sequence 1 according to the symbol "-" of RefSeq. I would like to extract only the CDS after the alignment. Is there any way to do this from the command line or some programming language? I tried to do it with biopython but was not successful!
f = open('Denv4-X-gb_AY947539.txt', 'r')
con = f.readlines()
con = [i.strip() for i in con]
length = len(con[0].split("-")[0])
result = f'{con[0].split("-")[0]} {con[0].split("-")[0][length:]}'
print(result)
f.close()
f = open('Denv4cds.txt', 'a') f.write(f'\n{result}')
Do you have a script or module or library that can do this?
I'm using windows wsl.
I'm a beginner in bioinformatics
the generated file just printed the first line ...
• 550 views
•
link
1 answer
Log in to answer this question.
I think you need to check the formatting of the post here. It's not clear to me from your description how
GGGGGrelates to the RefSeq sequence?I interpret this to mean you want to trim off sequence in your query which corresponds to gap characters in the RefSeq aligned string?
Please use the code formatting button (looks like
101010). I tried to format your output myself but it's all over the place.I have done the changes
Hello projetoic!
This question has been asked again. Please do not open multiple threads for the same question. How do I count a number of ("-") in a reference string and remove it in a second string?
For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.
If you disagree please tell us why in a reply below, we'll be happy to talk about it.
Cheers!