Using GFF3Writer in Biopython
1
0
Entering edit mode
6.5 years ago
Alice ▴ 320

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.8k views
ADD COMMENT
1
Entering edit mode
6.5 years ago

Hello Alice,

this works for me:

fin swimmer

ADD COMMENT

Login before adding your answer.

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