Skip to content
Snippets Groups Projects
Commit 53667865 authored by Michael Sandholzer's avatar Michael Sandholzer
Browse files

deleted: ../dist/read_sequencer-0.0.0-py3-none-any.whl

	deleted:    ../dist/read_sequencer-0.0.0.tar.gz
	deleted:    ../dist/read_sequencer-0.1.0-py3-none-any.whl
	deleted:    ../dist/read_sequencer-0.1.0.tar.gz
	modified:   ../read_sequencer.egg-info/PKG-INFO
	modified:   cli.py
	modified:   modules.py
	modified:   ../setup.py
	../build/
	../dist/
parent 418c609e
No related branches found
No related tags found
1 merge request!19Package was Published and logger was implemented deleted: ../dist/read_sequencer-0.0.0-py3-none-any.whl
File deleted
File deleted
File deleted
File deleted
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
......
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()
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 = {}
......
......@@ -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']}
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment