Question: Reference Genome Path In Samtools
gravatar for win
7.1 years ago by
win810 wrote:

Hi all, One of the classic commands in samtools is as follows:

samtools mpileup -uf ref.fa aln1.bam aln2.bam | bcftools view -bvcg - > var.raw.bcf

In the command above ref.fa is the reference fasta file.

I wanted to know if samtools can work with a reference file that is output from a script (for e.g., wherein ref.php would write fasta data to the output stream.

thanks, a

genome • 2.0k views
ADD COMMENTlink modified 7.1 years ago by Pierre Lindenbaum125k • written 7.1 years ago by win810
gravatar for Pierre Lindenbaum
7.1 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum125k wrote:

do you mean using a stream as a reference ? no, because samtools uses a random-access process (fseek) to peek the specific regions of the genome. That is also why a genome must be indexed with 'samtools faidx'.

But you can always save the ouput of your php script to a file and use it as a regular fasta file.

Edit:yes it could be possible to use a database but you would have to change many lines of codes in samtools (for example, in faidx.c!

char *faidx_fetch_seq(const faidx_t *fai, char *c_name, int p_beg_i, int p_end_i
, int *len)

and accessing the sequence through a database would certainly slow down the whole analysis.

Another (geek) solution would be to implement a proxy to the database using fuse ( )

ADD COMMENTlink modified 7.1 years ago • written 7.1 years ago by Pierre Lindenbaum125k

yes, i did mean using stream as a reference. thanks for the info about "fseek". Actually i wanted to load the reference file in a database (i know this may not be most recommended but i want it for a specific reason). So really what i am looking for is if it's possible to read reference fasta from a database.

ADD REPLYlink written 7.1 years ago by win810

that sounds like one possible approach, thank you.

ADD REPLYlink written 7.1 years ago by win810
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1461 users visited in the last hour