Skip to content
Snippets Groups Projects
Commit eea24234 authored by Kathleen Moriarty's avatar Kathleen Moriarty
Browse files

added: comments and new lines

parent 7549c162
No related branches found
No related tags found
1 merge request!17Issue 7
Pipeline #13804 failed
"""Read Sequencing! """Read Sequencing.
Simulate the sequencing of reads on the template of terminal fragments and simulates reads of these fragments. Simulate the sequencing of reads on the template of terminal fragments and simulates reads of these fragments.
Author: Kathleen Moriarty Author: Kathleen Moriarty
...@@ -33,14 +33,15 @@ def read_sequencing( ...@@ -33,14 +33,15 @@ def read_sequencing(
num_reads: number of total reads to simulate num_reads: number of total reads to simulate
read_len: integer of identical read length read_len: integer of identical read length
""" """
# Read data from terminal fragment file # Read data from terminal fragment file
# Store fragment descriptions in a list # Store fragment descriptions in a list
frag_desc = [] # type: List[str] frag_desc = [] # type: List[str]
with open(frag_file_name, 'r') as f: with open(frag_file_name, 'r') as f:
frag_line = f.readline() frag_line = f.readline()
# Store all fragments as a list to parse later
frag_list = [] # type: List[str] frag_list = [] # type: List[str]
# Store combined fragment lines
frag_str = "" frag_str = ""
while frag_line != "": while frag_line != "":
# To stop when the end of file is reached # To stop when the end of file is reached
......
"""Test Read Sequencing Functionality.""" """Test Functionality of Read Sequencing"""
# imports from built-in modules # imports from built-in modules
from pathlib import Path from pathlib import Path
...@@ -13,10 +13,10 @@ from src.read_sequencing import read_sequencing ...@@ -13,10 +13,10 @@ from src.read_sequencing import read_sequencing
def test_read_sequencing(tmpdir): def test_read_sequencing(tmpdir):
"""Tests the correct number of reads were generated.""" """Tests the correct number of reads were generated."""
read_sequencing( read_sequencing(
frag_file_name=Path('./tests/resources/test_terminal_fragments.txt'), frag_file_name=Path.cwd() / 'tests/resources/test_terminal_fragments.txt',
num_reads=80, num_reads=80,
read_len=10, read_len=10,
output_file_name=tmpdir / 'reads.txt' output_file_name=tmpdir / 'reads.txt'
) )
df_out = pd.read_table(tmpdir / 'reads.txt', header=None) df_out = pd.read_table(tmpdir / 'reads.txt', header=None)
assert df_out.shape[0] == 80 * 3 assert df_out.shape[0] == 80 * 2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment