Skip to content
Snippets Groups Projects
Commit 4acce8f9 authored by Mate Balajti's avatar Mate Balajti
Browse files

feat: update setup.py to allow tool install

parent c6b96e6b
No related branches found
No related tags found
1 merge request!58refactor: update CLI
Pipeline #17235 failed
This commit is part of merge request !58. Comments created here will be created in the context of that merge request.
......@@ -29,8 +29,7 @@ Output:
To install package, run
```
pip install -r requirements.txt
pip install -r requirements_dev.txt
pip install .
```
......
......@@ -18,5 +18,10 @@ setup(
author_email='hmadge@ethz.ch',
description='Terminal fragment selector',
packages=find_packages(),
install_requires=INSTALL_REQUIRES
install_requires=INSTALL_REQUIRES,
entry_points={
'console_scripts': [
'terminal-fragment-selector=term_frag_sel.cli:main'
]
}
)
......@@ -18,13 +18,15 @@ logging.basicConfig(
logger = logging.getLogger("main")
def main(args: argparse.Namespace):
def main():
"""Use CLI arguments to fragment sequences and output text file \
with selected terminal fragments.
Args:
args (parser): list of arguments from CLI.
"""
args = parse_arguments()
if not isinstance(args, argparse.Namespace):
raise TypeError("Input should be argparse.Namespace")
......@@ -38,8 +40,10 @@ def main(args: argparse.Namespace):
logger.info("Fragmentation of %s...", args.fasta)
splits = np.arange(0, len(list(fasta))+args.size, args.size)
for i, split in enumerate(splits):
fasta_dict = fasta[split:splits[i+1]]
for i in range(len(splits) - 1):
split = splits[i]
keys = list(fasta.keys())[split:splits[i+1]]
fasta_dict = {key: fasta[key] for key in keys}
term_frags = fragmentation(fasta_dict, seq_counts,
args.mean, args.std)
......@@ -132,6 +136,4 @@ if __name__ == '__main__':
level=logging.INFO,
)
logger = logging.getLogger(__name__)
arguments = parse_arguments()
main(arguments)
main()
......@@ -24,7 +24,7 @@ def fragmentation(fasta: dict, seq_counts: pd.DataFrame,
term_frags = []
for seq_id, seq in fasta.items():
counts = seq_counts[seq_counts["seqID"] == seq_id]["count"]
counts = seq_counts[seq_counts["seqID"] == str(seq_id)]["count"]
for _ in range(counts.iloc[0]):
cuts = []
seq_len = len(seq)
......
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