gravatar for yuri

2 hours ago by

what does the type error: cannot unpack non-iterable NoneType object mean? i am trying to read fastA names and sequences from a filepath. see my code below:

def Read_FastA_Names_And_Sequences(filepath):
    sequence_names = []
    sequences = []
    current_sequence = ""

my_file = open(filepath, "r")
my_data = my_file.readlines()
for line in my_data:
    if line[0] == ">":
        x = line[1:].rstrip("rn")
        sequence_names.append(x)
        new_sequence = True
        if len(current_sequence) == 0:
            pass
        else:
            sequences.append(current_sequence)
    else:
        if new_sequence:
            current_sequence = ""
            current_sequence = current_sequence + line.strip("n")
            new_sequence = False
        else:
            current_sequence = current_sequence + line.strip("n")

sequence_names, sequences = Read_FastA_Names_And_Sequences(filepath) doesnt return anything

link

modified 1 hour ago

by

genomax79k

written
2 hours ago
by

yuri0



Source link