Last active
August 29, 2015 14:19
-
-
Save daler/5a951401ae00d994d1be to your computer and use it in GitHub Desktop.
Example for https://www.biostars.org/p/138849/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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