-
-
Save cybersiddhu/2514401 to your computer and use it in GitHub Desktop.
Solution for pseudogene issue in GFF3 for Artemis
This file contains 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
import sys, os, string | |
if len(sys.argv) != 2: | |
print 'You seem to have forgotten to provide the input GFF3 file.' | |
exit() | |
if __name__ == "__main__": | |
found = False | |
with open(sys.argv[1], 'r') as file: | |
outfile = open(os.path.basename(sys.argv[1]).replace(".gff", "_corrected.gff"), 'w') | |
for line in file: | |
if found and ('exon' in line): | |
found = False | |
continue | |
if 'pseudogene' in line: | |
found = True | |
continue | |
if 'gap' in line: | |
continue | |
outfile.write(line) | |
outfile.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try to avoid reading entire file in memory. So instead of this ...
try this
Even better
Consult the python standard documentation for the advantage of using it.