Skip to content

Commit ce32423

Browse files
Merge pull request #333 from fransua/master
faster parsing
2 parents 0eaf741 + e869898 commit ce32423

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

_pytadbit/parsers/hic_bam_parser.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -374,13 +374,6 @@ def _read_bam_frag(inbam, filter_exclude, all_bins, sections1, sections2,
374374
refs = bamfile.references
375375
bam_start = start - 2
376376
bam_start = max(0, bam_start)
377-
section_pos = []
378-
for sec in sections1:
379-
if sec not in section_pos:
380-
section_pos.append(sec[0])
381-
for sec in sections2:
382-
if sec not in section_pos:
383-
section_pos.append(sec[0])
384377
try:
385378
dico = {}
386379
for r in bamfile.fetch(region=region,
@@ -677,7 +670,7 @@ def read_bam(inbam, filter_exclude, resolution, ncpus=8,
677670
if ncpus == 1:
678671
read_bam_frag(inbam, filter_exclude, all_bins,
679672
bins_dict1, bins_dict2, rand_hash,
680-
resolution, tmpdir, region, b, e,)
673+
resolution, tmpdir, region, b, e)
681674
else:
682675
procs.append(pool.apply_async(
683676
read_bam_frag, args=(inbam, filter_exclude, all_bins,

_pytadbit/parsers/sam_parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def parse_sam(f_names1, f_names2=None, out_file1=None, out_file2=None,
108108
if mapper.lower()=='gem':
109109
condition = lambda x: x[1][0][0] != 'N'
110110
elif mapper.lower() in ['bowtie', 'bowtie2']:
111-
condition = lambda x: 'XS' in dict(x)
111+
condition = lambda x: 'XS' == x[0][0]
112112
else:
113113
warn('WARNING: unrecognized mapper used to generate file\n')
114114
condition = lambda x: x[1][1] != 1

0 commit comments

Comments
 (0)