How To Convert Gz File To Pdb Format?
2
0
Entering edit mode
14.3 years ago
User 4686 ▴ 220

Hi all when i downloaded the files from pdb's ftp site the format is in GZ. are there any ways that i can convert them to PDB format using java codes? Would be great if any of you can offer me your help and it will be much appreciated.

pdb java • 14k views
ADD COMMENT
5
Entering edit mode
14.3 years ago
Neilfws 49k

If you mean that the filename ends with ".gz", this is not a format. It means that the file is compressed (or "gzipped") using a utility named gzip.

If your OS has a terminal (Linux, OS X), simply uncompress using:

gunzip myfile.gz

If you want to use Java, here is one guide, or just Google search "gunzip java".

ADD COMMENT
4
Entering edit mode
14.3 years ago

Based on your previous code, you could add a GZIPInputStream in your input stream to deflate the file on the fly, just like that:

import java.io.*;
import java.net.URL;
import java.util.zip.GZIPInputStream;

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

        try{
           URL url =     new URL("ftp://ftp.wwpdb.org/pub/pdb/data/structures/all/pdb/pdb100d.ent.gz;type=i");
           InputStream in =     new BufferedInputStream(
        new GZIPInputStream(url.openStream()));
       byte buff[]=new byte[1024];
       int nRead;

           while((nRead=in.read(buff))!=-1)
        {
        System.out.write(buff,0,nRead);
        }
           in.close();
        } catch(Exception e)
        {
            e.printStackTrace();
        }   
    }   
}

but your problem is not really related to bioinformatics. You should rather ask this kind of question on StackOverflow.com.

ADD COMMENT
0
Entering edit mode

And by the way, you already asked 3 questions on this site, and people gave you 3 valid answers. Please, validate those answers.

ADD REPLY
0
Entering edit mode

Yeah, right ...

ADD REPLY
0
Entering edit mode

and don't forget this one too

ADD REPLY
0
Entering edit mode

Hit and run syndrome :)

ADD REPLY
0
Entering edit mode

Why is this not bioinfo and writing a Perl script to detect three characters is??

ADD REPLY

Login before adding your answer.

Traffic: 805 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