[Biojava-l] sturcture.io

Tamas Horvath hotafin at gmail.com
Wed Nov 30 08:47:49 EST 2005

In my case, I had a bunch of pdb files in a jar archive, so here's the codeI try to use:
   public static InputStream get_pdbinputstream(String fileName,Stringpdb_id) {          System.out.println(fileName);          InputStream returnstream = null;          JarFile jarFile = null;            try {               jarFile = new JarFile(fileName);               for (Enumeration e = jarFile.entries(); e.hasMoreElements();) {
                   JarEntry jarEntry = (JarEntry) e.nextElement();
                   if (jarEntry.isDirectory()) continue;
                   String pdbid = jarEntry.getName();                   pdbid = pdbid.substring(0, 4).toUpperCase();                   System.out.println(pdbid);                   if (pdbid.intern() != pdb_id) continue;
                   returnstream = jarFile.getInputStream(jarEntry);               }            } catch (IOException ioe) {               System.out.println("An IOException occurred: " +ioe.getMessage());            } finally {               if (jarFile != null) {                  try { jarFile.close(); } catch (IOException ioe) {}               }            }            return returnstream;   }
   public static Object parse_pdb(String pdb_datafile, String pdb_id) {       Structure structure = null;       pdb_inputstream = Utils.get_pdbinputstream(pdb_datafile,pdb_id);       if (pdb_inputstream != null) structure =org.biojava.bio.structure.io.PDBFileParser.parsePDBFile(pdb_inputstream);
       return structure;   }
The 1st function is supposed to get the desired InputStream from thespecified archive file, while the second supposed to generate the structure.However:
"Utils.java": non-static method parsePDBFile(java.io.InputStream) cannot bereferenced from a static context at line 1132, column 92as it kindly sais...
Is there a solution of this problem?

On 11/30/05, Andreas Prlic <ap3 at sanger.ac.uk> wrote:>> Hi Tamas,>> In case you are working with a PDB file that is located> somewhere on  your hard disk, you could use the code from below> to parse it in.>> Cheers,> Andreas>>> String filename =  "path/to/pdbfile.ent" ;>>   PDBFileReader pdbreader = new PDBFileReader();>>   try{>         Structure struc = pdbreader.getStructure(filename);>         System.out.println(struc);>   } catch (Exception e) {>         e.printStackTrace();>   }>>>> On 29 Nov 2005, at 16:25, Tamas Horvath wrote:>> > I've got an ArrayList<String> object containing a PDB file's> > information.How may I feed it to the structure parser? As far as I> > could see, it onlyaccepts BufferdReader or imputStream...>>> > ---------------------------------------------------------------------->> Andreas Prlic      Wellcome Trust Sanger Institute>                                Hinxton, Cambridge CB10 1SA, UK>                          +44 (0) 1223 49 6891>> _______________________________________________> Biojava-l mailing list  -  Biojava-l at biojava.org> http://biojava.org/mailman/listinfo/biojava-l>

More information about the Biojava-l mailing list