Go Back   SEQanswers > Bioinformatics > Bioinformatics

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to extract the longest sequence from a fasta file clarissaboschi Bioinformatics 7 09-21-2017 06:36 AM
How to Extract Multiple Sequence from Multi Fasta File by ID list Anti Bioinformatics 4 02-02-2015 04:02 AM
How to get mouse multiple sequence alignments in fasta format emanlee Bioinformatics 0 05-26-2014 05:44 AM
adapters sequence fasta file mmmm Bioinformatics 14 12-12-2013 10:39 PM
How do I extract partial sequence data (Fasta) from multiple hits in NCBI nucleotide? andtill Bioinformatics 1 11-09-2012 12:49 PM

Thread Tools
Old 12-04-2019, 12:06 PM   #1
Location: Florida

Join Date: Jun 2014
Posts: 11
Default Recover only longest version of sequence from multiple sequence fasta file - help

I have a large list of fasta sequences (not paired end) from which I want to isolate the longest version of each "sequence" (obviously the longest one has a different sequence). For example:





I tried a number of approaches using a mock dataset containing mismatches, exact copies, and known truncations from either end of the long form - "test_dups.fa":

(1) in SAMtools test_dups.fa test_dups_dedupe.fa outd=test_dups_removed.fa

this didn't work: its output didn't make sense, and an exact duplicate pair was removed completely (didn't leave behind one of them, which is bad news).

(2) with the ac=f option test_dups.fa test_dups_dedupe.fa outd=test_dups_removed.fa ac=f

that only removed the exact copy pair, again not leaving one copy in file.

(3) clustering by overlap test_dups.fa test_dups_dedupe.fa outd=test_dups_removed.fa ac=f mo=50 c pc csf=stats.txt outbest=test_best.fa mcs=1

didn't work (retained were not longest examples).

Then I moved on to VSEARCH, to sort by size, then form clusters and output the "seed":

(4) vsearch clustering
--cluster_fast dups.fa --centroids test_unique_1.0.fa --id 1.0
oddly, this kept a truncation of the longest sequence, but was close...

(5) using the iddef = 0, to ignore end gaps
vsearch --cluster_fast dups.fa --centroids test_unique_1.0.fa --id 1.0 --iddef 0

this did not ignore the end gaps penalties as expected.

(6) Align two seqs and see what the perceived idenity is
vsearch --allpairs_global dups_9_10.fa --acceptall --alnout test_aln.fa --iddef 0

the resulting alignment shows 100% identity, as expected with the iddef 0 option.

Why are those sequences not in the same cluster then?

Searching for help on "remove duplicates" is a disaster here, so I hope I can get some help. One consideration is to merge the sequences with 100% identity for the "overlap", but those tools merge from one end of the read, as is used to combine paired end reads. The other consideration is spending a day writing a script. I reasoned I can not be the first person to do this.
sdmoore is offline   Reply With Quote
Old 12-10-2019, 04:32 AM   #2
Senior Member
Location: Switzerland

Join Date: Aug 2008
Posts: 124

What I will do is to write my own script to
1) blastn the sequences against itself (hopefully your sequences are long enough to justify using blast)
2) filter the results to remove blastn results of the same sequences and min e-value
3) Do single linkage clustering based on the blastn results
4) Choose the longest sequence for each cluster

There should be an easier way by using k-mer?!
Melissa is offline   Reply With Quote
Old 12-29-2019, 09:01 PM   #3
Location: florida

Join Date: Jan 2013
Posts: 67

have you tried CD-hit?
yzzhang is offline   Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -8. The time now is 09:51 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO