Skip to content
Snippets Groups Projects
Commit f4f2c586 authored by Christoph Harmel's avatar Christoph Harmel
Browse files

fix: updated cli.py for rewritten class

parent e4c0da92
No related branches found
No related tags found
1 merge request!26feat: ReadSequencer class rewritten, updated CLI
......@@ -4,32 +4,34 @@ import logging
parser = argparse.ArgumentParser(prog='read_sequencer',
description='Simulates sequencing of DNA sequences specified by an FASTA file.')
parser.add_argument('--input_file_path',
parser.add_argument('output',
help='path to FASTA file')
parser.add_argument('--output_file_path',
parser.add_argument('-i','--input', default=None,
help='path to FASTA file')
parser.add_argument('--read_length',
parser.add_argument('-r','--read-length', default=100,
help='read length for sequencing',
type=int)
parser.add_argument('--random', action='store_true', default=False,
help='generate random sequences')
parser.add_argument('--n_random', default=100, type=int, help='n random sequences')
parser.add_argument('--mean_random', default=50, type=int, help='mean random sequences')
parser.add_argument('--sd_random', default=25, type=int, help='standard deviation random sequences')
parser.add_argument('-n','--n_random', default=100, type=int,
help='n random sequences. Just used if input fasta file is not specified.')
parser.add_argument('-s','--chunk-size', default=10000, type=int, help='chunk_size for batch processing')
args = parser.parse_args()
def main():
LOG.info("Read sequencer started.")
read_sequencer = ReadSequencer()
if args.random:
read_sequencer.add_random_sequences(n=args.n_random, mean=args.mean_random, sd=args.sd_random)
if args.input is not None:
read_sequencer = ReadSequencer(fasta=args.input, output=args.output, read_length=args.read_length, chunk_size=args.chunk_size)
read_sequencer.get_n_sequences()
else:
read_sequencer.read_fasta(args.input_file_path)
read_sequencer.run_sequencing(args.read_length)
read_sequencer.write_fasta(args.output_file_path)
read_sequencer = ReadSequencer(fasta=args.input, output=args.output, read_length=args.read_length, chunk_size=args.chunk_size)
read_sequencer.define_random_sequences(n=args.n_random)
read_sequencer.run_sequencing()
LOG.info("Read sequencer finished.")
if __name__ == '__main__':
logging.basicConfig(
format='[%(asctime)s: %(levelname)s] %(message)s (module "%(module)s")',
......
......@@ -36,7 +36,6 @@ class ReadSequencer:
None
"""
self.n_sequences = len(list(SeqIO.parse(self.fasta, 'fasta')))
LOG.info(self.n_sequences, ' sequences found in ', self.fasta)
def define_random_sequences(self, n: int) -> None:
"""
......@@ -48,8 +47,6 @@ class ReadSequencer:
Returns:
None
"""
LOG.info('Set mode to: generate random sequences')
LOG.info('N random sequences: ', n)
self.random = True
self.n_sequences = n
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment