Ejemplo n.º 1
0
 def test_gbk(self):
     log = open(os.path.join(self.test_folder, "test.log"), "w")
     g_h = open(os.path.join(self.test_folder, "test.gbk"), "w")
     g_h.write(self.example.gbk_file)
     g_h.close()
     get_input.get_file(None, self.test_folder, "gbk", log)
     self.assertTrue("NC_007795.1.gbk" in os.listdir(self.test_folder))
     log.close()
Ejemplo n.º 2
0
 def test_fasta(self):
     log = open(os.path.join(self.test_folder, "test.log"), "w")
     f_h = open(os.path.join(self.test_folder, "test.fasta"), "w")
     f_h.write(self.example.fasta_file)
     f_h.close()
     get_input.get_file(None, self.test_folder, "fna", log)
     self.assertTrue("aa.fa" in os.listdir(self.test_folder))
     log.close()
Ejemplo n.º 3
0
 def test_gff(self):
     log = open(os.path.join(self.test_folder, "test.log"), "w")
     g_h = open(os.path.join(self.test_folder, "test.gff"), "w")
     g_h.write(self.example.gff_file)
     g_h.close()
     get_input.get_file(None, self.test_folder, "gff", log)
     self.assertTrue("ddd.gff" in os.listdir(self.test_folder))
     log.close()
Ejemplo n.º 4
0
 def test_gbk(self):
     log = open(os.path.join(self.test_folder, "test.log"), "w")
     g_h = open(os.path.join(self.test_folder, "test.gbk"), "w")
     g_h.write(self.example.gbk_file)
     g_h.close()
     get_input.get_file(None, self.test_folder, "gbk", log)
     self.assertTrue("NC_007795.1.gbk" in os.listdir(self.test_folder))
     log.close()
Ejemplo n.º 5
0
 def test_gff(self):
     log = open(os.path.join(self.test_folder, "test.log"), "w")
     g_h = open(os.path.join(self.test_folder, "test.gff"), "w")
     g_h.write(self.example.gff_file)
     g_h.close()
     get_input.get_file(None, self.test_folder, "gff", log)
     self.assertTrue("ddd.gff" in os.listdir(self.test_folder))
     log.close()
Ejemplo n.º 6
0
 def test_fasta(self):
     log = open(os.path.join(self.test_folder, "test.log"), "w")
     f_h = open(os.path.join(self.test_folder, "test.fasta"), "w")
     f_h.write(self.example.fasta_file)
     f_h.close()
     get_input.get_file(None, self.test_folder, "fna", log)
     self.assertTrue("aa.fa" in os.listdir(self.test_folder))
     log.close()
Ejemplo n.º 7
0
 def get_input(self):
     """Download required files from website."""
     print("Running get input files")
     if self._args.ftp_path is None:
         print("Error: Please assign the path for downloading the data!")
         sys.exit()
         annotation_folder = self._paths.ref_annotation_folder
         fasta_folder = self._paths.ref_fasta_folder
     self.helper.check_make_folder(self._paths.ref_annotation_folder)
     self.helper.check_make_folder(self._paths.ref_fasta_folder)
     if self._args.ref_gff is True:
         get_file(self._args.ftp_path, self._paths.ref_annotation_folder,
                  "gff")
         get_file(self._args.ftp_path, self._paths.ref_annotation_folder,
                  "_genomic.gff.gz")
     if self._args.ref_fasta is True:
         get_file(self._args.ftp_path, self._paths.ref_fasta_folder,
                  "fna")
         get_file(self._args.ftp_path, self._paths.ref_fasta_folder,
                  "_genomic.fna.gz")
     if self._args.ref_gbk is True:
         get_file(self._args.ftp_path, self._paths.ref_annotation_folder,
                  "gbk")
         get_file(self._args.ftp_path, self._paths.ref_annotation_folder,
                  "gbff")
         get_file(self._args.ftp_path, self._paths.ref_annotation_folder,
                  "_genomic.gbff.gz")
     if self._args.ref_ptt is True:
         get_file(self._args.ftp_path, self._paths.ref_annotation_folder,
                  "ptt")
     if self._args.ref_rnt is True:
         get_file(self._args.ftp_path, self._paths.ref_annotation_folder,
                  "rnt")
     if self._args.convert_embl is True:
         annotation_files = os.listdir(self._paths.ref_annotation_folder)
         if len(annotation_files) == 0:
             sys.stdout.write("No gff files!!\n")
         else:
             Converter().convert_gbk2embl(self._paths.ref_annotation_folder)
Ejemplo n.º 8
0
 def get_input(self):
     """Download required files from website."""
     print("Running get input files...")
     if self._args.FTP_path is None:
         print("Error: Please assign the path for downloading the data!!")
         sys.exit()
     if self._args.for_target:
         annotation_folder = self._paths.tar_annotation_folder
         fasta_folder = self._paths.tar_fasta_folder
     else:
         annotation_folder = self._paths.ref_annotation_folder
         fasta_folder = self._paths.ref_fasta_folder
     self.helper.check_make_folder(annotation_folder)
     self.helper.check_make_folder(fasta_folder)
     if self._args.ref_gff is True:
         get_file(self._args.FTP_path, annotation_folder,
                  "gff", self._args.for_target)
         get_file(self._args.FTP_path, annotation_folder,
                  "_genomic.gff.gz", self._args.for_target)
     if self._args.ref_fasta is True:
         get_file(self._args.FTP_path, fasta_folder,
                  "fna", self._args.for_target)
         get_file(self._args.FTP_path, fasta_folder,
                  "_genomic.fna.gz", self._args.for_target)
     if self._args.ref_gbk is True:
         get_file(self._args.FTP_path, annotation_folder,
                  "gbk", self._args.for_target)
         get_file(self._args.FTP_path, annotation_folder,
                  "gbff", self._args.for_target)
         get_file(self._args.FTP_path, annotation_folder,
                  "_genomic.gbff.gz", self._args.for_target)
     if self._args.ref_ptt is True:
         get_file(self._args.FTP_path, annotation_folder,
                  "ptt", self._args.for_target)
     if self._args.ref_rnt is True:
         get_file(self._args.FTP_path, annotation_folder,
                  "rnt", self._args.for_target)
     if self._args.convert_embl is True:
         annotation_files = os.listdir(annotation_folder)
         if len(annotation_files) == 0:
             sys.stdout.write("No gbk files!!\n")
         else:
             Converter().convert_gbk2embl(annotation_folder)