This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Using GFF3Writer in Biopython

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 gff3 ensembl

1 answer

Hello Alice,

this works for me:

fin swimmer

Log in to answer this question.