e888f185c3877e7c34aa6fa7d65e684fe872e867,anvio/contigops.py,GenbankToAnvio,sanity_check,#GenbankToAnvio#,243

Before Change


        filesnpaths.is_file_exists(self.input_genbank_path)

        try:
            SeqIO.parse(open(self.input_genbank_path, "r"), "genbank")
        except Exception as e:
            raise ConfigError("Someone didn"t like your unput "genbank" file :/ Here"s what they said\
                               about it: "%s"." % e)

After Change




    def sanity_check(self):
        if self.output_file_prefix and (self.output_fasta_path or self.output_functions_path or self.output_gene_calls_path):
            raise ConfigError("Your arguments contain an output file prefix, and other output file paths. You can either\
                               define a prefix, and the output files would be named accordingly (such as "PREFIX-extenral-gene-calls",\
                               "PREFIX-external-functions.txt", and "PREFIX-contigs.fa"), ORRR you can set output file names\
                               or paths for each of these files independently. You can also leave it as is for default file names to\
                               be used. But you can"t mix everything together and confuse us here.")

        self.output_fasta_path = self.output_fasta_path or "contigs.fa"
        self.output_functions_path = self.output_functions_path or "external-functions.txt"
        self.output_gene_calls_path = self.output_gene_calls_path or "external-gene-calls.txt"

        if self.output_file_prefix:
            J = lambda x: "-".join([self.output_file_prefix, x])
            self.output_fasta_path = J(self.output_fasta_path)
            self.output_functions_path = J(self.output_functions_path)
            self.output_gene_calls_path = J(self.output_gene_calls_path)

        filesnpaths.is_output_file_writable(self.output_fasta_path)
        filesnpaths.is_output_file_writable(self.output_functions_path)
        filesnpaths.is_output_file_writable(self.output_gene_calls_path)
        filesnpaths.is_file_exists(self.input_genbank_path)

        files_already_exist = [f for f in [self.output_fasta_path, self.output_functions_path, self.output_gene_calls_path] if os.path.exists(f)]
        if len(files_already_exist):
            raise ConfigError("Some of the output files already exist :/ Anvi"o feels uneasy about simply overwriting\
                               them and would like to outsource that risk to you. Please either use different output\
                               file names, or delete these files and come back: "%s"" % (", ".join(files_already_exist)))


    def process(self):
        self.sanity_check()

        output_fasta = {}
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: merenlab/anvio
Commit Name: e888f185c3877e7c34aa6fa7d65e684fe872e867
Time: 2018-12-16
Author: a.murat.eren@gmail.com
File Name: anvio/contigops.py
Class Name: GenbankToAnvio
Method Name: sanity_check


Project Name: commonsense/conceptnet5
Commit Name: 322d70ddf4964e7eb85334d695038ff0db7514a8
Time: 2014-02-28
Author: rob@luminoso.com
File Name: conceptnet5/builders/combine_assertions.py
Class Name:
Method Name: combine_assertions


Project Name: okfn-brasil/serenata-de-amor
Commit Name: 3baf62ba607a95dcb0d5971594389d3586286ef6
Time: 2016-12-06
Author: andresouzapinho@gmail.com
File Name: src/fetch_foursquare_info.py
Class Name:
Method Name: