I am writing a code to analyse yeast sequencing data using R. I was able to do the alignment using BWA and thus obtain a .bam file and its .bai index using samtools. My next step is to perform variant calling using bcftools. Here is my command line and the associated error:
[mpileup] 17 samples in 17 input files
samtools mpileup: error reading from input file
Failed to read from standard input: unknown file type
paste(fasta_dir, "chr*.fa", sep = "") gives the pathway to the directory containing the 17 fasta files of the genome of reference (one for each chromosome), named chrI.fa, chrII.fa, ...
merged_bam_file is pathway to the alignment file I obtained and with which I want to perform the variant calling
I understand that the problem comes from the type of my files, but since the alignment file is BAM and my genome of reference is FASTA, I have absolutely no clue what to change to make it work.
Any advices?
Where things go wrong can be anywhere that system() gets a command it can't execute. That's what happens when the first paste sends the name of the directory and the wild card smooshed together. This is corrected in the second.
But there are at least a couple of packages that makes this easier. Rsamtools and {Samtools} ease some of the rough spots by relieving the necessity of having to construct elaborate raw commands