bin/reference_data.py
def prepare_metadata(self):
        """Initial preparation of the genome metadata that will be uploaded to the REST API."""
        self.payload.update({
            'tools_used': {
                'picard': self.check_stderr([self.tools['picard'], 'CreateSequenceDictionary', '--version']),
                'tabix': self.check_stderr([self.tools['tabix']]).split('\n')[0].split(' ')[1],
                'bwa': self.check_stderr([self.tools['bwa']]).split('\n')[1].split(' ')[1],
                'bgzip': self.check_stderr([self.tools['bgzip']]).split('\n')[1].split(' ')[1],
                'samtools': self.check_stdout([self.tools['samtools'], '--version']).split('\n')[0].split(' ')[1],
                'gatk': self.check_stdout(['java', '-jar', self.tools['gatk'], '--version'])
            },
            'data_source': self.data_source,
            'data_files': {
                'fasta': os.path.join(self.rel_data_dir, os.path.basename(self.reference_fasta)),
            }
        })
        if self.reference_variation:
            self.payload['data_files']['variation'] = os.path.join(
                self.rel_data_dir, os.path.basename(self.reference_variation)
            )

        if 'faidx' in self.procs:
            self.procs['faidx'].wait()
        defaults = {}
        if os.path.exists(self.reference_fasta + '.fai'):
            genome_size, chromosome_count = self.genome_param_from_fai_file(self.reference_fasta + '.fai')
            defaults = {
                'genome_size': genome_size,
                'chromosome_count': chromosome_count,
                'goldenpath': genome_size
            }
        for field in ('chromosome_count', 'genome_size', 'goldenpath'):
            if field not in self.payload or self.payload[field] is None:
                msg = 'Enter a value to use for %s.' % field
                if field in defaults:
                    msg += ' (%s)' % defaults[field]
                value = input(msg) or defaults.get(field)
                if value:
                    self.payload[field] = int(value)
Initial preparation of the genome metadata that will be uploaded to the REST API.
Initial preparation of the genome metadata that will be uploaded to the REST API.
Initial preparation of the genome metadata that will be uploaded to the REST API .
def prepare_metadata(self):
        self.payload.update({
            'tools_used': {
                'picard': self.check_stderr([self.tools['picard'], 'CreateSequenceDictionary', '--version']),
                'tabix': self.check_stderr([self.tools['tabix']]).split('\n')[0].split(' ')[1],
                'bwa': self.check_stderr([self.tools['bwa']]).split('\n')[1].split(' ')[1],
                'bgzip': self.check_stderr([self.tools['bgzip']]).split('\n')[1].split(' ')[1],
                'samtools': self.check_stdout([self.tools['samtools'], '--version']).split('\n')[0].split(' ')[1],
                'gatk': self.check_stdout(['java', '-jar', self.tools['gatk'], '--version'])
            },
            'data_source': self.data_source,
            'data_files': {
                'fasta': os.path.join(self.rel_data_dir, os.path.basename(self.reference_fasta)),
            }
        })
        if self.reference_variation:
            self.payload['data_files']['variation'] = os.path.join(
                self.rel_data_dir, os.path.basename(self.reference_variation)
            )
        if 'faidx' in self.procs:
            self.procs['faidx'].wait()
        defaults = {}
        if os.path.exists(self.reference_fasta + '.fai'):
            genome_size, chromosome_count = self.genome_param_from_fai_file(self.reference_fasta + '.fai')
            defaults = {
                'genome_size': genome_size,
                'chromosome_count': chromosome_count,
                'goldenpath': genome_size
            }
        for field in ('chromosome_count', 'genome_size', 'goldenpath'):
            if field not in self.payload or self.payload[field] is None:
                msg = 'Enter a value to use for %s.' % field
                if field in defaults:
                    msg += ' (%s)' % defaults[field]
                value = input(msg) or defaults.get(field)
                if value:
                    self.payload[field] = int(value)
def prepare_metadata ( self ) : self . payload . update ( { 'tools_used' : { 'picard' : self . check_stderr ( [ self . tools [ 'picard' ] , 'CreateSequenceDictionary' , '--version' ] ) , 'tabix' : self . check_stderr ( [ self . tools [ 'tabix' ] ] ) . split ( '\n' ) [ 0 ] . split ( ' ' ) [ 1 ] , 'bwa' : self . check_stderr ( [ self . tools [ 'bwa' ] ] ) . split ( '\n' ) [ 1 ] . split ( ' ' ) [ 1 ] , 'bgzip' : self . check_stderr ( [ self . tools [ 'bgzip' ] ] ) . split ( '\n' ) [ 1 ] . split ( ' ' ) [ 1 ] , 'samtools' : self . check_stdout ( [ self . tools [ 'samtools' ] , '--version' ] ) . split ( '\n' ) [ 0 ] . split ( ' ' ) [ 1 ] , 'gatk' : self . check_stdout ( [ 'java' , '-jar' , self . tools [ 'gatk' ] , '--version' ] ) } , 'data_source' : self . data_source , 'data_files' : { 'fasta' : os . path . join ( self . rel_data_dir , os . path . basename ( self . reference_fasta ) ) , } } ) if self . reference_variation : self . payload [ 'data_files' ] [ 'variation' ] = os . path . join ( self . rel_data_dir , os . path . basename ( self . reference_variation ) ) if 'faidx' in self . procs : self . procs [ 'faidx' ] . wait ( ) defaults = { } if os . path . exists ( self . reference_fasta + '.fai' ) : genome_size , chromosome_count = self . genome_param_from_fai_file ( self . reference_fasta + '.fai' ) defaults = { 'genome_size' : genome_size , 'chromosome_count' : chromosome_count , 'goldenpath' : genome_size } for field in ( 'chromosome_count' , 'genome_size' , 'goldenpath' ) : if field not in self . payload or self . payload [ field ] is None : msg = 'Enter a value to use for %s.' % field if field in defaults : msg += ' (%s)' % defaults [ field ] value = input ( msg ) or defaults . get ( field ) if value : self . payload [ field ] = int ( value )
Initial preparation of the genome metadata that will be uploaded to the REST API.
Initial preparation of the genome metadata that will be uploaded to the REST API .
"""Initial preparation of the genome metadata that will be uploaded to the REST API."""
self