Ejemplo n.º 1
0
  def test_visit_features_node_feature_ignored(self, embl_feature_mock):
    converter = EMBLConverter(None)

    feature_node = self.mock_feature_node(1, 'ignored_type', 1, 100, '', {'attr_k1': 'attr_v1'})
    embl_feature_mock.return_value.format.return_value = None
    converter.visit_feature_node(feature_node)
    self.assertEqual(converter.contigs, {})
Ejemplo n.º 2
0
  def test_visit_features_node_feature_included(self, embl_feature_mock):
    converter = EMBLConverter(None)

    feature_node = self.mock_feature_node(1, 'type_1', 1, 100, '', {'attr_k1': 'attr_v1'})
    embl_feature_mock.return_value.format.return_value = 'Feature_string'
    converter.visit_feature_node(feature_node)
    self.assertEqual(converter.contigs.keys(), [1])
    self.assertIsInstance(converter.contigs[1], EMBLContig)
Ejemplo n.º 3
0
    def test_visit_features_node_feature_ignored(self, embl_feature_mock):
        converter = EMBLConverter(None)

        feature_node = self.mock_feature_node(1, 'ignored_type', 1, 100, '',
                                              {'attr_k1': 'attr_v1'})
        embl_feature_mock.return_value.format.return_value = None
        converter.visit_feature_node(feature_node)
        self.assertEqual(converter.contigs, {})
Ejemplo n.º 4
0
    def test_visit_features_node_feature_included(self, embl_feature_mock):
        converter = EMBLConverter(None)

        feature_node = self.mock_feature_node(1, 'type_1', 1, 100, '',
                                              {'attr_k1': 'attr_v1'})
        embl_feature_mock.return_value.format.return_value = 'Feature_string'
        converter.visit_feature_node(feature_node)
        self.assertEqual(converter.contigs.keys(), [1])
        self.assertIsInstance(converter.contigs[1], EMBLContig)
Ejemplo n.º 5
0
  def test_visit_features_node_two_different_features(self, embl_feature_mock):
    converter = EMBLConverter(None)

    feature_node = self.mock_feature_node(1, 'type_1', 1, 100, '', {'attr_k1': 'attr_v1'})
    embl_feature_mock.return_value.format.return_value = 'Feature_string'
    converter.visit_feature_node(feature_node)

    feature_node = self.mock_feature_node(2, 'type_2', 101, 200, '', {'attr_k1': 'attr_v1'})
    embl_feature_mock.return_value.format.return_value = "Another_feature_string"
    converter.visit_feature_node(feature_node)
    self.assertEqual(converter.contigs.keys(), [1, 2])
    self.assertIsInstance(converter.contigs[1], EMBLContig)
    self.assertIsInstance(converter.contigs[2], EMBLContig)
Ejemplo n.º 6
0
 def __init__(self,
              gff3_file,
              organism,
              taxonid,
              project,
              description,
              authors,
              title,
              publication,
              genome_type,
              classification,
              output_filename,
              locus_tag=None,
              translation_table=11,
              chromosome_list=None):
     self.locus_tag = locus_tag
     self.translation_table = translation_table
     self.conv = EMBLConverter(locus_tag, translation_table)
     self.gff3_file = gff3_file
     self.organism = organism
     self.taxonid = taxonid
     self.project = project
     self.authors = authors
     self.title = title
     self.publication = publication
     self.genome_type = genome_type
     self.classification = classification
     self.output_filename = output_filename
     self.chromosome_list = chromosome_list
     self.fixed_gff_file = str(self.gff3_file) + "_fixed.gff"
Ejemplo n.º 7
0
    def test_visit_features_node_two_different_features(
            self, embl_feature_mock):
        converter = EMBLConverter(None)

        feature_node = self.mock_feature_node(1, 'type_1', 1, 100, '',
                                              {'attr_k1': 'attr_v1'})
        embl_feature_mock.return_value.format.return_value = 'Feature_string'
        converter.visit_feature_node(feature_node)

        feature_node = self.mock_feature_node(2, 'type_2', 101, 200, '',
                                              {'attr_k1': 'attr_v1'})
        embl_feature_mock.return_value.format.return_value = "Another_feature_string"
        converter.visit_feature_node(feature_node)
        self.assertEqual(converter.contigs.keys(), [1, 2])
        self.assertIsInstance(converter.contigs[1], EMBLContig)
        self.assertIsInstance(converter.contigs[2], EMBLContig)