Question: Perl-Extract Certain Information Such As Header,Title And Compnd From Pdb Files
0
gravatar for Kanav
8.8 years ago by
Kanav10
Kanav10 wrote:

I have pdb chains from pdb pdb files

Example-275dA.seq 275dB.seq makes one pdb file pdb275d.ent.

i want to extract certain information from these files such as Header,Compnd,Title and print in new file...

kindly help me out please...

EDIT: Also, if i have Number of files like 6000 pdb files how to extract same thing from all files an print in new file with filename and retrived information

perl pdb parsing • 3.4k views
ADD COMMENTlink modified 8.8 years ago • written 8.8 years ago by Kanav10

I don't think i understand the problem. I just took a short look at the pdb format and it seems you can just take the first word in each line and see if it's "HEADER", "COMPND", etc...

ADD REPLYlink written 8.8 years ago by Niklas60

Please stop posting new questions as answers - that's 3 times now. I've edited your original question with the new query.

ADD REPLYlink written 8.8 years ago by Neilfws48k

Have a look at this http://comp.chem.nottingham.ac.uk/parsepdb/

ADD REPLYlink written 8.7 years ago by Reyhaneh480
7
gravatar for Neilfws
8.8 years ago by
Neilfws48k
Sydney, Australia
Neilfws48k wrote:

We get a lot of questions like this one, of the form: "how can I use Perl to do something?" The short answer is, learn Perl - and then, you can use it to do anything.

What you are really asking is this. How can I use Perl to:

  • open a file
  • read it line by line
  • identify specific text in each line
  • print out the results

It doesn't matter that your file is a PDB file, or that you want to extract "HEADER". What you need to know are general Perl skills, which you can use as generalized solutions to many similar types of problem.

So first, learn the basics of file handling and regular expressions. Then, code like this will make perfect sense:

open FILE, "pdb275d.ent";
while(<FILE>) {
  chomp;
  my $line = $_;
  # print whatever comes after COMPND
  if ($line =~/^COMPND\s+(.*?)$/) {
    print "$1\n";
  }
}
close FILE;

Soon you will discover that if you have thought of a problem, it's likely that someone else did too and they created a solution. If you're lucky, that solution is something like the Bioperl project - a huge collection of libraries for processing biological data. In there you'll find Bio::Structure::IO for reading PDB files and Bio::Structure::Entry, for extracting information from them. But master the basics first.

ADD COMMENTlink written 8.8 years ago by Neilfws48k

Please stop posting new questions as answers - that's 3 times now. I've edited your original question with the new query.

ADD REPLYlink written 8.8 years ago by Neilfws48k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 980 users visited in the last hour