Perl-Extract Certain Information Such As Header,Title And Compnd From Pdb Files
4
0
Entering edit mode
13.5 years ago
Kanav ▴ 10

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 • 5.2k views
ADD COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

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

ADD REPLY
0
Entering edit mode
ADD REPLY
7
Entering edit mode
13.5 years ago
Neilfws 49k

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 COMMENT
0
Entering edit mode

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

ADD REPLY

Login before adding your answer.

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