Package org.biojava.nbio.structure.io
Class FastaAFPChainConverter
- java.lang.Object
-
- org.biojava.nbio.structure.io.FastaAFPChainConverter
-
public class FastaAFPChainConverter extends Object
A collection of static utilities to convert betweenAFPChainsandFastaSequences.- Author:
- dmyersturnbull
- See Also:
StructureSequenceMatcher,FastaStructureParser,SeqRes2AtomAligner
-
-
Constructor Summary
Constructors Constructor Description FastaAFPChainConverter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static AFPChaincpFastaToAfpChain(File fastaFile, Structure structure, int cpSite)Takes a structure and sequence corresponding to an alignment between a structure or sequence and itself (or even a structure with a sequence), where the result has a circular permutation sitecpSiteresidues to the right.static AFPChaincpFastaToAfpChain(String first, String second, Structure structure, int cpSite)static AFPChaincpFastaToAfpChain(ProteinSequence first, ProteinSequence second, Structure structure, int cpSite)Takes a structure and sequence corresponding to an alignment between a structure or sequence and itself (or even a structure with a sequence), where the result has a circular permutation sitecpSiteresidues to the right.static AFPChainfastaFileToAfpChain(File fastaFile, Structure structure1, Structure structure2)Reads the filefastaFile, expecting exactly two sequences which give a pairwise alignment.static AFPChainfastaStringToAfpChain(String sequence1, String sequence2, Structure structure1, Structure structure2)Returns an AFPChain corresponding to the alignment betweenstructure1andstructure2, which is given by the gapped protein sequencessequence1andsequence2.static AFPChainfastaToAfpChain(String sequence1, String sequence2, Structure structure1, Structure structure2)TODO Write commentstatic AFPChainfastaToAfpChain(Map<String,ProteinSequence> sequences, Structure structure1, Structure structure2)Uses two sequences each with a corresponding structure to create an AFPChain corresponding to the alignment.static AFPChainfastaToAfpChain(SequencePair<Sequence<AminoAcidCompound>,AminoAcidCompound> alignment, Structure structure1, Structure structure2)Provided only for convenience.static AFPChainfastaToAfpChain(ProteinSequence sequence1, ProteinSequence sequence2, Structure structure1, Structure structure2)Returns an AFPChain corresponding to the alignment betweenstructure1andstructure2, which is given by the gapped protein sequencessequence1andsequence2.static List<Object>getAlignedUserCollection(String sequence)Takes a protein sequence string with capital and lowercase letters and sets itsuser collectionto record which letters are uppercase (aligned) and which are lowercase (unaligned).static voidmain(String[] args)Prints out the XML representation of an AFPChain from a file containing exactly two FASTA sequences.
-
-
-
Constructor Detail
-
FastaAFPChainConverter
public FastaAFPChainConverter()
-
-
Method Detail
-
cpFastaToAfpChain
public static AFPChain cpFastaToAfpChain(String first, String second, Structure structure, int cpSite) throws StructureException, CompoundNotFoundException
-
cpFastaToAfpChain
public static AFPChain cpFastaToAfpChain(File fastaFile, Structure structure, int cpSite) throws IOException, StructureException
Takes a structure and sequence corresponding to an alignment between a structure or sequence and itself (or even a structure with a sequence), where the result has a circular permutation sitecpSiteresidues to the right.- Parameters:
fastaFile- A FASTA file containing exactly 2 sequences, the first unpermuted and the second permutedcpSite- The number of residues from the beginning of the sequence at which the circular permutation site occurs; can be positive or negative; values greater than the length of the sequence are acceptable- Throws:
IOExceptionStructureException
-
cpFastaToAfpChain
public static AFPChain cpFastaToAfpChain(ProteinSequence first, ProteinSequence second, Structure structure, int cpSite) throws StructureException
Takes a structure and sequence corresponding to an alignment between a structure or sequence and itself (or even a structure with a sequence), where the result has a circular permutation sitecpSiteresidues to the right.- Parameters:
first- The unpermuted sequencesecond- The sequence permuted by cpSitecpSite- The number of residues from the beginning of the sequence at which the circular permutation site occurs; can be positive or negative; values greater than the length of the sequence are acceptable- Throws:
StructureException
-
fastaFileToAfpChain
public static AFPChain fastaFileToAfpChain(File fastaFile, Structure structure1, Structure structure2) throws IOException, StructureException
Reads the filefastaFile, expecting exactly two sequences which give a pairwise alignment. Uses this and two structures to create an AFPChain corresponding to the alignment. Uses aCasePreservingProteinSequenceCreatorand assumes that a residue is aligned if and only if it is given by an uppercase letter.
-
fastaStringToAfpChain
public static AFPChain fastaStringToAfpChain(String sequence1, String sequence2, Structure structure1, Structure structure2) throws StructureException, CompoundNotFoundException
Returns an AFPChain corresponding to the alignment betweenstructure1andstructure2, which is given by the gapped protein sequencessequence1andsequence2. The sequences need not correspond to the entire structures, since local alignment is performed to match the sequences to structures.
-
fastaToAfpChain
public static AFPChain fastaToAfpChain(Map<String,ProteinSequence> sequences, Structure structure1, Structure structure2) throws StructureException
Uses two sequences each with a corresponding structure to create an AFPChain corresponding to the alignment. Provided only for convenience since FastaReaders return such maps.- Parameters:
sequences- A Map containing exactly two entries from sequence names as Strings to gapped ProteinSequences; the name is ignored- Throws:
StructureException- See Also:
fastaToAfpChain(ProteinSequence, ProteinSequence, Structure, Structure)
-
fastaToAfpChain
public static AFPChain fastaToAfpChain(String sequence1, String sequence2, Structure structure1, Structure structure2) throws StructureException, CompoundNotFoundException
TODO Write comment- Parameters:
sequence1-sequence2-structure1-structure2-- Returns:
- Throws:
StructureExceptionCompoundNotFoundException
-
fastaToAfpChain
public static AFPChain fastaToAfpChain(ProteinSequence sequence1, ProteinSequence sequence2, Structure structure1, Structure structure2) throws StructureException
Returns an AFPChain corresponding to the alignment betweenstructure1andstructure2, which is given by the gapped protein sequencessequence1andsequence2. The sequences need not correspond to the entire structures, since local alignment is performed to match the sequences to structures. Assumes that a residue is aligned if and only if it is given by an uppercase letter.- Parameters:
sequence1- Must haveAbstractSequence.getUserCollection()set to document upper- and lower-case as aligned and unaligned; seegetAlignedUserCollection(String)- Throws:
StructureException
-
fastaToAfpChain
public static AFPChain fastaToAfpChain(SequencePair<Sequence<AminoAcidCompound>,AminoAcidCompound> alignment, Structure structure1, Structure structure2) throws StructureException
Provided only for convenience.
-
getAlignedUserCollection
public static List<Object> getAlignedUserCollection(String sequence)
Takes a protein sequence string with capital and lowercase letters and sets itsuser collectionto record which letters are uppercase (aligned) and which are lowercase (unaligned).- Parameters:
sequence- Make sure not to useAbstractSequence.getSequenceAsString()for this, as it won't preserve upper- and lower-case
-
main
public static void main(String[] args) throws StructureException, IOException
Prints out the XML representation of an AFPChain from a file containing exactly two FASTA sequences.- Parameters:
args- A String array of fasta-file structure-1-name structure-2-name- Throws:
StructureExceptionIOException
-
-