Skip to content

Commit

Permalink
Merge pull request #333 from fransua/master
Browse files Browse the repository at this point in the history
faster parsing
  • Loading branch information
david-castillo authored Oct 26, 2020
2 parents 0eaf741 + e869898 commit ce32423
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
9 changes: 1 addition & 8 deletions _pytadbit/parsers/hic_bam_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,6 @@ def _read_bam_frag(inbam, filter_exclude, all_bins, sections1, sections2,
refs = bamfile.references
bam_start = start - 2
bam_start = max(0, bam_start)
section_pos = []
for sec in sections1:
if sec not in section_pos:
section_pos.append(sec[0])
for sec in sections2:
if sec not in section_pos:
section_pos.append(sec[0])
try:
dico = {}
for r in bamfile.fetch(region=region,
Expand Down Expand Up @@ -677,7 +670,7 @@ def read_bam(inbam, filter_exclude, resolution, ncpus=8,
if ncpus == 1:
read_bam_frag(inbam, filter_exclude, all_bins,
bins_dict1, bins_dict2, rand_hash,
resolution, tmpdir, region, b, e,)
resolution, tmpdir, region, b, e)
else:
procs.append(pool.apply_async(
read_bam_frag, args=(inbam, filter_exclude, all_bins,
Expand Down
2 changes: 1 addition & 1 deletion _pytadbit/parsers/sam_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def parse_sam(f_names1, f_names2=None, out_file1=None, out_file2=None,
if mapper.lower()=='gem':
condition = lambda x: x[1][0][0] != 'N'
elif mapper.lower() in ['bowtie', 'bowtie2']:
condition = lambda x: 'XS' in dict(x)
condition = lambda x: 'XS' == x[0][0]
else:
warn('WARNING: unrecognized mapper used to generate file\n')
condition = lambda x: x[1][1] != 1
Expand Down

0 comments on commit ce32423

Please sign in to comment.