Beispiel #1
0
    def add(self):
        adder = Add()

        if self.args['one_sample'] is not None:
            new_sample = [tuple(entry.strip('}').strip('{').strip(',').split(':')) for entry in self.args['one_sample']]
            new_sample = dict(new_sample)

            adder.add_one_sample(new_sample)
            if len(self.args['email']) > 0:

                if not sampleinfo_mongo.is_fully_annotated(new_sample['SAMPLE']):
                    annotate = Annotate()
                    annotate.annotate_sample(new_sample['SAMPLE'], 'orig')

                output_files = Output()
                final_file = output_files.sample_variants_csv(new_sample['SAMPLE'], 'orig')

                message = "Here are all the variants for the sample %s with their QC status." % new_sample['SAMPLE']
                for address in self.args['email']:
                    self.__log_sending_email(address)
                    output_bash.email_file(message, final_file, address)

        elif self.args['sample_info'] is not None:

            adder.add_sample_info(self.args['sample_info'])
Beispiel #2
0
    def output(self):
        if self.args['type'] == 'sample':
            if not sampleinfo_mongo.is_fully_annotated(self.args['name']):
                annotate = Annotate()
                annotate.annotate_sample(self.args['name'], 'orig')

            output_files = Output()
            output_files.sample_variants_csv(self.args['name'], 'orig')
Beispiel #3
0
    def output(self):
        # The output option handler that will write the sample_variants_csv containing important information about
        # the sample variants.

        if self.args['type'] == 'sample':

            if self.args['name'] == "all":
                output_files = Output()
                output_files.output_all_variants()
            else:

                if not sampleinfo_mongo.is_fully_annotated(self.args['name']):
                    annotate = Annotate()
                    annotate.annotate_sample(self.args['name'], 'orig')

                output_files = Output()

                output_files.sample_variants_csv(self.args['name'], 'orig')
Beispiel #4
0
    def add(self):
        """
        This carries out the appropriate operation if add is selected from the parser.
        :return:
        """
        adder = Add()

        # This is the adding procedure performed for when one sample is added from the command line.
        if self.args['one_sample'] is not None:
            new_sample = [tuple(entry.strip('}').strip('{').strip(',').split(':')) for entry in self.args['one_sample']]
            new_sample = dict(new_sample)

            # The adder actually adds the sample to the database.
            adder.add_one_sample(new_sample)

            # This is what is carried out if an email is desired, it will actually peform an additional
            # annotation to make sure that the result has all of the necessary information.
            if len(self.args['email']) > 0:

                if not sampleinfo_mongo.is_fully_annotated(new_sample['SAMPLE']):
                    annotate = Annotate()
                    annotate.annotate_sample(new_sample['SAMPLE'], 'orig')

                output_files = Output()
                final_file = output_files.sample_variants_csv(new_sample['SAMPLE'], 'orig')

                # This actually carries out the emailing.
                message = "Here are all the variants for the sample %s with their QC status." % new_sample['SAMPLE']
                for address in self.args['email']:
                    self.__log_sending_email(address)
                    output_bash.email_file(message, final_file, address)

        # This is how the samples are added from a  file of many samples.
        elif self.args['sample_info'] is not None:

            adder.add_sample_info(self.args['sample_info'])