SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
help interpreting samtools tview dnusol Bioinformatics 0 02-15-2012 11:30 PM
questions from reference to tview by samtool dkrtndhkd Bioinformatics 1 01-30-2012 09:22 AM
samtools tview totalnew Bioinformatics 1 10-17-2011 06:10 PM
samtools tview EmmaB Bioinformatics 4 07-18-2011 02:43 AM
samtools pileup and tview pparg Bioinformatics 5 11-09-2010 01:53 AM

Reply
 
Thread Tools
Old 06-03-2010, 09:31 AM   #1
rodney
Junior Member
 
Location: Austin, TX

Join Date: Sep 2009
Posts: 1
Default samtools tview reference sequence

Does anyone else know how to get samtools tview to display the reference sequence at the top? I only see a string of N where I think the reference sequence should be.
Attached Images
File Type: jpg Screenshot.jpg (20.2 KB, 252 views)
rodney is offline   Reply With Quote
Old 06-03-2010, 10:16 AM   #2
nilshomer
Nils Homer
 
nilshomer's Avatar
 
Location: Boston, MA, USA

Join Date: Nov 2008
Posts: 1,285
Default

Quote:
Originally Posted by rodney View Post
Does anyone else know how to get samtools tview to display the reference sequence at the top? I only see a string of N where I think the reference sequence should be.
Add in the reference after the BAM file in the command line.
nilshomer is offline   Reply With Quote
Old 09-13-2010, 05:33 AM   #3
Mansequencer
Member
 
Location: Canada

Join Date: Jul 2010
Posts: 16
Default

Hi Rodney and Nilshomer,
I have a similar problem. I do add my reference fasta file after the BAM file but all I see are the Ns. I dont even see the reads that have aligned.
Any suggestions?
Thanks guys.
Mansequencer is offline   Reply With Quote
Old 09-13-2010, 07:21 AM   #4
nilshomer
Nils Homer
 
nilshomer's Avatar
 
Location: Boston, MA, USA

Join Date: Nov 2008
Posts: 1,285
Default

Quote:
Originally Posted by Mansequencer View Post
Hi Rodney and Nilshomer,
I have a similar problem. I do add my reference fasta file after the BAM file but all I see are the Ns. I dont even see the reads that have aligned.
Any suggestions?
Thanks guys.
Please give us what you typed into your command line.
nilshomer is offline   Reply With Quote
Old 09-13-2010, 08:45 AM   #5
Mansequencer
Member
 
Location: Canada

Join Date: Jul 2010
Posts: 16
Default

Here is the command:
samtools tview file.sort.bam reference.folded.fas
Mansequencer is offline   Reply With Quote
Old 09-23-2010, 09:17 AM   #6
nntao
Junior Member
 
Location: Mid-west

Join Date: Jan 2010
Posts: 4
Default samtools tview issue

I have several issues with "samtools tview":
g : goto position, allows me to type a number, but not going anywhere
b : won't toggle

anyone has similar problem, and solutions
nntao is offline   Reply With Quote
Old 09-23-2010, 09:43 AM   #7
nilshomer
Nils Homer
 
nilshomer's Avatar
 
Location: Boston, MA, USA

Join Date: Nov 2008
Posts: 1,285
Default

Quote:
Originally Posted by nntao View Post
I have several issues with "samtools tview":
g : goto position, allows me to type a number, but not going anywhere
b : won't toggle

anyone has similar problem, and solutions
Enter the chromosome name and position (even if there is only one chromosome). For example "chr1:1000" (no quotes).
nilshomer is offline   Reply With Quote
Old 12-28-2010, 10:57 AM   #8
naluru
Member
 
Location: Woods Hole, Massachusetts

Join Date: Jul 2010
Posts: 16
Default samtools tview

Hello,

I am having similar problem as mentioned here earlier. I have a string of N's in the reference genome, when I use the samtools tview command.Only the first 80 bases are present and remaining are all NNNNNN's. I tried using g option and tried different chromosome numbers. Still I have only N's.

Any help will be highly appreciated.

Here is the command I gave:

samtools tview MH_0001alignedreadssorted.bam danRer6.fa
naluru is offline   Reply With Quote
Old 01-04-2011, 06:42 AM   #9
epigen
Senior Member
 
Location: Germany

Join Date: May 2010
Posts: 101
Default

If your reference sequence is correct and indexed, as well as you BAM file, you should see the reference sequence where reads aligned. I noted that if there are no reads for a long stretch of bases, tview doesn't bother to show the reference, it shows only Ns. When I checked with another BAM file that had reads at that location, everything was OK. Before I thought the fasta file was currupted - which might very well be a reason for only seeing Ns.
epigen is offline   Reply With Quote
Old 04-19-2011, 07:50 AM   #10
tonge
Junior Member
 
Location: canada

Join Date: Mar 2011
Posts: 5
Default

Retracted message

Last edited by tonge; 04-19-2011 at 08:47 AM. Reason: I found the correct answer, my mistake
tonge is offline   Reply With Quote
Old 04-19-2011, 01:22 PM   #11
qtrinh
Member
 
Location: Canada

Join Date: May 2008
Posts: 20
Default

Did you use 'danRer6.fa' in your alignment step? I think the issue here is that the reference used in the alignment step is not the same as 'danRer6.fa'


Quote:
Originally Posted by naluru View Post
Hello,

I am having similar problem as mentioned here earlier. I have a string of N's in the reference genome, when I use the samtools tview command.Only the first 80 bases are present and remaining are all NNNNNN's. I tried using g option and tried different chromosome numbers. Still I have only N's.

Any help will be highly appreciated.

Here is the command I gave:

samtools tview MH_0001alignedreadssorted.bam danRer6.fa
qtrinh is offline   Reply With Quote
Old 04-19-2011, 01:42 PM   #12
swbarnes2
Senior Member
 
Location: San Diego

Join Date: May 2008
Posts: 912
Default

It's probably not a problem with tview, you can get the same issue in mpileup. Double-check that the names in your reference file are exactly the same as in your .sam file, or that there aren't any odd characters that might be confusing things.
swbarnes2 is offline   Reply With Quote
Old 09-28-2011, 01:27 PM   #13
VeBeKay
Junior Member
 
Location: UK

Join Date: Jul 2010
Posts: 5
Default

For me, it was a colon ":" in my chromosome name for the reference sequence. When I deleted the colon, the actual sequence showed up (before that it was only N's).
VeBeKay is offline   Reply With Quote
Old 09-29-2011, 12:16 AM   #14
Tally
Member
 
Location: Sydney

Join Date: Aug 2011
Posts: 12
Default

Thank you VeBeKay!! That solved my problem perfectly :-) However I had to delete it in the reference AND rerun the alignment and subsequent steps, time-consuming but 100% effective.
I am surprised this was an issue, as the fasta reference was created using samtools faidx region command, which utilises a semi-colon to define the region. I tried faidx region extract with no semi-colon, and this does not give the correct output. Does anyone know of how to use faidx to extract regions to a multi-fasta which does not have semi-colons in the output files? It seems silly to require them for faidx yet malfunction over them in tview.
Tally is offline   Reply With Quote
Old 01-23-2012, 06:05 AM   #15
HeidiJTP
Member
 
Location: Florida

Join Date: Nov 2011
Posts: 22
Default

I am also having this problem, where the first 80 bases are present, then mostly Ns except in a few positions where aligned reads appear. I am just running a test set to try to learn the process, so I took a reference sequence and fragmented it into 500 bp segments with 50 bp overlaps, then aligned the fragments (short_reads.fas) back to the reference.fas. Thus, the full reference should have fragments aligned to it. Here are the commands I used:

$ bwa index reference.fas
$ bwa aln reference.fas short_reads.fas >short_reads.sai
$ bwa samse reference.fas short_reads.sai short_reads.fas >short_reads.sam
$ samtools faidx reference.fas
$ samtools import reference.fas.fai short_reads.sam short_reads.bam
$ samtools sort short_reads.bam short_reads.srt
$ samtools index short_reads.srt.bam
$ samtools tview short_reads.srt.bam reference.fas

I made sure that there were no colons in any sequence titles, but I am not sure I have used all the commands correctly. I would really appreciate any help!
HeidiJTP is offline   Reply With Quote
Old 01-23-2012, 01:57 PM   #16
Tally
Member
 
Location: Sydney

Join Date: Aug 2011
Posts: 12
Default

When importing sam to bam, I use 'view' rather than 'import' :

@SQ header lines present in SAM file:
samtools view –bS alignment.sam > alignment.bam

@SQ header lines absent from SAM file:
samtools view –bt reference.fasta.fai alignment.sam > alignment.bam

Not sure if that will help at all but might be worth a try
Good luck
Tally is offline   Reply With Quote
Old 01-24-2012, 04:55 AM   #17
HeidiJTP
Member
 
Location: Florida

Join Date: Nov 2011
Posts: 22
Default

Thanks for the suggestion Tally, I just reran everything and used the command view instead of import, but still no luck
HeidiJTP is offline   Reply With Quote
Old 01-24-2012, 06:02 AM   #18
HeidiJTP
Member
 
Location: Florida

Join Date: Nov 2011
Posts: 22
Default

I think there are two problems here:

1) Display of NNNNs instead of sequence
This seems to be related in part to the actual terminal window. I thought it was weird that the NNNs don't appear until exactly after I start scrolling across the terminal. If I resize the terminal before running the 'tview' command, the position where the NNNs begin also changes. It may not be important, as according to mpileup output the NNNs are only occurring in between aligned regions.

2) Incomplete alignment
My fault!!! Helps when you use the correct reference sequence...

Last edited by HeidiJTP; 01-24-2012 at 09:44 AM.
HeidiJTP is offline   Reply With Quote
Old 02-12-2012, 02:58 AM   #19
sudeep
Junior Member
 
Location: Germany

Join Date: Feb 2012
Posts: 2
Default

Quote:
Originally Posted by HeidiJTP View Post
I think there are two problems here:

1) Display of NNNNs instead of sequence
This seems to be related in part to the actual terminal window. I thought it was weird that the NNNs don't appear until exactly after I start scrolling across the terminal. If I resize the terminal before running the 'tview' command, the position where the NNNs begin also changes. It may not be important, as according to mpileup output the NNNs are only occurring in between aligned regions.
I am also facing this problem. Does anybody know what is the work around ?
sudeep is offline   Reply With Quote
Old 02-14-2012, 03:42 AM   #20
Crypticfortune
Member
 
Location: Tokyo, Japan

Join Date: Jul 2011
Posts: 14
Default

Quote:
Originally Posted by sudeep View Post
I am also facing this problem. Does anybody know what is the work around?
To summarize, I think there's 3 main problems that trip up users:
  1. Forgot to specify the reference on the command line (eg. "samtools tview foo.bam" => "samtool tview foo.bam foo.fa")
  2. Fasta file has different names for sequences. This is painful to fix, but you'll have to either rewrite all the sequence names (e.g. ">chr1" lines in foo.fa) to match the bam file sequence names, or rewrite the sequence references in the SAM/BAM file. The former's probably easier, but definitely the "right" way to go is to use the same fasta files when building the alignment to begin with
  3. Corrupt fasta files? I can't confirm this, but I suspect samtools might choke on reading FASTA files with dos/windows CR/LF linebreak codes (shows up as ^M in unix terminals a lot). This would explain HeidiJTP and naluru's 80 character problem (as 80 characters per line is common). You can normalize your dos/windows ASCII files to unix with the dos2unix command (e.g. dos2unix foo.fa).

Also, it may not be what you're looking for if you care about the reference outside of mapped areas, but as an alternative, Samscope infers and displays the reference from BAM data alone (MD + CIGAR tags) without relying on FASTA reference files.
Crypticfortune is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 06:53 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO