Are My Samtools Commands Correct
2
0
Entering edit mode
11.7 years ago
shilpy ▴ 20

I am trying some samtools command please let me know are these correct.

  1. A bwa index for chr22.fa -> bwa index chr22.fa
  2. Samtools index for chr22.fa->bwa aln chr22.fa s_4_1.fa >s_4_1.sai
samtools • 3.2k views
ADD COMMENT
2
Entering edit mode

that is not samtools, that's bwa. And your mapping quality will be off if you only map to one chromosome.

ADD REPLY
0
Entering edit mode

yes first i made a bwa index .how to go for samtools index,

ADD REPLY
0
Entering edit mode

before you go for samtools index, you need a bam file. is it single-end or paired-end ? use samse or sampe depending. Then samtools sort then samtools index

ADD REPLY
2
Entering edit mode
11.7 years ago

You don't seem to understand what you are doing. You index the reference genome with bwa. You align your fastq to the indexed genome with bwa. The .sai file is an intermediate file, it (or the two .sai files from a paired end experiment) are converted into a .sam file

Samtools doesn't do any of that.

Though piping that .sam file straight into samtools for compression into .bam format is a smart thing to do.

Also note that indexing the reference genome with bwa, and indexing a .bam file with samtools are two entirely different things. You might not even need the .bam file index.

ADD COMMENT
0
Entering edit mode

yes you are correct, now I know what to do.

ADD REPLY
1
Entering edit mode
11.7 years ago
Jordan ★ 1.3k

Before you use samtools you need to map your reads first. Then you get a sam/bam file based on your aligning tool. Only after that you use that bam/sam file to index it.

To index it, first you sort the bam/sam files.

samtools sort sample.bam sample_sorted

sample.bam here is your input file and sample_sorted here is the output file in the bam format too. Notice you don't mention the .bam extension in the output file name.

Then, you index it using the following command.

samtools index sample_sorted.bam
ADD COMMENT
0
Entering edit mode

Thank you very much !

ADD REPLY
0
Entering edit mode

why do we need to index reference files...

ADD REPLY
0
Entering edit mode

You should focus on reading some tutorials and papers related to the whole NGS pipeline. You should have a clear picture of the workflow before you start.

ADD REPLY
0
Entering edit mode

I fully agree with you Ashutosh, when I enrolled for a course in bioinformatics NGS was not in curriculum, it was introduced for 2 weeks and now got a big assignment really confusing and after 2 weeks i have my finals so totally lost between java, perl ,R and NGS. Thanks for your advise unfortunately I can't go deep in NGS now.

ADD REPLY

Login before adding your answer.

Traffic: 2722 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6