This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Generating Sequence From Pdb File Using Biojava
import java.util.Map;
import org.biojava.bio.structure.*;
import org.biojava.bio.structure.io.PDBFileReader;
import org.biojava3.core.sequence.ProteinSequence;
import org.biojava.bio.structure.io.StructureSequenceMatcher;
public class sequence {
   PDBFileReader pdbreader = new PDBFileReader();
   StructureSequenceMatcher sqm = new StructureSequenceMatcher();
   Structure structure = null;
   Map<Integer,Group> map= null;
    public sequence()throws Exception
    {
      structure = pdbreader.getStructure("2K25.pdb");
      System.out.println(sqm.getProteinSequenceForStructure(structure, map));

    }

    public static void main(String args[])throws Exception
    {

        new sequence();
    }
}

Error:

Exception in thread "main" java.lang.NoSuchMethodError:       org.biojava.bio.structure.io.SeqRes2AtomAligner.getFullAtomSequence(Ljava/util/List;Ljava/util/Map;)Ljava/lang/String;
at org.biojava.bio.structure.io.StructureSequenceMatcher.getProteinSequenceForStructure(StructureSequenceMatcher.java:64)
at sequence.<init>(sequence.java:15)
at sequence.main(sequence.java:22)
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)

Hi! I am a newbie to biojava. I was trying my hand at retrieving the protein sequence from the pdb file using structure object. In one of my earlier post, it was suggested to me that all that would be required for this process is, the structure object and an empty map. I tried as instructed, but to no avail. Please help!

sequence pdb biojava

how did you run the main method ? how was "java" invoked ? (or show us the build.xml if any)

it is just an exception your code looks fine to me.

IMHO, It's a CLASSPATH or a version problem....

1 answer

I would do it like this:

import org.biojava.bio.structure.Chain;
import org.biojava.bio.structure.Structure;
import org.biojava3.structure.StructureIO;

public class DemoLoadSecStruc {
    public static void main(String[] args){

        try {

            Structure s = StructureIO.getStructure("4hhb");

            for ( Chain c : s.getChains()) {

                // only the observed residues
                System.out.println(c.getAtomSequence());

                // print biological sequence
                System.out.println(c.getSeqResSequence());
            }

        } catch (Exception e) {

            e.printStackTrace();
        }        
    }
}

Log in to answer this question.