comparison filter_fasta.py @ 14:d66c62c6c56f draft

Uploaded
author bornea
date Wed, 24 Aug 2016 13:00:03 -0400
parents 05d48b118f81
children
comparison
equal deleted inserted replaced
13:55990dea42fb 14:d66c62c6c56f
32 if "Accession Number" in i: # finds the start of header 32 if "Accession Number" in i: # finds the start of header
33 header_start = cnt 33 header_start = cnt
34 break 34 break
35 cnt += 1 35 cnt += 1
36 header = data[header_start] 36 header = data[header_start]
37 if "Accession Number" in header: 37 for i in header:
38 prot_start = header.index("Accession Number") 38 if i == "Accession":
39 elif "Accession" in header: 39 prot_start = header.index("Accession")
40 prot_start = header.index("Accession") 40 if i == "Accession Number":
41 prot_start = header.index("Accession Number")
42 if i == "Main Accession":
43 prot_start = header.index("Main Accession")
41 proteins = [] 44 proteins = []
42 for protein in data[header_start:]: 45 for protein in data[header_start:]:
43 if len(protein) > prot_start: 46 if len(protein) > prot_start:
44 proteins.append(protein[prot_start]) 47 proteins.append(protein[prot_start])
45 return proteins 48 return proteins