Hi
I have a list of contigs and want to extract one contig (by its title). What is the exact command for that?
Thanks!
Hi
I have a list of contigs and want to extract one contig (by its title). What is the exact command for that?
Thanks!
This has already been addressed as Giovanni pointed out:
Please try at least a cursory search of the site before posting a new question!
Default grep can't find multiline patterns.
You can use pcregrep.
If you want to extract multiple contigs at different times, it is highly suggested that you build an index. Here some commands:
samtools faidx in.fasta #(create an index for the fasta file with all the contigs)
samtools faidx in.fasta contigname > contigname.fasta #(extract the single contig you need)
#to extract seqnames from MS blast result(seqtool) files:
grep contigname filename > out.txt
If you need more lines from contig add -A number after grep like: (for 3 lines)
grep -A 3 contigname filename > out.txt
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
if your contig file is in fasta format, there are a lot of discussion already open. Have a search in the archives.