Skip to content

Commit

Permalink
fix: batch headers now constant var
Browse files Browse the repository at this point in the history
  • Loading branch information
rhysnewell committed Apr 8, 2024
1 parent bfebaf9 commit c3d9277
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions aviary/modules/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
from snakemake.io import load_configfile
from ruamel.yaml import YAML # used for yaml reading with comments

BATCH_HEADER=['sample', 'short_reads_1', 'short_reads_2', 'long_reads', 'long_read_type', 'assembly', 'coassemble']

# Debug
debug={1:logging.CRITICAL,
2:logging.ERROR,
Expand Down Expand Up @@ -505,7 +507,7 @@ def process_batch(args, prefix):
for sep in ['\t', ',', ' ']:
separated = line.split(sep)
print(separated)
if separated == ['sample', 'short_reads_1', 'short_reads_2', 'long_reads', 'long_read_type', 'assembly', 'coassemble']:
if separated == BATCH_HEADER:
header=0
separator=sep
logging.debug("Inferred header")
Expand All @@ -521,7 +523,7 @@ def process_batch(args, prefix):
if header is not None:
batch = pd.read_csv(args.batch_file, sep=separator, engine='python', header=header)
else:
batch = pd.read_csv(args.batch_file, sep=separator, engine='python', names=['sample', 'short_reads_1', 'short_reads_2', 'long_reads', 'long_read_type', 'assembly', 'coassemble'])
batch = pd.read_csv(args.batch_file, sep=separator, engine='python', names=BATCH_HEADER)
if len(batch.columns) != 7:
logging.critical(f"Batch file contains incorrect number of columns ({len(batch.columns)}). Should contain 7.")
logging.critical(f"Current columns: {batch.columns}")
Expand Down

0 comments on commit c3d9277

Please sign in to comment.