Skip to content

Commit

Permalink
allow to insert path to file
Browse files Browse the repository at this point in the history
  • Loading branch information
KubaOfca committed Aug 16, 2022
1 parent 0b438ca commit 0e2d357
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions smarca5/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,22 @@
import matplotlib as mpl # type: ignore
import re
import numpy

# flake8: noqa E203
LINE_LENGTH_DISPLAYED = 80
SIZE_OF_THE_TOP_SPACE_BETWEEN_THE_LINES = 4
LEFT_TEXT_OFFSET = 33
UNIQUE_PATTERN = re.compile(r".*Unique: (.*)\n.*")


def read_ref_seq_fasta() -> str:
"""
Read reference protein sequence in fasta format.
:return: reference sequence string
"""
ref_seq_fasta = ""
with open(r"..\pliki-SMARCA5\SMARCA5_fasta.txt", "r") as file:
with open(rf"{protein_entry.get()}", "r") as file:
for line in file:
if line[0] != ">":
ref_seq_fasta += line.strip()
Expand Down Expand Up @@ -423,9 +425,9 @@ def find_peptide_in_protein_seq() -> None:
:return: None
"""
ref_seq_fasta = read_ref_seq_fasta()
result_of_experiment = pd.read_excel(
r"..\pliki-SMARCA5\SMARCA5.xlsx", sheet_name="SMARCA5"
).loc[:, ["Sequence", "Proteins", "Experiment"]]
result_of_experiment = pd.read_excel(rf"{peptide_entry.get()}").loc[
:, ["Sequence", "Proteins", "Experiment"]
]

result, amount = search_peptide_in_protein_seq(
result_of_experiment, ref_seq_fasta
Expand Down Expand Up @@ -456,11 +458,11 @@ def browse(entry: tk.Entry) -> None:
0,
fd.askopenfilename(
filetypes=[
("All files", "*.*"),
("Excel files", ".xlsx .xls"),
("CSV files", ".csv"),
("Fasta files", ".fasta"),
("TXT files", ".txt"),
("All files", "*.*"),
]
),
)
Expand Down

0 comments on commit 0e2d357

Please sign in to comment.