Question: Bowtie2 simple alignment errors?
0
gravatar for vctrm67
4 months ago by
vctrm6710
vctrm6710 wrote:

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 alignment bowtie2 • 236 views
ADD COMMENTlink modified 4 months ago by h.mon28k • written 4 months ago by vctrm6710
0
gravatar for h.mon
4 months ago by
h.mon28k
Brazil
h.mon28k wrote:

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 COMMENTlink written 4 months ago by h.mon28k

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 REPLYlink written 4 months ago by vctrm6710

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 REPLYlink modified 4 months ago • written 4 months ago by genomax75k

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 REPLYlink modified 4 months ago • written 4 months ago by vctrm6710

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 REPLYlink modified 4 months ago • written 4 months ago by genomax75k

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

ADD REPLYlink written 4 months ago by vctrm6710

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

ADD REPLYlink modified 4 months ago • written 4 months ago by genomax75k
module load gcc/6.2.0
module load bowtie2/2.3.4.3
bowtie2-build -f '/path/referenceGenomes/hg19_ucsc.fa' 'hg19_ucsc'
ADD REPLYlink written 4 months ago by vctrm6710

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

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

ADD REPLYlink modified 4 months ago • written 4 months ago by genomax75k

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 REPLYlink written 4 months ago by vctrm6710

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 REPLYlink modified 4 months ago • written 4 months ago by genomax75k
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: 1185 users visited in the last hour