Skip to content

Commit

Permalink
Merge pull request #132 from NAL-i5K/ncbi-pep-ids
Browse files Browse the repository at this point in the history
Ncbi pep ids
  • Loading branch information
mpoelchau authored Oct 17, 2023
2 parents 9b36c5c + e267f05 commit 7f2a81a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gff3tool/bin/gff3_to_fasta.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,11 @@ def splicer(gff, ftype, dline, stype, embedded_fasta=False):
cname = child['attributes']['Name']
defline='>{0:s}'.format(cid)
if stype == "pep":
cid = re.sub(r'(.+-)(R)([a-zA-Z]+)', r'\1P\3', cid)
for grandchild in child['children']: #first try to get the CDS protein_id
if 'protein_id' in grandchild['attributes']:
cid = grandchild['attributes']['protein_id']

cid = re.sub(r'(.+-)(R)([a-zA-Z]+)', r'\1P\3', cid)#otherwise, if it has the -R[A-Z] format then modify that to -P[A-Z]
defline = '>{0:s}'.format(cid)
elif ftype[0] == 'CDS':
defline='>{0:s}-CDS'.format(cid)
Expand Down

0 comments on commit 7f2a81a

Please sign in to comment.