Hi,
As part of my chip seq analysis, I tried to run a script to convert fastq file into .bam file without the creation of a .sam file (using piping). This is the script:
${bowtie2_source} -x ${ref_genome} -U ${fastq_file} -S | ${samtools} view -bS - ${target_dir}/${sample_name}.bam
unfortunately, I recieved the following error: [main_samview] random alignment retrieval only works for indexed BAM or CRAM files. How can I fix this?
If an answer was helpful you should upvote it, if the answer resolved your question you should mark it as accepted. Please do the same for your previous posts as well.
Pierre has the right answer. The way you have written it, the software thinks that you want to look at all entries in the bam that have the chromosome name ${target_dir}/${sample_name}. This can't be done unless the sam/bam has an index, so the software is complaining.