Beispiel #1
0
 def test_parse_genome_data_10(self):
     """Verify output when seq is False."""
     url = "https://phagesdb.org/media/fastas/L5.fasta"
     filename = Path(url).stem
     data_dict = {
         "phage_name": "Trixie",
         "pcluster": {
             "cluster": "A"
         },
         "psubcluster": {
             "subcluster": "A2"
         },
         "isolation_host": {
             "genus": "Mycobacterium"
         },
         "genbank_accession": "ABC123",
         "fasta_file": url
     }
     self.gnm = phagesdb.parse_genome_data(data_dict,
                                           gnm_type="phagesdb",
                                           seq=False)
     with self.subTest():
         self.assertEqual(self.gnm.filename, filename)
     with self.subTest():
         self.assertEqual(self.gnm.seq, "")
     with self.subTest():
         self.assertEqual(self.gnm.description, "")
     with self.subTest():
         self.assertEqual(self.gnm._description_name, "")
     with self.subTest():
         self.assertEqual(self.gnm._description_host_genus, "")
Beispiel #2
0
 def test_parse_genome_data_1(self):
     """Verify genome object is parsed from PhagesDB."""
     url = "https://phagesdb.org/media/fastas/L5.fasta"
     filename = Path(url).stem
     data_dict = {
         "phage_name": "Trixie",
         "pcluster": {
             "cluster": "A"
         },
         "psubcluster": {
             "subcluster": "A2"
         },
         "isolation_host": {
             "genus": "Mycobacterium"
         },
         "genbank_accession": "ABC123",
         "fasta_file": url
     }
     self.gnm = phagesdb.parse_genome_data(data_dict,
                                           gnm_type="phagesdb",
                                           seq=True)
     with self.subTest():
         self.assertEqual(self.gnm.name, "Trixie")
     with self.subTest():
         self.assertEqual(self.gnm.id, "Trixie")
     with self.subTest():
         self.assertEqual(self.gnm.cluster, "A")
     with self.subTest():
         self.assertEqual(self.gnm.subcluster, "A2")
     with self.subTest():
         self.assertEqual(self.gnm.host_genus, "Mycobacterium")
     with self.subTest():
         self.assertEqual(self.gnm.accession, "ABC123")
     with self.subTest():
         self.assertEqual(self.gnm.filename, filename)
     with self.subTest():
         self.assertEqual(self.gnm.seq[:8], "GGTCGGTT")
     with self.subTest():
         self.assertEqual(self.gnm.seq[-8:], "GTCGGTTA")
     with self.subTest():
         self.assertIsInstance(self.gnm.seq, Seq)
     with self.subTest():
         self.assertEqual(self.gnm.description, "Mycobacterium phage L5")
     with self.subTest():
         self.assertEqual(self.gnm._description_name, "L5")
     with self.subTest():
         self.assertEqual(self.gnm._description_host_genus, "Mycobacterium")
     with self.subTest():
         self.assertEqual(self.gnm.type, "phagesdb")
     with self.subTest():
         self.assertIsInstance(self.gnm.misc, dict)
Beispiel #3
0
 def test_parse_genome_data_6(self):
     """Verify output when there is no genbank_accession key."""
     url = "https://phagesdb.org/media/fastas/L5.fasta"
     data_dict = {
         "phage_name": "Trixie",
         "pcluster": {
             "cluster": "A"
         },
         "psubcluster": {
             "subcluster": "A2"
         },
         "isolation_host": {
             "genus": "Mycobacterium"
         },
         "genbank_accession_x": "ABC123",
         "fasta_file": url
     }
     self.gnm = phagesdb.parse_genome_data(data_dict, gnm_type="phagesdb")
     self.assertEqual(self.gnm.accession, "")
Beispiel #4
0
 def test_parse_genome_data_9(self):
     """Verify output when there are multiple errors."""
     url = "https://phagesdb.org/media/fastas/L5.fasta"
     data_dict = {
         "phage_name": "Trixie",
         "pcluster_x": {
             "cluster": "A"
         },
         "psubcluster_x": {
             "subcluster": "A2"
         },
         "isolation_host_x": {
             "genus": "Mycobacterium"
         },
         "genbank_accession_x": "ABC123",
         "fasta_file_x": url
     }
     self.gnm = phagesdb.parse_genome_data(data_dict, seq=True)
     with self.subTest():
         self.assertEqual(self.gnm.name, "Trixie")
     with self.subTest():
         self.assertEqual(self.gnm.id, "Trixie")
     with self.subTest():
         self.assertEqual(self.gnm.cluster, "")
     with self.subTest():
         self.assertEqual(self.gnm.subcluster, "")
     with self.subTest():
         self.assertEqual(self.gnm.host_genus, "")
     with self.subTest():
         self.assertEqual(self.gnm.accession, "")
     with self.subTest():
         self.assertEqual(self.gnm.filename, "")
     with self.subTest():
         self.assertEqual(self.gnm.seq, "")
     with self.subTest():
         self.assertEqual(self.gnm.description, "")
     with self.subTest():
         self.assertEqual(self.gnm._description_name, "")
     with self.subTest():
         self.assertEqual(self.gnm._description_host_genus, "")
     with self.subTest():
         self.assertEqual(self.gnm.type, "")