Question: Using GFF3Writer in Biopython
0
gravatar for Alice
2.4 years ago by
Alice300
USA
Alice300 wrote:

Hi all,

I am having trouble figuring out GFF3Writer tool from Biopython. I have a regular ensembl gff3 file and want to extract only certain types of features. I get an empty gff output with only one header line. What am I doing wrong? Here is my code below.:

```
in_file = "test.gff"
in_handle = open(in_file)
out_file = "test.parse.gff3"
out_handle = open(out_file, "w")
limit_info = dict(
        gff_id = ["1"], # chromosome 1
        gff_type = ["ncRNA"]) # get non coding RNA
reader = GFFParser()
writer = GFF3Writer()
writer.write(reader.parse_simple(in_handle, limit_info=limit_info),
out_handle)
in_handle.close()
out_handle.close()
```

If I try to get features using GFF.parse, the following code works with no problems:

```
  for rec in GFF.parse(in_handle, limit_info=limit_info):
    print rec.features[0]
```
biopython gff ensembl gff3 • 749 views
ADD COMMENTlink modified 2.4 years ago by finswimmer13k • written 2.4 years ago by Alice300
1
gravatar for finswimmer
2.4 years ago by
finswimmer13k
Germany
finswimmer13k wrote:

Hello Alice,

this works for me:

fin swimmer

ADD COMMENTlink modified 2.4 years ago • written 2.4 years ago by finswimmer13k
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: 1199 users visited in the last hour