Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6588047
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:59:49+00:00 2026-05-25T16:59:49+00:00

I have a fasta file (first sequence is mentioned below) with long description. I

  • 0

I have a fasta file (first sequence is mentioned below) with long description. I need to pick specific description fields. when i used following code; whole description get into string.

from Bio import SeqIO

for record in SeqIO.parse("geneTemp.fasta", "fasta") :
    id=record.id
    desc=record.description

print desc

Is there any easy way to get the description fields (using biopython libraries) into array and picking specific fields without taking the description into string and spiting the string?

Code output

Python 2.7 (r27:82500, Sep 16 2010, 18:03:06) 
[GCC 4.5.1 20100907 (Red Hat 4.5.1-3)] on localhost.localdomain, Standard
>>> FBgn0197520 type=gene; loc=scaffold_12855:complement(6241650..6242111); ID=FBgn0197520; name=Dvir\GJ10233; dbxref=FlyBase_Annotation_IDs:GJ10233,FlyBase:FBgn0197520,GLEANR:dvir_GLEANR_10171,EntrezGene:6632532,GB_protein:EDW59542,FlyMine:FBgn0197520,OrthoDB4.Arthropods:FBgn0242841,OrthoDB4.Arthropods:FBgn0213090,OrthoDB4.Arthropods:FBgn0190974,OrthoDB4.Arthropods:FBgn0165423,OrthoDB4.Arthropods:FBgn0247590,OrthoDB4.Arthropods:FBgn0149779,OrthoDB4.Arthropods:FBgn0146205,OrthoDB4.Arthropods:FBgn0017456,OrthoDB4.Arthropods:FBgn0126736,OrthoDB4.Arthropods:FBgn0117264,OrthoDB4.Arthropods:FBgn0094317; MD5=0b7e859d2a6eca028ffd16b964835705; length=462; release=r1.2; species=Dvir;
 loc=scaffold_12855:complement(6241650..6242111)

One of the sequences from fasta file.

>FBgn0207418 type=gene; loc=scaffold_12875:complement(14361770..14363857); ID=FBgn0207418; name=Dvir\GJ20278; dbxref=FlyBase_Annotation_IDs:GJ20278,FlyBase:FBgn0207418,GLEANR:dvir_GLEANR_5721,EntrezGene:6625684,GB_protein:EDW61510,FlyMine:FBgn0207418,OrthoDB4.Arthropods:NV16422,OrthoDB4.Arthropods:LH16819,OrthoDB4.Arthropods:ISCW000548,OrthoDB4.Arthropods:FBgn0239668,OrthoDB4.Arthropods:FBgn0219970,OrthoDB4.Arthropods:FBgn0181866,OrthoDB4.Arthropods:FBgn0175499,OrthoDB4.Arthropods:FBgn0080765,OrthoDB4.Arthropods:FBgn0155230,OrthoDB4.Arthropods:FBgn0141947,OrthoDB4.Arthropods:FBgn0033392,OrthoDB4.Arthropods:FBgn0127494,OrthoDB4.Arthropods:FBgn0102879,OrthoDB4.Arthropods:FBgn0090125,OrthoDB4.Arthropods:CPIJ005729,OrthoDB4.Arthropods:GB15324,OrthoDB4.Arthropods:AGAP012336,OrthoDB4.Arthropods:AAEL007395,OrthoDB4.Arthropods:PB24927,OrthoDB4.Arthropods:PHUM365660,OrthoDB4.Arthropods:GLEAN_06039; MD5=4c62b751ec045ac93306ce7c08d254f9; length=2088; release=r1.2; species=Dvir; 
ATGCGTCTGCGACGCCGCTGGCATCGGCGGATGCGGCGTACAATTGAGAA
AATCTATCGCCTTAAAATGCAATCGCGCCGCAAGTTGGTTTACTTAGCCG
TATTTGGAGCACTATGCGTAATATTCTGGCTGGCTGGACAGCAGTTGCTG
ACGACTTCGAATGGTCACTACAGTAGCTACTACGGCGAAACGCATTGTGC
GCCCATTGATGCCGTATACACCTGGGTAAATGGTTCGGATCCGGATTTTA
TTGAGTCCATTAGACGCTACGATGCCAGCTACGATCCGTCGCGCTTCGAC
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:59:50+00:00Added an answer on May 25, 2026 at 4:59 pm

    The description part of FASTA is not standard. You can use regex to parse it.

    >>> import re
    >>> desc = 'FBgn0207418 type=gene; loc=scaffold_12875:complement(14361770..14363857); ...'
    >>> fields = dict(re.findall(r'(\w+)=(.*?);', desc))
    >>> fields['type']
    'gene'
    >>> fields['length']
    '2088'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a tab-delimited text file that I am parsing. Its first column contains
I have two excel files. First excel file contains the Person Name and Total
First and foremost-- I have a file of strings. The smallest file is about
I have a particular csv file with the following data: uid Business Area employeeNumber
I have the following in my .Zshrc . /Users/Masi/bin/Zsh/prompt I need run the following
I read in a text file that is tab delimited, i then have a
I need to develop an application where two csv files are compared. The first
I have a file whose contents are of the form: .2323 1 .2327 1
I have few Gigabytes text file in format: {user_ip:x.x.x.x, action_type:xxx, action_data:{some_key:some_value...},...} each entry is
I have a text file with a list of macro names (one per line).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.