From 4fe8876d6ff17479a36ebcce564aa6983e15c490 Mon Sep 17 00:00:00 2001
From: AndreaGuarracino
Date: Wed, 19 Aug 2020 22:29:33 +0200
Subject: used builtin hashlib md5 for the deduplication step

---
 workflows/pangenome-generate/sort_fasta_by_quality_and_len.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'workflows')

diff --git a/workflows/pangenome-generate/sort_fasta_by_quality_and_len.py b/workflows/pangenome-generate/sort_fasta_by_quality_and_len.py
index 5f75021..e836654 100644
--- a/workflows/pangenome-generate/sort_fasta_by_quality_and_len.py
+++ b/workflows/pangenome-generate/sort_fasta_by_quality_and_len.py
@@ -6,7 +6,9 @@
 import os
 import sys
 import gzip
-import xxhash
+
+#import xxhash # Faster library
+import hashlib
 
 def open_gzipsafe(path_file):
     if path_file.endswith('.gz'):
@@ -26,7 +28,9 @@ with open_gzipsafe(path_fasta) as f:
         header = fasta.strip('\n').split('\n')[0]
         sequence = ''.join(fasta.strip('\n').split('\n')[1:])
 
-        hash = xxhash.xxh64(sequence).hexdigest()
+        ##hash = xxhash.xxh64(sequence).hexdigest() # Faster library
+        hash = hashlib.md5(sequence.encode('utf-8')).hexdigest()
+
         if hash not in hash_to_count_and_headers_dict:
             # New sequence
             hash_to_count_and_headers_dict[hash] = [0, []]
-- 
cgit v1.2.3