Showing
1 changed file
with
13 additions
and
0 deletions
python-fundamentals/read-sequences-v1.py
0 → 100644
1 | +if __name__ == "__main__": | ||
2 | + # Abrir archivo con secuencias | ||
3 | + listLines = [] | ||
4 | + length_seq = 0 | ||
5 | + count_seq = 0 | ||
6 | + with open("hga-sequences-1000.txt", mode="r", encoding="utf8") as iFile: | ||
7 | + listLines = iFile.readlines() | ||
8 | + for line in listLines: | ||
9 | + if not line.startswith("seqname"): | ||
10 | + listElements = line.split("\t") | ||
11 | + length_seq += len(listElements[4]) | ||
12 | + count_seq += 1 | ||
13 | + print("Longitud promedio: {}".format(length_seq/count_seq)) |
-
Please register or login to post a comment