Home > Enterprise >  python code is not showing result in colab
python code is not showing result in colab

Time:09-23

please let me know what is the issue with the below code. It is not showing result but the same code is showing result in vscode

from Bio import SeqIO
import os, glob
folder_path = 'D:/MAJU/Sem3/Thesis-I/DataSet/536_stentrophomonas_maltophilia-Copy2'
fasta_paths = glob.glob(os.path.join(folder_path, '*.fasta'))
for fasta_path in fasta_paths:
    print(fasta_path)
    for seq_record in SeqIO.parse(fasta_path, "fasta"):
        print(seq_record.id)
        print(seq_record.seq)

CodePudding user response:

You are trying to read from your file system while using colab, you have to upload your files there and use the correct path. If you upload by drag and drop the files will be listed under the /content/ directory

CodePudding user response:

As Lorenzo has suggested, you have to upload your file/files/folder to Google Drive and read it from there because CoLab can't read your local files. You can find out how to attach your google drive to CoLab here: https://stackoverflow.com/a/52300696/15443747

Cheers!

  • Related