-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No way to force the sequence type when loading a FASTA file #477
Comments
Hi, thanks for reporting. The problem is that the sequences are very short, so that the sequence type determination of the convenience function import biotite.sequence.io.fasta as fasta
import biotite.sequence as seq
import biotite.sequence.align as align
def read_alignment(fasta_file):
seq_strings = list(fasta_file.values())
sequences = [
# Explicit creation of ProteinSequence
seq.ProteinSequence(seq_str.replace("-",""))
for seq_str in seq_strings
]
trace = align.Alignment.trace_from_strings(seq_strings)
return align.Alignment(sequences, trace)
file = fasta.FastaFile()
file.read('1MFG.fa')
alignment = read_alignment(file)
print(alignment)
seq.SequenceProfile.from_alignment(alignment) Although it is quite nonintuitive that |
Would it be possible to explicitly set the type of sequence when reading the fastest file? So that everything is forced to be protein/nucleotide etc? Now it works, but that may also help others in the future. Thank you! |
Yes, I think that would also be a reasonable solution. I think an optional |
Thanks to @t0mdavid-m the new |
Hi,
I am trying to create sequence logos from fasta files, and there I some that I cannot process but for no obvious reasons.
My code is:
For the 1MFG.fa file, this gives
ValueError: There is no common alphabet that extends all alphabets
1MFG.txt
1JWG.txt
(I needed to convert them to txt just for uploading to github, they were named 1MFG.fa and 1JWG.fa, respectively.)
But for the 1JWG.fa file, it works. Can you help me debugging this? Both only contains the 20 common amino acids.
Thank you for you help!
The text was updated successfully, but these errors were encountered: