Skip to content

Instantly share code, notes, and snippets.

@daler
Last active August 29, 2015 14:19
Show Gist options
  • Save daler/5a951401ae00d994d1be to your computer and use it in GitHub Desktop.
Save daler/5a951401ae00d994d1be to your computer and use it in GitHub Desktop.
from gffutils.iterators import DataIterator
input_filename = 'example.gff'
output_filename = 'output.gff'
with open(output_filename, 'w') as fout:
for feature in DataIterator(input_filename):
# len() works to get the length of a feature in bp
if len(feature) < 1000:
continue
# Attribute access with dictionary-like syntax
if 'LINE' not in feature['Superfamily']:
continue
fout.write(str(line) + '\n')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment