Skip to content

Commit

Permalink
Updated to issue when multiple blank lines are in GFF file
Browse files Browse the repository at this point in the history
  • Loading branch information
reganhayward committed Oct 19, 2020
1 parent 43d2d25 commit 0934c18
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/gff_to_fasta_transcriptome.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ def create_transcriptome(fasta_records_dict, gff_files,feature, gene_attribute,
with open(output_file_name, 'a') as out_name: #Open output file
for gff_file in gff_files:
for line in open(gff_file):
if not line: #ignore blank lines
if len(line.split()) == 0: #ignore blank lines
continue
d = line.rstrip() #remove '\n'
if ((d[0] != '#') and (d != '')): #Ignore comments
if ((d[0] != '#') and (d != '') and (d != ' ')): #Ignore comments
d_list = d.split('\t') #Split based on tabs
if d_list[2] in feature:
reference_name = d_list[0]
Expand All @@ -55,7 +55,7 @@ def create_transcriptome(fasta_records_dict, gff_files,feature, gene_attribute,
parser = argparse.ArgumentParser()
parser.add_argument("-fasta",nargs='+',help="genome fasta file")
parser.add_argument("-gff", nargs='+', help="gff file")
parser.add_argument("-f", "--gene_feature", nargs='+', help="gene feature defined int the 3rd column of gff file")
parser.add_argument("-f", "--gene_feature", nargs='+', help="gene feature defined in the 3rd column of the gff file")
parser.add_argument("-a", "--gene_attribute", help="gene attribute")
parser.add_argument("-o", help="output file name")

Expand Down

0 comments on commit 0934c18

Please sign in to comment.