Created
May 25, 2017 21:59
-
-
Save marcoscastro/2d3d85a033223ad31fddb29832074190 to your computer and use it in GitHub Desktop.
Python - Lendo arquivo fasta
This file contains hidden or 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
| # lendo o arquivo busca.out | |
| nomes = [] | |
| with open('busca.out') as arq: | |
| linhas = arq.readlines() | |
| for linha in linhas: | |
| nomes.append(linha.split(' ')[0]) | |
| # buscando os nomes no arquivo ensembl34.fa | |
| with open('ensembl34.fa') as arq: | |
| linhas = arq.readlines() | |
| tam_linhas = len(linhas) | |
| # busca por cada nome nas linhas | |
| for nome in nomes: | |
| for i in range(tam_linhas): | |
| achou = linhas[i].find(nome) | |
| if achou != -1: # se achou algo | |
| print('Encontrou %s na linha %d' % (nome, i + 1)) | |
| break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment