Question: How to write a proper bed file to extract sequence?
0
gravatar for saadleeshehreen
12 months ago by
saadleeshehreen70 wrote:

Hi, I have manually created a bed file to extract the sequences from a fasta file. But it is showing the following error message. How can I solve it?

-bash-4.2$ cat pAcr_extract.bed
PSE305_1 20001 20479
PSE305_1 20306 20479
PSE305_1 20001 20303
AZPAE14907_contig_18_1 20001 20479
AZPAE14907_contig_18_1 20001 20303
WH-SGI-V-07178_contig3_1 20001 20303
WH-SGI-V-07178_contig3_1 20306 20479
bash-4.2$ bedtools getfasta -fi pAcr_extract.fasta -bed pAcr_extract.bed  -fo pAcr_extract.fasta.out
 It looks as though you have less than 3 columns at line: 1.  Are you sure your files are tab-delimited?
ADD COMMENTlink modified 12 months ago by mike-zx140 • written 12 months ago by saadleeshehreen70
1
gravatar for mike-zx
12 months ago by
mike-zx140
mike-zx140 wrote:

bedtools is complaining about your file not being tab-delimited, try the following on your file if you have awk in your terminal to avoid making it again manually with tabs since I'm assuming its a big file:

cat pAcr_extract.bed | awk 'BEGIN{OFS="\t";} {print $1,$2,$3;}' > pAcr_extract_tab.bed

now try using bedools again with the newly created file in the -bed option.

ADD COMMENTlink modified 12 months ago • written 12 months ago by mike-zx140

Here a more general way for converting one ore more whitespaces into tabs using sed.

$ sed 's/  \+/\t/g' input > output

fin swimmer

ADD REPLYlink written 12 months ago by finswimmer12k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1274 users visited in the last hour