Commit b896cbaf authored by Mathieu Giraud's avatar Mathieu Giraud
Browse files

buildBrowserGermline.py: code simplification

parent a1b3cafa
...@@ -26,29 +26,29 @@ for i in range(1, len(sys.argv)-2) : ...@@ -26,29 +26,29 @@ for i in range(1, len(sys.argv)-2) :
for ligne in fasta : for ligne in fasta :
ligne = ligne.rstrip('\n\r') ligne = ligne.rstrip('\n\r')
if len(ligne) != 0 : if ligne:
if ligne[0]=='>' : if ligne[0]=='>' :
identifiant=ligne[1:] identifiant=ligne[1:]
if identifiant.count('|') != 0 : if '|' in identifiant:
tmp=identifiant.split('|') identifiant = identifiant.split('|')[1]
identifiant=tmp[1]
if identifiant.count('_') != 0 : if '_' in identifiant:
tmp2=identifiant.split('_') identifiant = identifiant.split('_')[0]
identifiant=tmp2[0]
sequence=""; sequence = ""
else : else :
sequence+=ligne sequence+=ligne
if len(sequence)!=0 : if sequence:
# If there is still some sequence left, this value will be overwritten in the next pass
table[system][identifiant]=sequence table[system][identifiant]=sequence
fasta.close() fasta.close()
if output_name != "":
if output_name:
with open(output_name, "w") as file : with open(output_name, "w") as file :
file.write("germline = ") file.write("germline = ")
json.dump(table, file, indent=2, sort_keys=True) json.dump(table, file, indent=2, sort_keys=True)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment