Skip to content

Commit

Permalink
Update pep8
Browse files Browse the repository at this point in the history
Fasta cleaner
  • Loading branch information
Rendrick27 committed May 15, 2024
1 parent 3094087 commit 2acf3e7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Phylo_flow pipeline
# Phylo Flow

## Description
This tool, developed within the scope of ASB, aims to create a pipeline.
Expand Down
20 changes: 13 additions & 7 deletions python/fasta_cleaner.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import sys


def clean_fasta(input_file, output_file):
"""
Processes a FASTA file to remove all occurrences of the letter 'n' (lowercase) from the DNA sequences.
Processes a FASTA file to remove all occurrences of the letter 'n'
(lowercase) from the DNA sequences.
Args:
input_file (str): The path to the input FASTA file.
output_file (str): The path to the output FASTA file where the cleaned sequences will be saved.
Each sequence in the file is expected to start with a header line that begins with '>'.
This script retains the header lines and writes the cleaned sequences to the output file.
output_file (str): The path to the output FASTA file
where the cleaned sequences will be saved.
Each sequence in the file is expected to start
with a header line that begins with '>'.
This script retains the header lines and writes the cleaned sequences
to the output file.
"""
with open(input_file, 'r') as f, open(output_file, 'w') as fout:
for line in f:
Expand All @@ -19,11 +24,12 @@ def clean_fasta(input_file, output_file):
cleaned_sequence = line.strip().replace('N', '')
fout.write(cleaned_sequence + '\n')


if __name__ == "__main__":
if len(sys.argv) != 3:
print("Usage: python3 script_name.py <input_fasta> <output_fasta>")
sys.exit(1)

input_file = sys.argv[1]
output_file = sys.argv[2]
clean_fasta(input_file, output_file)
2 changes: 1 addition & 1 deletion python/newick_tree_visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def tree_generator(infile, outfile):
labels = [f"{round(float(s), 2)}" if s else "" for s in support_values]

# Create and save the phylogenetic tree plot
canvas, axes, mark = tree.draw(node_labels=labels, node_sizes=30,
canvas, axes, mark = tree.draw(node_labels=labels, node_sizes=30,
width=width, height=height, tree_style="n")
toyplot.svg.render(canvas, outfile)

Expand Down

0 comments on commit 2acf3e7

Please sign in to comment.