SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Merge sam/bam file genelab Bioinformatics 11 06-04-2013 05:33 PM
bwa sai to bam conversion and indexfile.nt.ann?? cllorens Bioinformatics 16 05-29-2013 09:27 AM
BWA - file formats robekubica Bioinformatics 1 08-27-2011 05:07 PM
Confused about .sai file size CNVboy Bioinformatics 1 06-15-2011 02:14 PM
what's in bwa's .sai file mingkunli Bioinformatics 5 09-08-2009 06:43 PM

Reply
 
Thread Tools
Old 12-12-2011, 08:20 AM   #1
louis7781x
Member
 
Location: Hong Kong

Join Date: Oct 2010
Posts: 74
Default Merge sai file of bwa ?

Hi everyone

I used bwa to align reads of multiple lane against genome,

Here I have a question.

For example,

If I have s_1_1_sequence.sai and s_1_2_sequence.sai and.. s_1_6_sequence.sai

Could I merge these sai file to s_1_total_sequence.sai ,and running bwa samse to convert to sam file ?

If I can't do this ,I must covert all sai sam independently .

And How could I use samtools merge six sam file to one total.sam

I want to know the usage of command.

Thank!!!
louis7781x is offline   Reply With Quote
Old 12-12-2011, 08:58 AM   #2
jesus garcia
Junior Member
 
Location: madrid

Join Date: Nov 2011
Posts: 7
Default

Hi,

I use this commands to convert and then merge .sai files, maybe exists other commands more better and faster, you need picard tools

bwa sampe -f name.sam /home/jesus/Documentos/trabajo/genoma/hg19 name_1.sai name_2.sai name_1.fq.gz name_2.fq.gz
java -Xmx4g -Djava.io.tmpdir=../tmp -jar ~/picard-tools/SortSam.jar SO=coordinate I=name.sam O=name.bam VALIDATION_STRINGENCY=LENIENT CREATE_INDEX=true
samtools sort name.bam name.sorted
samtools index name.sorted.bam


this commands for all *.sai files and when you have all *.bam files indexes you can merge them with,

samtools merge final_name.bam name1.bam name2.bam ...


I hope you can use this for your porpouse,

jesus
jesus garcia is offline   Reply With Quote
Old 12-15-2011, 02:08 PM   #3
anjulka
Member
 
Location: Cambridge, MA

Join Date: Oct 2011
Posts: 11
Default

But will that work if you have paired-end reads?

Or would it be better to concatenate the gzipped files first?

Thanks.
anjulka is offline   Reply With Quote
Old 12-16-2011, 03:57 AM   #4
jesus garcia
Junior Member
 
Location: madrid

Join Date: Nov 2011
Posts: 7
Default

yes, it works for paired-end reads,

you can get more information on: http://bio-bwa.sourceforge.net/bwa.shtml

you are well-come
jesus garcia is offline   Reply With Quote
Old 12-16-2011, 08:18 AM   #5
anjulka
Member
 
Location: Cambridge, MA

Join Date: Oct 2011
Posts: 11
Default

I know that bwa works on paired-ends. I just asked my question very badly. I have since found my answer, but I want to post it here in case someone else needs to find it (as well as ask more questions below).

So our output for a single barcoded pair-end read looks like
CRC1_Nov2011_ACAGTG_L003_R1_001.fastq.gz
CRC1_Nov2011_ACAGTG_L003_R1_002.fastq.gz
CRC1_Nov2011_ACAGTG_L003_R1_003.fastq.gz
CRC1_Nov2011_ACAGTG_L003_R1_004.fastq.gz
CRC1_Nov2011_ACAGTG_L003_R1_005.fastq.gz
CRC1_Nov2011_ACAGTG_L003_R1_006.fastq.gz
CRC1_Nov2011_ACAGTG_L003_R2_001.fastq.gz
CRC1_Nov2011_ACAGTG_L003_R2_002.fastq.gz
CRC1_Nov2011_ACAGTG_L003_R2_003.fastq.gz
CRC1_Nov2011_ACAGTG_L003_R2_004.fastq.gz
CRC1_Nov2011_ACAGTG_L003_R2_005.fastq.gz
CRC1_Nov2011_ACAGTG_L003_R2_006.fastq.gz

I had been trying to figure out if R1_001 and R2_001 were the read-pairs or if the read-pairs were dispersed unevenly across the multiple files. If the answer was no, then this strategy wouldn't work for read pairs. However, at least from our core, R1_001 and R2_001 are the read-pairs.

However, I have another several questions for you, Jesus (or whoever wants to answer):

1. Why do you use Picard SortSam to make a sorted bam with an index, but then use Samtools to sort and index again? Am I misunderstanding the steps?

2. Is the output of samtools merge sorted? I know the input has to be, but it's not clear to me if the output is.

3. Is samtools merge better than Picard's MergeSamFiles? It looks like the latter does not require sorted input, would sort the output and can write BAM output along with an index, thereby removing a number of steps. I can't tell if it needs an indexed file going in, though.

Thank you all for being so patient with a newbie.
anjulka is offline   Reply With Quote
Old 12-20-2011, 04:00 PM   #6
volks
Member
 
Location: hd.de

Join Date: Jun 2010
Posts: 81
Default

you could either combine the fastq files before alignment, or the sam/bam files after alignment. i dont think you can combine sai files.

R1 is the first mate, R2 is the second mate of a paired end data. they should have the same length (try wc -l)

samtools merge takes sorted bam as input and also generates a sorted bam. otherwise use samtools cat.

i think picard MergeSamFiles adds a read group tags storing which input file the read came from. if you dont need to keep this information use samtools merge.

i suggest to proceed in the following way:
bwa aln ...
bwa sampe ... | samtools view -Sbu - | samtools sort - alignment_00X
samtools index alignment_00X.bam (not really necessary)
samtools merge ...
samtools index ...
volks 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 05:31 AM.


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