I think your title was not very clear ;-)
And the threshold of "similarity" is a problem here.
Are you searching for exact matches ?
Hello I have two fasta files with different IDs which belongs to the two genotypes . first fasta file Consists of 100 contigs while second file include 100,000 contigs. I want to extranct the same contigs of first file from second file. I thank you for your suggestions.
Thank you
Assuming you have sequence as one string (Otherwise linearize both fasta files)
sed '/^>/d' file_1.fa | while read -r line; do grep -B 1 "$line" file_2.fa >> foo.res.txt; done
With this approach you don't need to worry if the headers are different for same contig in 2 files. If the header is same in two files, you can proceed with faSomeRecords as mentioned in other answers.
Dear Janey, Hi
You can create a list fo your 100 IDs (a text file, each ID in a new line, it is your listFile) and then use some script/tools same as faSomeRecords to extract the sequences of those IDs from the 100,000 contig file (which is now in.fa):
./faSomeRecords in.fa listFile out.fa
Hope I get your point correctly
~ Best
thanks for answers of my friends but i need tool or software that finally tell me: ID: 23 from file 1 has similar seuence to ID; 666 from file 2
I think your title was not very clear ;-)
And the threshold of "similarity" is a problem here.
Are you searching for exact matches ?
hi farbod yes about 98-100% similarity
Then just search the second file (think of it as "reference") using the first using any NGS aligner (and look for 100% matches?). bowtie v.1 may be the best tool if these are raw Illumina sequences.
Hi, How about zipped fastq files? zgrep command is not working. :/
Log in to answer this question.
Hi,
You can convert your 100,000 contig fasta to tsv using fasta_formatter from the FASTX-Toolkit
Then use grep with the --file option to supply your text file (list of 100 IDs) of patterns.
You cane use Galaxy, too.