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

  • Home
  • SEARCH
  • 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 8782673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:37:35+00:00 2026-06-13T20:37:35+00:00

so i have a program which fetches a bunch of sequences from a database

  • 0

so i have a program which fetches a bunch of sequences from a database and downloads them into a fasta file. the problem is that these sequences could be proteins or they could be dna. i’m splitting the large fasta file into many small fasta files and once i have the sequences, i need them all to be proteins. so i want to test each one to see if it’s protein.

if they’re all proteins, i’m fine, and if they’re all dna, i have an elegant way to translate them all, but i need to find a way to test each new fasta file, translate it and have the translation replace the dna file

here’s what i have so far:

from Bio import Entrez, SeqIO  
from Bio.Seq import Seq

record_iter = SeqIO.parse(open(output_file), 'fasta')
for seq_record in record_iter:
    outfile = '{0}.fa'.format(seq_record.id)
    count = SeqIO.write(seq_record,outfile,'fasta')
    xmlfile = '{0}.xml'.format(seq_record.id)
    print xmlfile   # Added this to show it's working, not stalled.
    if...
    #and here is where i would somehow test each "outfile" to see if it's dna or protein and then do something different with each one.  

i’ve tried setting it to a string (i think), and i can’t use alphabets, because that’s not how the fasta is formatted, and i’ve tried a bunch of other things. anyway, any help would be appreciated.

just for those who aren’t familiar, a fasta file is of the following format:

>here is a bunch of identification information about the sequence after the carat.
GAAATTTGAGGCGTTCGCTGTGCAGTGAAAAGTGAGACTTTCTACTGTTCGCGTAGAAAGTGCAATAACC
AAGCCACCCACTCAGTGCCCAGACTAGCAACACAAGTCCGGCAAAATGGGAATCAAGTTCCTGGAAGTTA
TCAAACCGTTCTGCAGTATACTGCCGGAAATCGCAAAACCGGAGCGCAAGATCCAATTCAGGGAGAAAGT
GCTATGGACTGCGATCACCCTGTTCATCTTCCTGGTGTGCTGCCAGATCCCGCTTTTCGGTATCATGAGC
TCAGACTCGGCGGATCCCTTCTACTGGATCCGTGTGATCCTGGCCTCCAACCGTGGTACGCTCATGGAGC
TGGGTATCTCGCCCATCGTGACCTCTGGCCTCATTATGCAGCTGCTGGCCGGAGCA
  • 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-06-13T20:37:37+00:00Added an answer on June 13, 2026 at 8:37 pm

    I’m not familiar with the library, but I think the way you’re suggesting is written as:

    if all(c.upper() in 'ATGC' for c in seq_record.seq):
        pass # it's DNA
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program which fetches records from database (using Hibernate) and fills them
I basically have this program which fetches orders from a database. My problem is
Ok I have created a program which saves text into settings file. So at
I have socket program which sends a file from socket client to socket server
I have program which writes to database which folders are full or empty. Now
i have program which prints all char from char_min to char_max here is code
I have a program which writes to a .log file as it is installing
I have a program which accepts 2 N -digit numbers, multiplies them using threads
I have a sample application which loads 2 records ro database and then fetches
I am trying to program an App that fetches files from a server. I

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.