Skip to content

Commit

Permalink
Fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
psj1997 committed Feb 26, 2024
1 parent 2f8d572 commit fe52862
Showing 1 changed file with 2 additions and 40 deletions.
42 changes: 2 additions & 40 deletions SemiBin/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,43 +773,6 @@ def generate_sequence_features_single(logger, contig_fasta,
logger.info('We will only calculate k-mer features.')

if not only_kmer:
n_sample = len(bams)
is_combined = n_sample >= 5
bam_list = bams

logger.info('Calculating coverage for every sample.')

with Pool(min(num_process, len(bams))) as pool:
results = [
pool.apply_async(
generate_cov,
args=(
bam_file,
bam_index,
output,
must_link_threshold,
is_combined,
binned_length,
logger,
None
))
for bam_index, bam_file in enumerate(bams)]
for r in results:
s = r.get()
logger.info(f'Processed: {s}')

for bam_index, bam_file in enumerate(bams):
if not os.path.exists(os.path.join(output, '{}_data_cov.csv'.format(
os.path.split(bam_file)[-1] + '_{}'.format(bam_index)))):
sys.stderr.write(
f"Error: Generating coverage file fail\n")
sys.exit(1)
if is_combined:
if not os.path.exists(os.path.join(output, '{}_data_split_cov.csv'.format(
os.path.split(bam_file)[-1] + '_{}'.format(bam_index)))):
sys.stderr.write(
f"Error: Generating coverage file fail\n")
sys.exit(1)

logger.debug('Start generating kmer features from fasta file.')
kmer_whole = generate_kmer_features_from_fasta(
Expand All @@ -823,7 +786,7 @@ def generate_sequence_features_single(logger, contig_fasta,
bam_list = bams
logger.info('Calculating coverage for every sample.')

with Pool(num_process if num_process != 0 else None) as pool:
with Pool(min(num_process, len(bams))) as pool:
results = [
pool.apply_async(
generate_cov,
Expand Down Expand Up @@ -960,9 +923,8 @@ def fasta_sample_iter(fn):
os.path.join(args.output, f'samples/{sample}.fa'),
args.ratio)


if args.bams:
with Pool(args.num_process if args.num_process != 0 else None) as pool:
with Pool(min(args.num_process, len(args.bams))) as pool:
results = [
pool.apply_async(
generate_cov,
Expand Down

0 comments on commit fe52862

Please sign in to comment.