diff --git a/_log b/_log new file mode 100644 index 0000000..1375241 --- /dev/null +++ b/_log @@ -0,0 +1,33 @@ +. +├── alg +│   ├── ampf.py +│   ├── analysis.py +│   ├── blast.py +│   ├── _log +│   ├── out +│   └── startery.py +├── cmd +│   ├── gen.py +│   └── seq2fasta.py +├── data +│   ├── 217314860.fasta +│   ├── 2187833333.fasta +│   ├── 2813891763.fasta +│   ├── 2813891767.fasta +│   ├── 599088294.fasta +│   ├── ITS1.fasta +│   ├── ITS4.fasta +│   └── sequence.fasta +├── doc +│   ├── main.pdf +│   ├── main.tex +│   └── references.bib +├── _l +├── _log +├── log +│   ├── amplification_analysis_log.txt +│   └── __log.txt +└── out + └── blast_results.xml + +9 directories, 22 files diff --git a/_log/amplification_analysis_log.txt b/_log/amplification_analysis_log.txt deleted file mode 100644 index fa48d50..0000000 --- a/_log/amplification_analysis_log.txt +++ /dev/null @@ -1,2 +0,0 @@ -Amplified Regions: -No amplification regions found. diff --git a/alg/ampf.py b/alg/ampf.py index bce4831..ec91869 100644 --- a/alg/ampf.py +++ b/alg/ampf.py @@ -1,13 +1,16 @@ -from Bio import SeqIO import os +from Bio import SeqIO -# Ścieżki do plików FASTA w katalogu ../data +# Ścieżki do katalogów i plików FASTA data_dir = "../data" -genome_file = os.path.join(data_dir, "genome.fasta") # Nazwa pliku FASTA dla genomu Fusarium solani +output_dir = "../out" +os.makedirs(output_dir, exist_ok=True) + +# Pliki primerów primer_ITS1_file = os.path.join(data_dir, "ITS1.fasta") primer_ITS4_file = os.path.join(data_dir, "ITS4.fasta") -# Wczytywanie sekwencji primerów z plików FASTA +# Funkcja do wczytywania sekwencji primerów z plików FASTA def load_primer(primer_file): record = SeqIO.read(primer_file, "fasta") return str(record.seq) @@ -39,25 +42,33 @@ def find_amplified_regions(genome_seq, primer_its1, primer_its4): break # Przerwij po znalezieniu pierwszego pasującego ITS4 po ITS1 return amplified_regions -# Wczytywanie primerów +# Wczytywanie primerów ITS1 i ITS4 primer_ITS1 = load_primer(primer_ITS1_file) primer_ITS4 = load_primer(primer_ITS4_file) -# Wczytywanie genomu z pliku FASTA -with open(genome_file) as f: - genome_record = SeqIO.read(f, "fasta") - genome_seq = str(genome_record.seq) +# Lista plików genomów do analizy +genome_files = [ + os.path.join(data_dir, filename) + for filename in ["217314860.fasta", "2187833333.fasta", "2813891763.fasta", "2813891767.fasta", "599088294.fasta"] +] -# Znajdowanie amplifikowanych regionów -amplified_regions = find_amplified_regions(genome_seq, primer_ITS1, primer_ITS4) +# Analiza amplifikacji dla każdego pliku genomu +for genome_file in genome_files: + with open(genome_file) as f: + genome_record = SeqIO.read(f, "fasta") + genome_seq = str(genome_record.seq) -# Zapis wyników -output_path = os.path.join(data_dir, "amplified_regions.txt") -with open(output_path, "w") as output_file: - output_file.write("Amplified Regions:\n") - for start, end, region in amplified_regions: - output_file.write(f"Start: {start}, End: {end}, Length: {len(region)}\n") - output_file.write(f"Region sequence: {region}\n\n") + # Znajdowanie amplifikowanych regionów + amplified_regions = find_amplified_regions(genome_seq, primer_ITS1, primer_ITS4) -print(f"Amplified regions saved to {output_path}") + # Zapis wyników dla każdego pliku genomu do ../out + output_filename = f"amplified_regions_{os.path.basename(genome_file)}.txt" + output_path = os.path.join(output_dir, output_filename) + with open(output_path, "w") as output_file: + output_file.write(f"Amplified Regions for {os.path.basename(genome_file)}:\n") + for start, end, region in amplified_regions: + output_file.write(f"Start: {start}, End: {end}, Length: {len(region)}\n") + output_file.write(f"Region sequence: {region}\n\n") + + print(f"Amplified regions for {os.path.basename(genome_file)} saved to {output_path}") diff --git a/out/amplified_regions_217314860.fasta.txt b/out/amplified_regions_217314860.fasta.txt new file mode 100644 index 0000000..0c00931 --- /dev/null +++ b/out/amplified_regions_217314860.fasta.txt @@ -0,0 +1 @@ +Amplified Regions for 217314860.fasta: diff --git a/out/amplified_regions_2187833333.fasta.txt b/out/amplified_regions_2187833333.fasta.txt new file mode 100644 index 0000000..cc53ce4 --- /dev/null +++ b/out/amplified_regions_2187833333.fasta.txt @@ -0,0 +1 @@ +Amplified Regions for 2187833333.fasta: diff --git a/out/amplified_regions_2813891763.fasta.txt b/out/amplified_regions_2813891763.fasta.txt new file mode 100644 index 0000000..2c2c4b8 --- /dev/null +++ b/out/amplified_regions_2813891763.fasta.txt @@ -0,0 +1 @@ +Amplified Regions for 2813891763.fasta: diff --git a/out/amplified_regions_2813891767.fasta.txt b/out/amplified_regions_2813891767.fasta.txt new file mode 100644 index 0000000..1d703bf --- /dev/null +++ b/out/amplified_regions_2813891767.fasta.txt @@ -0,0 +1 @@ +Amplified Regions for 2813891767.fasta: diff --git a/out/amplified_regions_599088294.fasta.txt b/out/amplified_regions_599088294.fasta.txt new file mode 100644 index 0000000..485ff64 --- /dev/null +++ b/out/amplified_regions_599088294.fasta.txt @@ -0,0 +1 @@ +Amplified Regions for 599088294.fasta: