import P0.Seq0 as Seq0 gene_folder = "./sequences/" gene_list = ["U5", "ADA", "FRAT1", "FXN"] print("------|EXERCISE 8|------") for gene in gene_list: seq = Seq0.seq_read_fasta(gene_folder + gene + ".txt") bases_count = Seq0.seq_count(seq) print("Gene " + gene + ": Most frequent base: " + str(Seq0.max_base(bases_count)))
import P0.Seq0 as Seq0 GENE_FOLDER = "./Sequences/" gene_list = ["U5", "ADA", "FRAT1", "FXN"] print("------| Exercise 5 |------") for gene in gene_list: seq = Seq0.seq_read_fasta(GENE_FOLDER + gene + ".txt") print("Gene " + gene + ":", Seq0.seq_count(seq))
import P0.Seq0 as Seq0 FOLDER = "./Sequences/" ID = "U5.txt" U5_Seq = Seq0.seq_read_fasta(FOLDER + ID) print("The first 20 bases are:", U5_Seq[0:19])
import P0.Seq0 as Seq0 FOLDER = "./sequences/" id = "U5.txt" U5_seq = Seq0.seq_read_fasta(FOLDER + id) print("------|EXERCISE 6|------") print("Gene U5:") U5_seq_correct = U5_seq[0:20] print("Frag: ", U5_seq_correct) print("Rev:", Seq0.seq_reverse(U5_seq_correct))
import P0.Seq0 as Seq0 FOLDER = "./sequences/" id = "U5.txt" U5_seq = Seq0.seq_read_fasta(FOLDER + id) print("The first 20 bases are: ", U5_seq[0:20])
import P0.Seq0 as Seq0 FOLDER = "./sequences/" id = "U5.txt" U5_seq = Seq0.seq_read_fasta(FOLDER + id) print("------|EXERCISE 7|------") print("Gene U5:") U5_seq_correct = U5_seq[0:20] print("Frag: ", U5_seq_correct) print("Rev:", Seq0.seq_complement(U5_seq_correct))
import P0.Seq0 as Seq0 gene_folder = "./Sequences/" gene_list = ["U5", "ADA", "PRAT1", "FXN"] print("-----| Exercise 3 |------") for gene in gene_list: sequence = Seq0.seq_read_fasta(gene_folder + gene + ".txt") print("Gene " + gene + "---------> Length:" + str(Seq0.seq_len(sequence)))
import P0.Seq0 as seq0 print("We are testing Seq0 module") seq0.seq_ping()
import P0.Seq0 as Seq0 FOLDER = "./Sequences/" ID = "U5.txt" U5_Seq = Seq0.seq_read_fasta(FOLDER + ID) print("------| Exercise 7 |------\nGene U5:\nFrag:", U5_Seq[0:19], "\nComp:", Seq0.seq_complement(U5_Seq[0:19]))
import P0.Seq0 as Seq0 GENE_FOLDER = "./Sequences/" gene_list = ["U5", "ADA", "FRAT1", "FXN"] print("------| Exercise 3 |------") for gene in gene_list: seq = Seq0.seq_read_fasta(GENE_FOLDER + gene + ".txt") print("Gene " + gene + " ---> ", Seq0.seq_len(seq))
import P0.Seq0 as Seq0 gene_folder = "./Sequences/" gene_list = ["U5", "ADA", "PRAT1", "FXN"] print("-----| Exercise 5 |------") for gene in gene_list: sequence = Seq0.seq_read_fasta(gene_folder + gene + ".txt") print("Gene ", gene, ":", Seq0.seq_count(sequence))
import P0.Seq0 as Seq0 gene_folder = "./sequences/" gene_list = ["U5", "ADA", "FRAT1", "FXN"] print("------|EXERCISE 5|------") for gene in gene_list: seq = Seq0.seq_read_fasta(gene_folder + gene + ".txt") print("Gene " + gene + ": " + str(Seq0.seq_count(seq)))
import P0.Seq0 as Seq0 gene_folder = "./Sequences/" gene_list = ["U5", "ADA", "PRAT1", "FXN"] b = ["A", "C", "T", "G"] l = [] print("-----| Exercise 8 |------") for gene in gene_list: sequence = Seq0.seq_read_fasta(gene_folder + gene + ".txt") print("Gene " + gene) for base in b: bases = Seq0.seq_count_base(sequence, base) l.append(bases) print(base + ":", bases)
import P0.Seq0 as Seq0 FOLDER = "./Sequences/" ID = "U5.txt" U5_Seq = Seq0.seq_read_fasta(FOLDER + ID) print("------| Exercise 6 |------\nGene U5:\nFrag:", U5_Seq[0:19], "\nRev:", Seq0.seq_reverse(U5_Seq[0:19]))
import P0.Seq0 as Seq0 GENE_FOLDER = "./Sequences/" gene_list = ["U5", "ADA", "FRAT1", "FXN"] base_list = ["A", "C", "T", "G"] print("------| Exercise 4 |------") for gene in gene_list: seq = Seq0.seq_read_fasta(GENE_FOLDER + gene + ".txt") print("\nGene " + gene) for base in base_list: print(base + ":", Seq0.seq_count_base(seq, base))
import P0.Seq0 as Seq0 FOLDER = "./Sequences/U5.txt" U5_Seq = Seq0.seq_read_fasta(FOLDER) print("-----| Exercise 6 |------") print("Gene U5:") print("Frag:" + U5_Seq[0:20]) print("Rev:" + str(Seq0.seq_reverse(U5_Seq[0:20])))
import P0.Seq0 as Seq0 print("We are testing Seq0 module") Seq0.seq_ping()
import P0.Seq0 as Seq0 gene_folder = "./sequences/" gene_list = ["U5", "ADA", "FRAT1", "FXN"] base_list = ["A", "C", "T", "G"] print("------|EXERCISE 4|------") for gene in gene_list: seq = Seq0.seq_read_fasta(gene_folder + gene + ".txt") print("Gene", gene) for base in base_list: print(base + ": " + str(Seq0.seq_count_base(seq, base)))
import P0.Seq0 as Seq0 # o tambien si marcamos P0 como sources root, import Seq 0 """Implement the seq_read_fasta(filename) function, que tiene que leer y almacenar y devolver el body de un archivo FASTA. The head is removed, as well as the '\n' characters. This function should be written in the Seq0.py file. Write a python program for opening the U5.txt file and writing into the console the first 20 bases of the sequence""" FOLDER = './sequences/' #Un solo punto significa dentro de la carpeta en el que tenemos este archivo, dos puntos significan dentro de PNE PRACTICES (la carpeta padre del anterior), y asi... ID = 'ADA.txt' U5_Seq = Seq0.seq_read_fasta( FOLDER + ID ) #Quita la primera línea de código, almacena el body de un fasta y lo devuelve. print('The first 20 bases are: ', U5_Seq[0:20])
import P0.Seq0 as Seq0 gene_folder = "./Sequences/" U5 = "U5" ADA = "ADA" PRAT1 = "PRAT1" FXN = "FXN" base = ["A", "C", "G", "T"] sequence_U5 = Seq0.seq_read_fasta(gene_folder + U5 + ".txt") bases = Seq0.seq_count(sequence_U5) l_U5 = [] for a in bases: l_U5.append(bases[a]) U5_h = l_U5.index(max(l_U5)) sequence_ADA = Seq0.seq_read_fasta(gene_folder + ADA + ".txt") bases2 = Seq0.seq_count(sequence_ADA) l_ADA = [] for b in bases2: l_ADA.append(bases2[b]) ADA_h = l_ADA.index(max(l_ADA)) sequence_PRAT1 = Seq0.seq_read_fasta(gene_folder + PRAT1 + ".txt") bases3 = Seq0.seq_count(sequence_U5) l_PRAT1 = [] for c in bases3: l_PRAT1.append(bases3[c]) PRAT1_h = l_PRAT1.index(max(l_PRAT1)) sequence_FXN = Seq0.seq_read_fasta(gene_folder + FXN + ".txt") bases4 = Seq0.seq_count(sequence_FXN)
import P0.Seq0 as Seq0 FOLDER = "./Sequences/U5.txt" U5_Seq = Seq0.seq_read_fasta(FOLDER) print("-----| Exercise 7 |------") print("Gene U5:") print ("Frag:" + U5_Seq[0: 20]) print ("Comp:" + str(Seq0.seq_complement(U5_Seq[0: 20])))
import P0.Seq0 as Seq0 GENE_FOLDER = "./Sequences/" gene_list = ["U5", "ADA", "FRAT1", "FXN"] base_list = ["A", "C", "T", "G"] print("------| Exercise 8 |------") for gene in gene_list: seq = Seq0.seq_read_fasta(GENE_FOLDER + gene + ".txt") sort_freq = sorted(Seq0.seq_count(seq).items(), key=lambda item: item[1], reverse=True) print("Gene " + gene + " most frequent base:", sort_freq[0][0])