diff --git a/dist/read_sequencer-0.0.0-py3-none-any.whl b/dist/read_sequencer-0.0.0-py3-none-any.whl deleted file mode 100644 index eef40d750bde745f173acb7bf55c07b7f3b614b7..0000000000000000000000000000000000000000 Binary files a/dist/read_sequencer-0.0.0-py3-none-any.whl and /dev/null differ diff --git a/dist/read_sequencer-0.0.0.tar.gz b/dist/read_sequencer-0.0.0.tar.gz deleted file mode 100644 index e6a61bdd978fbca161a7038d1b9347247c7ee217..0000000000000000000000000000000000000000 Binary files a/dist/read_sequencer-0.0.0.tar.gz and /dev/null differ diff --git a/dist/read_sequencer-0.1.0-py3-none-any.whl b/dist/read_sequencer-0.1.0-py3-none-any.whl deleted file mode 100644 index 498126be25a17f3495b784cf230e16409a17c9b8..0000000000000000000000000000000000000000 Binary files a/dist/read_sequencer-0.1.0-py3-none-any.whl and /dev/null differ diff --git a/dist/read_sequencer-0.1.0.tar.gz b/dist/read_sequencer-0.1.0.tar.gz deleted file mode 100644 index b6154c161298fad55051e061978ac617b0bd5019..0000000000000000000000000000000000000000 Binary files a/dist/read_sequencer-0.1.0.tar.gz and /dev/null differ diff --git a/read_sequencer.egg-info/PKG-INFO b/read_sequencer.egg-info/PKG-INFO index b3bc3e57b862ed1db4639841094225f12b187ad0..ed2a2f723157a60010ad224e55406bda28f82255 100644 --- a/read_sequencer.egg-info/PKG-INFO +++ b/read_sequencer.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: read-sequencer -Version: 0.1.0 +Version: 0.1.1 Summary: Simulates sequencing with a specified read length from sequences specified by a FASTA file. Home-page: https://git.scicore.unibas.ch/zavolan_group/tools/read-sequencer Author: Clara Serger, Michael Sandholzer and Christoph Harmel diff --git a/read_sequencer_package/cli.py b/read_sequencer_package/cli.py index e786d78de5391ea2b035c058f4de2cd16162a4d6..1a973363d8074b1a76833766cdad8e42a68a3a8f 100644 --- a/read_sequencer_package/cli.py +++ b/read_sequencer_package/cli.py @@ -1,5 +1,6 @@ import argparse from modules import read_sequencer as rs +import logging parser = argparse.ArgumentParser(prog='read_sequencer', description='Simulates sequencing of DNA sequences specified by an FASTA file.') @@ -14,10 +15,17 @@ parser.add_argument('--read_length', args = parser.parse_args() def main(): + LOG.info("Program started.") read_sequencer = rs() read_sequencer.read_fasta(args.input_file_path) read_sequencer.run_sequencing(args.read_length) read_sequencer.write_fasta(args.output_file_path) + LOG.info("Program finished.") if __name__ == '__main__': + logging.basicConfig( + format='[%(asctime)s: %(levelname)s] %(message)s (module "%(module)s")', + level=logging.INFO, + ) + LOG = logging.getLogger(__name__) main() diff --git a/read_sequencer_package/modules.py b/read_sequencer_package/modules.py index 39a686616817f6b496328d460fe06931f9670da8..93bef226c04902a73842cb92006efd74164d7383 100644 --- a/read_sequencer_package/modules.py +++ b/read_sequencer_package/modules.py @@ -1,3 +1,6 @@ +import logging +LOG = logging.getLogger(__name__) + def generate_sequences(n, mean, sd): """ Generates random sequences. @@ -11,6 +14,7 @@ def generate_sequences(n, mean, sd): list: of n sequences """ from random import gauss, choice + LOG.info("Generating sequences.") dict = {} for i in range(n): keys = range(n) @@ -33,6 +37,7 @@ def read_in_fasta(file_path): Dict: It returns a dictionary with sequences. ''' + LOG.info("Reading in FASTA files from destination.") sequences = {} f = open(file_path) for line in f: @@ -59,6 +64,7 @@ def read_sequence(seq, read_length): str: returns sequenced element ''' + LOG.info("Reading sequences.") from random import choice bases = ["A", "T", "C", "G"] sequenced = '' @@ -84,6 +90,7 @@ def simulate_sequencing(sequences, read_length): Returns: dict: of n sequences as values """ + LOG.info("Sequencing in progress....") results = {} for index, key in enumerate(sequences): results[key] = read_sequence(sequences[key], read_length=read_length) @@ -103,6 +110,7 @@ def generate_sequences(n, mean, sd): Returns: dict: of n sequences """ + LOG.info("Generating random sequences.") dict1 = {} for i in range(n): keys = range(n) @@ -123,13 +131,14 @@ def write_fasta(sequences, file_path): file_path (str): A file path directing to the output folder. """ + LOG.info("Writing FASTA file.") from textwrap import wrap with open(file_path, "w") as outfile: for key, value in sequences.items(): outfile.write(key + "\n") outfile.write("\n".join(wrap(value, 60))) outfile.write("\n") - + LOG.info("Sequencing was successfully executed.") class read_sequencer: def __init__(self): self.sequences = {} diff --git a/setup.py b/setup.py index f2b5b315188ab143e2676b9dfb47beac7964d283..905f8ee96fc23a232cf669563da1389e1228c9e5 100644 --- a/setup.py +++ b/setup.py @@ -2,13 +2,13 @@ from setuptools import setup, find_packages setup( name='read_sequencer', - version='0.1.0', + version='0.1.1', url='https://git.scicore.unibas.ch/zavolan_group/tools/read-sequencer', license='MIT', author='Clara Serger, Michael Sandholzer and Christoph Harmel', author_email='christoph.harmel@unibas.ch', description='Simulates sequencing with a specified read length from sequences specified by a FASTA file.', packages=find_packages(), - install_requires=['random','textwrap','argparse'], + install_requires=['random','textwrap','argparse','logging'], entry_points={'console_scripts': ['read_sequencer=read_sequencer_package.cli:main']} )