Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change --add_chr to --human_chr #605

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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