Bowtie2 simple alignment errors?
1
0
Entering edit mode
4.7 years ago
vctrm67 ▴ 50

I'm new to Bowtie2 and have been trying to run some simple alignments in Bowtie2. My current bash script looks like this:

index_path= '/path/to/index/hg19_bt2'
read_path_1= 'path/to/read1.fastq.gz'
read_path_2= '/path/to/read2.fastq.gz'

module load gcc/6.2.0
module load bowtie2/2.3.4.3
bowtie2 -x $index_path -1 $read_path_1 -2 $read_path_2 -S bowtie2_test.sam

However, it gives me these errors: 1. For my compressed fastq files:

"cannot execute binary file"

2. For my command line input:

"-S" does not exist or is not a Bowtie 2 index

I'm not sure what is wrong with my script because I followed the Bowtie2 manual.

bowtie bowtie2 alignment • 1.6k views
ADD COMMENT
0
Entering edit mode
4.7 years ago
h.mon 35k

The space between the variable name and the string you want to assign to it means bash will not interpret this as an assignment to a variable, it will interpret it as a command followed by a parameter to this command. See Spaces in variable assignments in shell scripts. Hence all variables are undefined and you command translates to:

bowtie2 -x  -1  -2  -S bowtie2_test.sam
ADD COMMENT
0
Entering edit mode

I see, thank you. So I should have instead this?

index_path='/path/to/index/hg19_bt2'
read_path_1='path/to/read1.fastq.gz'
read_path_2='/path/to/read2.fastq.gz'

module load gcc/6.2.0
module load bowtie2/2.3.4.3
bowtie2 -x $index_path -1 $read_path_1 -2 $read_path_2 -S bowtie2_test.sam

Do you know why bowtie2 doesn't work with my -S flag to denote the output file?

ADD REPLY
0
Entering edit mode

Is that still not working after you fixed the variable assignment issue? Do you have permissions to write to the directory you are executing this script from? If you don't, then provide a different location in -S /path_to/*.sam in the command above.

ADD REPLY
0
Entering edit mode

I will double check, but here is the list of errors I am recieving now:

   Line 14: /path/to/index/hg19_bt2: No such file or directory
   Line 15: /path/to/read1.fastq.gz: cannot execute binary file
   Line 16: /path/to/read2.fastq.gz: cannot execute binary file
    (ERR): "-S" does not exist or is not a Bowtie 2 index
    Exiting now ...
ADD REPLY
0
Entering edit mode

You are using real/full paths to those files correct? /path/to/index/ is just place holder and needs to be replaced with actual file paths on your server.

ADD REPLY
0
Entering edit mode

Yes. And I do have write access, as I built a bowtie2 index in the same directory using another script.

ADD REPLY
0
Entering edit mode

Can you post the command you used to build the index? Is hg19_bt2 basename for your index files?

ADD REPLY
0
Entering edit mode
module load gcc/6.2.0
module load bowtie2/2.3.4.3
bowtie2-build -f '/path/referenceGenomes/hg19_ucsc.fa' 'hg19_ucsc'
ADD REPLY
0
Entering edit mode

Your basename for the index is hg19_ucsc. So you should set

index_path='/path/to/index/hg19_ucsc'

ADD REPLY
0
Entering edit mode

This is not the same index that I used in the previous script. Previously, I used a premade script from some one else; here, I am just making my own separately.

ADD REPLY
0
Entering edit mode

Based on the information you provided above hg19_ucsc should be the basename for the index you built. Can you show us output of du -sh hg19_ucsc or if that does not produce anything the a listing of directory where you think the index is present.

Are you sure the index creation worked without any errors?

ADD REPLY

Login before adding your answer.

Traffic: 3187 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6