Attention une mise à jour du service Gitlab va être effectuée le mardi 18 janvier (et non lundi 17 comme annoncé précédemment) entre 18h00 et 18h30. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit 17ab708c authored by marc's avatar marc Committed by Mathieu Giraud
Browse files

fuse.py: add a limit to similarity (don't compute gigantic similarity matrix)

parent fffd62b2
...@@ -46,6 +46,7 @@ from collections import defaultdict ...@@ -46,6 +46,7 @@ from collections import defaultdict
FUSE_VERSION = "vidjil fuse" FUSE_VERSION = "vidjil fuse"
TOOL_SIMILARITY = "../algo/tools/similarity" TOOL_SIMILARITY = "../algo/tools/similarity"
SIMILARITY_LIMIT = 1000
GERMLINES_ORDER = ['TRA', 'TRB', 'TRG', 'TRD', 'DD', 'IGH', 'DHJH', 'IJK', 'IJL'] GERMLINES_ORDER = ['TRA', 'TRB', 'TRG', 'TRD', 'DD', 'IGH', 'DHJH', 'IJK', 'IJL']
...@@ -739,21 +740,24 @@ def main(): ...@@ -739,21 +740,24 @@ def main():
print() print()
#compute similarity matrix #compute similarity matrix
fasta = "" if len(jlist_fused.d["clones"]) < SIMILARITY_LIMIT :
for i in range(len(jlist_fused.d["clones"])) : fasta = ""
fasta += ">>" + str(i) + "\n" for i in range(len(jlist_fused.d["clones"])) :
fasta += jlist_fused.d["clones"][i].d["id"] + "\n" fasta += ">>" + str(i) + "\n"
fasta_file = tempfile.NamedTemporaryFile(delete=False) fasta += jlist_fused.d["clones"][i].d["id"] + "\n"
fasta_file.write(fasta) fasta_file = tempfile.NamedTemporaryFile(delete=False)
try: fasta_file.write(fasta)
out = subprocess.check_output([TOOL_SIMILARITY, "-j", fasta_file.name]) try:
jlist_fused.d["similarity"] = json.loads(out) out = subprocess.check_output([TOOL_SIMILARITY, "-j", fasta_file.name])
except OSError: jlist_fused.d["similarity"] = json.loads(out)
print("! failed: %s" % TOOL_SIMILARITY) except OSError:
print("! failed: %s" % TOOL_SIMILARITY)
print("### Save merged file") print("### Save merged file")
jlist_fused.save_json(args.output) jlist_fused.save_json(args.output)
os.unlink(fasta_file.name) os.unlink(fasta_file.name)
if __name__ =='__main__': if __name__ =='__main__':
......
Markdown is supported
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