Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BioMidge
    Junior Member
    • Jul 2014
    • 4

    #1

    Download BOLD sequences with R and remove duplicates

    Hello,

    I am using the package bold in R to download COI sequences from BOLD and specifying the taxon of interest and the marker like this:

    bold_seq(taxon='Chironomidae', marker='COI-5P', response=TRUE) as well as
    bold_seq(taxon = 'Chironomidae', marker = "COX1", response = TRUE)

    for which I get a fasta file. When I tried to format a database in BLAST (makeblastdb) using this file I got an error that duplicate IDs were present. I looked inside the fasta and found that the duplicates
    were sequences of the same organism one from COI-5P and another from CAD, for example:

    >CHRSV056-08|Cricotopus glacialis|CAD
    CTGGCGTCAAAAGTATAAGCTCGCTGAGTGGATGAAGAAGCACAACGTCGTTGGAATCAGTGGAATTGACACC...
    >CHRSV056-08|Cricotopus glacialis|COI-5P|KC130785
    AACATTATATTTTATTTTCGGGGCTTGATCAGGGATAGTAGGAACTTCCTTAAGAATCTTAATTCGAGCTGAA...

    and there's plenty of them. I can't removed them all one by one. There's like 160k sequences in this file.
    Any idea how I can remove duplicate ID+seq from the fasta file or any way to fix the R comand to avoid getting sequences from other genes?
    thanks
  • GenoMax
    Senior Member
    • Feb 2008
    • 7142

    #2
    You could replace the spaces in the names with an underscore and see if that gets you past the "duplicate" name problem.

    Code:
    $ sed 's/ /\_/g' your_file > new_file
    The example you posted has "duplicate" names since makeblastdb stops at the first space it encounters in the name. The sequences themselves are not duplicates.
    Last edited by GenoMax; 06-24-2015, 01:23 PM.

    Comment

    • BioMidge
      Junior Member
      • Jul 2014
      • 4

      #3
      Hello,

      if I understand correctly, if I replaced the spaces with an _ using sed, wouldnt this happen on all the IDs and basically end up with duplicate IDs again only with underscores?
      Yes, the sequences are not the same (different genes) so a "duplicate sequence" removal wouldnt work because they are not really duplicates.
      Maybe a command that can look up the IDs and remove the ones with CAD? Is there something like that? But it should take the sequence out too..

      Comment

      • GenoMax
        Senior Member
        • Feb 2008
        • 7142

        #4
        So you are saying that for each entry there is a CAD and a COI-5P. If you just want to take out all entries with "CAD" then something simple like

        Code:
        $ cat your_file | grep -A 1 "COI-5P" > new_file
        should work, as long as your file has sequences that don't wrap around on multiple lines.

        BTW: With the two line example you posted "makeblastdb" did not generate an error for me.

        Comment

        Latest Articles

        Collapse

        • SEQadmin2
          Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
          by SEQadmin2



          Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

          Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
          ...
          10-14-2026, 09:55 AM
        • SEQadmin2
          New Genomics Technologies Take Aim at Long-Standing Limits
          by SEQadmin2


          Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

          We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
          ...
          09-28-2026, 10:25 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by SEQadmin2, 10-22-2026, 11:13 AM
        0 responses
        46 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-22-2026, 10:48 AM
        0 responses
        34 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-15-2026, 10:52 AM
        0 responses
        46 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 10-14-2026, 05:39 AM
        0 responses
        46 views
        0 reactions
        Last Post SEQadmin2  
        Working...