def get_gtf():
    """
    Download GTF file from Ensembl, only keeping the chr17 entries.
    """
    size, md5, url = GTF
    full_gtf = os.path.join(args.data_dir, os.path.basename(url))
    subset_gtf = os.path.join(
        args.data_dir,
        os.path.basename(url).replace('.gtf.gz', '_%s.gtf' % CHROM))

    if not _up_to_date(md5, subset_gtf):
        download(url, full_gtf)
        cmds = [
            'zcat', '<',
            full_gtf,
            '|', 'awk -F "\\t" \'{if ($1 == "%s") print $0}\''
            % CHROM.replace('chr', ''),
            '|', 'awk \'{print "chr"$0}\'', '>', subset_gtf]

        logged_command(cmds)
def get_gtf ( ) : size , md5 , url = GTF full_gtf = os . path . join ( args . data_dir , os . path . basename ( url ) ) subset_gtf = os . path . join ( args . data_dir , os . path . basename ( url ) . replace ( '.gtf.gz' , '_%s.gtf' % CHROM ) ) if not _up_to_date ( md5 , subset_gtf ) : download ( url , full_gtf ) cmds = [ 'zcat' , '<' , full_gtf , '|' , 'awk -F "\\t" \'{if ($1 == "%s") print $0}\'' % CHROM . replace ( 'chr' , '' ) , '|' , 'awk \'{print "chr"$0}\'' , '>' , subset_gtf ] logged_command ( cmds )
Download GTF file from Ensembl, only keeping the chr17 entries.