Skip to content

Commit

Permalink
fix barcode.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
r3fang committed Sep 4, 2019
1 parent 23171b8 commit eecfa56
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup

snaptools_version = '1.4.7'
snaptools_version = '1.4.8'

setup(
name='snaptools',
Expand Down
2 changes: 1 addition & 1 deletion snaptools.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: snaptools
Version: 1.4.7
Version: 1.4.8
Summary: A module for working with snap files in Python
Home-page: https://github.com/r3fang/SnapTools.git
Author: Rongxin Fang
Expand Down
2 changes: 1 addition & 1 deletion snaptools/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.4.7'
__version__ = '1.4.8'
4 changes: 3 additions & 1 deletion snaptools/snap.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ def getBarcodesFromTxt(fname):
with open(fname) as fin:
for line in fin:
if line.startswith("#"): continue;
barcode = line.split()[0].upper()
if type(line) is bytes:
line = line.decode();
barcode = line.split()[0].upper();
barcode_list.append(barcode);
barocde_num = len(set(barcode_list));
if barocde_num < len(barcode_list):
Expand Down
15 changes: 10 additions & 5 deletions snaptools/snap_pre.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,20 @@ def snap_pre(input_file,
barcode_dict = snaptools.snap.getBarcodesFromTxt(barcode_file);
else:
barcode_dict = snaptools.snap.getBarcodesFromInput(input_file, file_format);

if min_cov == 0 and max_num == 10000000:
barcode_dict = barcode_dict;
else:
barcode_cov = snaptools.snap.getBarcodeCov(list(barcode_dict.keys()), input_file, file_format);
barcode_cov = sorted(list(barcode_cov.items()), key=operator.itemgetter(1), reverse=True);
barcode_cov = barcode_cov[0:min(len(barcode_cov), max_num)];
barcodes = [key for [key, value] in barcode_cov if value > min_cov];
barcode_dict = collections.OrderedDict(list(zip(sorted(barcodes), list(range(1,(len(barcodes)+1))))));
barcode_dict = collections.OrderedDict(list(zip(sorted(barcodes), list(range(1,(len(barcodes)+1))))));

#if min_cov == 0 and max_num == 10000000:
# barcode_dict = barcode_dict;
#else:
# barcode_cov = snaptools.snap.getBarcodeCov(list(barcode_dict.keys()), input_file, file_format);
# barcode_cov = sorted(list(barcode_cov.items()), key=operator.itemgetter(1), reverse=True);
# barcode_cov = barcode_cov[0:min(len(barcode_cov), max_num)];
# barcodes = [key for [key, value] in barcode_cov if value > min_cov];
# barcode_dict = collections.OrderedDict(list(zip(sorted(barcodes), list(range(1,(len(barcodes)+1))))));

f = h5py.File(output_snap, "w", libver='earliest');
f.create_group("HD");
Expand Down

0 comments on commit eecfa56

Please sign in to comment.