Hi everyone!
I wrote a script that worked in the past, but suddenly it does not work and I have no idea why.
Here is my script:
#!/bin/bash
#This script gets damage seq bed files of 4 nucleotides and filters only those with dipyrimidins in 2-3 position.
_pwd=$PWD
#hg-19 ref genome.
genome_path="/hg_19_ref_genome.fa"
#Scans all the damage seq given bed files.
for bedFile in $_pwd/*.bed
do
#Removes duplicates lines.
sort -u -o $bedFile $bedFile
#Sorts the files according to chromosome and coordinates.
sort -k1,1 -k2,2n -o $bedFile $bedFile
name=`basename $bedFile`
#Adjusts the fasta file name.
faName="${name%.bed*}.fa"
bedtools getfasta -s -fi $genome_path -bed $bedFile -name -fo $_pwd/fasta_files/$faName #Gets the sequence itself.
done
#Scans all the obtained fasta files.
for faFile in $_pwd/fasta_files/*.fa
do
name=`basename $faFile`
faOutput="${name}"
bedOutput="${name%.fa*}.bed"
#Filters the files for getting only those which contain dypirimidne in 2-3 columns.
cat $faFile |\
paste - - |\
awk 'toupper(substr($2,2,2)) ~ /^(TT|TC|CT|CC)$/' |\
tr "\t" "\n" |\
tee $_pwd/filtered_fasta/$faOutput |\
awk -F '[>():-]' '/^>/ {printf("%s\t%s\t%s\t%s\t%s\t%s\n",$4,$5,$6,$2,$2,$7);}' > $_pwd/filtered_bed/$bedOutput
done
When I run it, I get this error:
line 30: : command not found
where line 30 is this line:
tee $_pwd/filtered_fasta/$faOutput |\
I have no idea why this error occurs, it worked fine before.
I really hope someone can help me with that issue.
UPDATE: I deleted all the '' and it works fine now.