Skip to content

Commit

Permalink
Change --add_chr to --human_chr
Browse files Browse the repository at this point in the history
  • Loading branch information
Haibao Tang committed Oct 13, 2023
1 parent b2f009c commit e5f037a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions jcvi/formats/gff.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
)
multiple_gff_attributes = ("Parent", "Alias", "Dbxref", "Ontology_term")
safechars = " /:?~#+!$'@()*[]|"
VALID_HUMAN_CHROMOSMES = set([str(x) for x in range(1, 23)] + ["X", "Y"])


class GffLine(object):
Expand Down Expand Up @@ -3022,10 +3023,10 @@ def bed(args):
help="Parent gene key to group with --primary_only",
)
p.add_option(
"--add_chr",
"--human_chr",
default=False,
action="store_true",
help="Add `chr` prefix to seqid",
help="Only allow 1-22XY, and add `chr` prefix to seqid",
)
p.add_option(
"--ensembl_cds",
Expand All @@ -3047,7 +3048,7 @@ def bed(args):
span = opts.span
primary_only = opts.primary_only
parent_key = opts.parent_key
add_chr = opts.add_chr
human_chr = opts.human_chr
ensembl_cds = opts.ensembl_cds
if opts.type:
type = set(x.strip() for x in opts.type.split(","))
Expand Down Expand Up @@ -3089,7 +3090,9 @@ def bed(args):
bl.accn = accn
if span:
bl.score = bl.span
if add_chr:
if human_chr:
if bl.seqid not in VALID_HUMAN_CHROMOSMES:
continue
bl.seqid = "chr" + bl.seqid
if ensembl_cds:
bl.accn = "{0}.{1}".format(
Expand Down

0 comments on commit e5f037a

Please sign in to comment.