Skip to content

Commit

Permalink
Merge pull request #223 from rhysnewell/no-coassemble
Browse files Browse the repository at this point in the history
assemble/recover: Require users to specify coassembly or not.
  • Loading branch information
rhysnewell authored Nov 20, 2024
2 parents af6d306 + a850c20 commit fcddc2c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ aviary_genome.egg-info

example/
test/data/.conda
test/data/wgsim.metaspades.assembly.fna.fai
config.yaml
5 changes: 2 additions & 3 deletions aviary/aviary.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,13 +792,12 @@ def main():
assemble_group.add_argument(
'--coassemble', '--co-assemble', '--co_assemble',
help='Specifies whether or not, when given multiple input reads, to coassemble them. \n'
'If False, Aviary will use the first set of short reads and first set of long reads to perform assembly \n'
'If False (no), Aviary will use the first set of short reads and first set of long reads to perform assembly \n'
'All read files will still be used during the MAG recovery process for differential coverage.',
type=str2bool,
nargs='?',
const=True,
dest='coassemble',
default=False,
metavar='yes|no',
)

assemble_group.add_argument(
Expand Down
13 changes: 11 additions & 2 deletions aviary/modules/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ def __init__(self,
self.pe2 = 'none'
self.short_percent_identity = 'none'


try:
self.kmer_sizes = args.kmer_sizes
self.use_megahit = args.use_megahit
Expand All @@ -246,7 +245,7 @@ def __init__(self,
except AttributeError:
self.kmer_sizes = ['auto']
self.use_megahit = False
self.coassemble = True
self.coassemble = False
self.min_cov_long = 20
self.min_cov_short = 3
self.exclude_contig_cov = 100
Expand Down Expand Up @@ -346,6 +345,16 @@ def make_config(self):

with open(template_conf_file) as template_config:
conf = yaml.load(template_config)

if self.assembly == 'none' or self.assembly is None:
# Check if coassembly or not needs to be specified by the user.
if self.coassemble is None:
if (self.pe1 != 'none' and len(self.pe1) > 1) or \
(self.longreads != 'none' and len(self.longreads) > 1):
logging.error("Multiple readsets detected. Either specify '--coassemble' for coassembly of or '--coassemble no'.")
sys.exit(-1)
if self.coassemble is None:
self.coassemble = False # ensure that something is specified so that the config file is well formed

if self.assembly != "none" and self.assembly is not None:
self.assembly = list(dict.fromkeys([os.path.abspath(p) for p in self.assembly]))
Expand Down

0 comments on commit fcddc2c

Please sign in to comment.