-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
801 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env python | ||
|
||
r""" | ||
Extract genes with promoters BED files from GTF file | ||
""" | ||
|
||
import argparse | ||
import pathlib | ||
|
||
import scglue | ||
|
||
|
||
def parse_args() -> argparse.Namespace: | ||
r""" | ||
Parse command line arguments | ||
""" | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
"--input-gtf", dest="input_gtf", type=pathlib.Path, required=True, | ||
help="Path to input GTF file" | ||
) | ||
parser.add_argument( | ||
"--promoter-len", dest="promoter_len", type=int, default=2000, | ||
help="Promoter length" | ||
) | ||
parser.add_argument( | ||
"--output-bed", dest="output_bed", type=pathlib.Path, required=True, | ||
help="Path to output BED file" | ||
) | ||
return parser.parse_args() | ||
|
||
|
||
def main(args: argparse.Namespace): | ||
r""" | ||
Main function | ||
""" | ||
gtf = scglue.genomics.read_gtf(args.input_gtf).query("feature == 'gene'").split_attribute() | ||
bed = gtf.to_bed(name="gene_name").expand(args.promoter_len, 0) | ||
bed = bed.drop_duplicates(subset=["chrom", "chromStart", "chromEnd"]) | ||
bed.write_bed(args.output_bed, ncols=6) | ||
|
||
|
||
if __name__ == "__main__": | ||
main(parse_args()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
python extract_genes_promoters.py --input-gtf gencode.v19.chr_patch_hapl_scaff.annotation.gtf.gz --output-bed gencode.v19.chr_patch_hapl_scaff.genes_with_promoters.bed | ||
python extract_genes_promoters.py --input-gtf gencode.v35.chr_patch_hapl_scaff.annotation.gtf.gz --output-bed gencode.v35.chr_patch_hapl_scaff.genes_with_promoters.bed | ||
python extract_genes_promoters.py --input-gtf gencode.vM10.chr_patch_hapl_scaff.annotation.gtf.gz --output-bed gencode.vM10.chr_patch_hapl_scaff.genes_with_promoters.bed | ||
python extract_genes_promoters.py --input-gtf gencode.vM25.chr_patch_hapl_scaff.annotation.gtf.gz --output-bed gencode.vM25.chr_patch_hapl_scaff.genes_with_promoters.bed | ||
LC_ALL=C sort -k1,1 -k2,2n -k3,3n gencode.v19.chr_patch_hapl_scaff.genes_with_promoters.bed > gencode.v19.chr_patch_hapl_scaff.genes_with_promoters.sorted.bed | ||
LC_ALL=C sort -k1,1 -k2,2n -k3,3n gencode.v35.chr_patch_hapl_scaff.genes_with_promoters.bed > gencode.v35.chr_patch_hapl_scaff.genes_with_promoters.sorted.bed | ||
LC_ALL=C sort -k1,1 -k2,2n -k3,3n gencode.vM10.chr_patch_hapl_scaff.genes_with_promoters.bed > gencode.vM10.chr_patch_hapl_scaff.genes_with_promoters.sorted.bed | ||
LC_ALL=C sort -k1,1 -k2,2n -k3,3n gencode.vM25.chr_patch_hapl_scaff.genes_with_promoters.bed > gencode.vM25.chr_patch_hapl_scaff.genes_with_promoters.sorted.bed |
Oops, something went wrong.