view scripts/dico.py @ 0:eb95bf7f90ae draft

planemo upload for repository https://github.com/abims-sbr/adaptsearch commit 3c7982d775b6f3b472f6514d791edcb43cd258a1-dirty
author abims-sbr
date Fri, 01 Feb 2019 10:26:37 -0500
parents
children c79bdda8abfb
line wrap: on
line source

import string, itertools

def dico(F1):
    dicoco = {}
    with open(F1, "r") as file:
        for name, query in itertools.izip_longest(*[file]*2):
            if name[0] == ">":
                fasta_name_query = name[:-1]
                Sn = string.split(fasta_name_query, "||")
                fasta_name_query = Sn[0]                
                fasta_seq_query = query[:-1]
                dicoco[fasta_name_query] = fasta_seq_query    
    return(dicoco)