ample.util.sequence_util module

class Sequence(fasta=None, pdb=None, canonicalise=False)[source]

Bases: object

A class to handle a fasta file

Methods

add_pdb_data(pdbin) Add the resseq information from a pdb to ourselves when we already have the sequence information from a fasta file - such as from an alignment
canonicalise() Reformat the fasta file
mutate_residue(from_aa, res_seq, to_aa[, seq_id]) Change residue type from_aa at position res_seq to be of type to_aa
pirStr([seqNo]) Return a canonical MAXWIDTH PIR representation of the file as a line-separated string
toPir(input_fasta[, output_pir]) Take a fasta file and output the corresponding PIR file
fasta_str  
from_fasta  
from_pdb  
length  
numSequences  
sequence  
write_fasta  
add_pdb_data(pdbin)[source]

Add the resseq information from a pdb to ourselves when we already have the sequence information from a fasta file - such as from an alignment We assume that there will be gaps (-) in the sequence and the letters may be upper or lower case Currently this only supports adding data for single-chain pdbs

canonicalise()[source]

Reformat the fasta file

fasta_str(pdbname=False)[source]
from_fasta(fasta_file, canonicalise=True, resseq=True)[source]
from_pdb(pdbin)[source]
length(seq_no=0)[source]
mutate_residue(from_aa, res_seq, to_aa, seq_id=0)[source]

Change residue type from_aa at position res_seq to be of type to_aa

Note: res_seq positions start from 1 not zero!

Parameters:
from_aa : str

Single-letter amino acid

res_seq : int

Residue sequence number

to_aa : str

Single-letter amino acid

seq_id : int

The index of the sequence to operate on (counting from zero)

numSequences()[source]
pirStr(seqNo=0)[source]

Return a canonical MAXWIDTH PIR representation of the file as a line-separated string

sequence(seq_no=0)[source]
toPir(input_fasta, output_pir=None)[source]

Take a fasta file and output the corresponding PIR file

write_fasta(fasta_file, pdbname=False)[source]
process_fasta(amoptd)[source]