This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to get an aligment file to the reference in a raw format (.txt file etc).

Hello,

is there a way to get an alignment file out? I am after something that you get after the tview command but I want it in a text file.

Is there a way to do this?

Thank you

PS: I cannot reply to Pierre. This doesnt work for me and produces something like this:

CG************C*********** S. .
TC************.*********** .C************G*********** TT************G***********

I dont seem to be able to reply or add comments. I am using the latest version.

sequencing alignment next-gen

Which version of samtools are you using? Hopefully the latest (v.1.8).

1 answer

I suppose you're asking about samtools tview , use option '-d '?

$ samtools tview -d T -p ref:20 --reference toy.fa toy.bam > align.txt
$ cat align.txt
 21        31         41        51        61        71        81                
CTGTGCTAGTAGGCAG*TCAGCGCCATNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
.....K.K......K. ..........                                                     
...      ,,,,,    ,,,,,,,,,                                                     
..>>>>>>>>>>>>>>T.....

Hi, unfortunately this doesnt work for me. Any idea? My goal is to look at correlated mutations in particular reads. Wanted to extract reads that cover both of these mutations using python from the raw alignment file. Do you have any other idea how to do that?

Hi, unfortunately this doesnt work for me

without any error message / command it's not possible to help you.

Wanted to extract reads that cover both of these mutations using python from the raw alignment file.

how is it related to your initial question ?

I dont get an error message but this what I get back:

CG************C*********** S. .
TC************.*********** .C************G*********** TT************G***********

Its not in the nice readable format you show. My command - samtools tview -d T s90_mapped-sorted.bam ref_E2_J6.fa > align.txt

My samtools are version v.1.8

Log in to answer this question.