Example #1
0
    def __init__(self, cleaned_data):
        # skip sequences with accession numbers and building GenBank Fasta file
        self.sequences_skipped = []
        self.cleaned_data = cleaned_data
        self.translations = None
        self.degen_translations = None
        self.clean_translations()

        self.errors = []
        self.seq_objs = []
        self.minimum_number_of_genes = cleaned_data['number_genes']
        self.aminoacids = cleaned_data['aminoacids']

        try:
            self.codon_positions = clean_positions(cleaned_data['positions'])
        except exceptions.InadequateCodonPositions as e:
            self.codon_positions = None
            self.errors = [e]

        self.file_format = cleaned_data['file_format']
        self.partition_by_positions = cleaned_data['partition_by_positions']
        self.voucher_codes = get_voucher_codes(cleaned_data)
        self.gene_codes = get_gene_codes(cleaned_data)
        self.gene_codes_and_lengths = None
        self.taxon_names = cleaned_data['taxon_names']
        self.voucher_codes_metadata = dict()
        self.gene_codes_metadata = self.get_gene_codes_metadata()
        self.warnings = []
        self.outgroup = cleaned_data['outgroup']
        self.dataset_file = None
        self.aa_dataset_file = None
        self.charset_block = None
        self.dataset_str = self.create_dataset()
Example #2
0
    def __init__(self, cleaned_data):
        # skip sequences with accession numbers and building GenBank Fasta file
        self.sequences_skipped = []
        self.cleaned_data = cleaned_data
        self.translations = None
        self.degen_translations = None
        self.clean_translations()

        self.errors = []
        self.seq_objs = []
        self.minimum_number_of_genes = cleaned_data['number_genes']
        self.aminoacids = cleaned_data['aminoacids']

        try:
            self.codon_positions = clean_positions(cleaned_data['positions'])
        except exceptions.InadequateCodonPositions as e:
            self.codon_positions = None
            self.errors = [e]

        self.file_format = cleaned_data['file_format']
        self.partition_by_positions = cleaned_data['partition_by_positions']
        self.voucher_codes = get_voucher_codes(cleaned_data)
        self.gene_codes = get_gene_codes(cleaned_data)
        self.gene_codes_and_lengths = None
        self.taxon_names = cleaned_data['taxon_names']
        self.voucher_codes_metadata = dict()
        self.gene_codes_metadata = self.get_gene_codes_metadata()
        self.warnings = []
        self.outgroup = cleaned_data['outgroup']
        self.dataset_file = None
        self.aa_dataset_file = None
        self.charset_block = None
        self.dataset_str = self.create_dataset()
Example #3
0
    def __init__(self, cleaned_data):
        self.cleaned_data = cleaned_data
        self.translations = None
        self.degen_translations = None
        self.clean_translations()

        self.errors = []
        self.seq_objs = []
        self.minimum_number_of_genes = cleaned_data["number_genes"]
        self.aminoacids = cleaned_data["aminoacids"]

        try:
            self.codon_positions = clean_positions(cleaned_data["positions"])
        except exceptions.InadequateCodonPositions as e:
            self.codon_positions = None
            self.errors = [e]

        self.file_format = cleaned_data["file_format"]
        self.partition_by_positions = cleaned_data["partition_by_positions"]
        self.voucher_codes = get_voucher_codes(cleaned_data)
        self.gene_codes = get_gene_codes(cleaned_data)
        self.gene_codes_and_lengths = None
        self.taxon_names = cleaned_data["taxon_names"]
        self.voucher_codes_metadata = dict()
        self.gene_codes_metadata = self.get_gene_codes_metadata()
        self.warnings = []
        self.outgroup = cleaned_data["outgroup"]
        self.dataset_file = None
        self.aa_dataset_file = None
        self.charset_block = None
        self.dataset_str = self.create_dataset()
Example #4
0
    def test_clean_positions(self):
        self.assertEqual(clean_positions(["ALL", "1st"]), ["ALL"], 'Has "ALL" in list.')
        self.assertEqual(clean_positions(["ALL", "2nd"]), ["ALL"], 'Has "ALL" in list.')
        self.assertEqual(clean_positions(["ALL", "3rd"]), ["ALL"], 'Has "ALL" in list.')
        self.assertEqual(clean_positions(["ALL", "1st", "2nd"]), ["ALL"], 'Has "ALL" in list.')
        self.assertEqual(clean_positions(["ALL", "1st", "3rd"]), ["ALL"], 'Has "ALL" in list.')
        self.assertEqual(clean_positions(["ALL", "2nd", "3rd"]), ["ALL"], 'Has "ALL" in list.')
        self.assertEqual(clean_positions(["ALL", "1st", "2nd", "3rd"]), ["ALL"], 'Has "ALL" in list.')

        self.assertEqual(clean_positions(["1st", "2nd", "3rd"]), ["ALL"], "All codon positions were required.")
        self.assertEqual(clean_positions(["1st", "2nd"]), ["1st-2nd"], "Only some codon positions were required.")
        self.assertRaises(exceptions.InadequateCodonPositions, clean_positions, ["1st", "3rd"])
        self.assertRaises(exceptions.InadequateCodonPositions, clean_positions, ["2nd", "3rd"])

        self.assertEqual(clean_positions(["1st"]), ["1st"], "All codon positions were required.")
        self.assertEqual(clean_positions(["2nd"]), ["2nd"], "All codon positions were required.")
        self.assertEqual(clean_positions(["3rd"]), ["3rd"], "All codon positions were required.")
Example #5
0
    def test_clean_positions(self):
        self.assertEqual(clean_positions(['ALL', '1st']), ['ALL'],
                         'Has "ALL" in list.')
        self.assertEqual(clean_positions(['ALL', '2nd']), ['ALL'],
                         'Has "ALL" in list.')
        self.assertEqual(clean_positions(['ALL', '3rd']), ['ALL'],
                         'Has "ALL" in list.')
        self.assertEqual(clean_positions(['ALL', '1st', '2nd']), ['ALL'],
                         'Has "ALL" in list.')
        self.assertEqual(clean_positions(['ALL', '1st', '3rd']), ['ALL'],
                         'Has "ALL" in list.')
        self.assertEqual(clean_positions(['ALL', '2nd', '3rd']), ['ALL'],
                         'Has "ALL" in list.')
        self.assertEqual(clean_positions(['ALL', '1st', '2nd', '3rd']),
                         ['ALL'], 'Has "ALL" in list.')

        self.assertEqual(clean_positions(['1st', '2nd', '3rd']), ['ALL'],
                         'All codon positions were required.')
        self.assertEqual(clean_positions(['1st', '2nd']), ['1st-2nd'],
                         'Only some codon positions were required.')
        self.assertRaises(exceptions.InadequateCodonPositions, clean_positions,
                          ['1st', '3rd'])
        self.assertRaises(exceptions.InadequateCodonPositions, clean_positions,
                          ['2nd', '3rd'])

        self.assertEqual(clean_positions(['1st']), ['1st'],
                         'All codon positions were required.')
        self.assertEqual(clean_positions(['2nd']), ['2nd'],
                         'All codon positions were required.')
        self.assertEqual(clean_positions(['3rd']), ['3rd'],
                         'All codon positions were required.')