Generating Sequence From Pdb File Using Biojava
1
1
Entering edit mode
11.8 years ago
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 • 4.1k views
ADD COMMENT
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode

so how do i exactly get the code working?

ADD REPLY
0
Entering edit mode

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

ADD REPLY
1
Entering edit mode
11.7 years ago
andreas.prlic ▴ 290

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();
        }        
    }
}

ADD COMMENT

Login before adding your answer.

Traffic: 2450 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6