Question: Converting and sorting .sam at the same time
0
gravatar for Angel
14 days ago by
Angel3.5k
Angel3.5k wrote:

Hi

I have a .sam file from STAR; For me picard SortSam gives errors on my machine so I want to use samtools

Is there any command gives a sorted .bam at the same time by samtools without first converting .sam to .bam then sorting .sam?

rna-seq next-gen R • 132 views
ADD COMMENTlink modified 14 days ago by WouterDeCoster41k • written 14 days ago by Angel3.5k
4
gravatar for WouterDeCoster
14 days ago by
Belgium
WouterDeCoster41k wrote:
samtools sort your_alignment.sam -o your_alignment.bam

You could have found that by reading the manual, but instead you decided to have someone else help you.

ADD COMMENTlink modified 14 days ago • written 14 days ago by WouterDeCoster41k

Alternatively, tell STAR to produce sorted BAM output as in this manual.

ADD REPLYlink written 14 days ago by michael.ante3.4k

Thank you I tried telling STAR but giving nothing

C: How I know a file is sam or bam, sorted or unsorted

ADD REPLYlink written 14 days ago by Angel3.5k

I am not a regular STAR user but perhaps STAR needs samtools to be available in your $PATH for that option to work?

ADD REPLYlink modified 14 days ago • written 14 days ago by genomax71k

What did the log file of STAR have to say about the error? If you want to actually solve issues rather than just trying out new tools you might be unfamiliar with, it might be more useful to try to follow the suggestions by the users here.

ADD REPLYlink written 14 days ago by Friederike5.1k

Sorry I faced a problem

[fi1d18@cyan01 310N]$ samtools sort -n ./Aligned.out.sam -o aligned1.sorted.bam
[bam_sort_core] merging from 20 files...

I repeated this command 2 times in 2 different folders but I obtained 2 .bam files with different size one 2046643 KB and another 2036831 KB

How I know which .bam is valid or intact?

ADD REPLYlink written 14 days ago by Angel3.5k
1

How much RAM are you assigning to this job? If you have a large SAM file you may need to assign more RAM.

ADD REPLYlink written 14 days ago by genomax71k

@ Friederike STAR did not give any error but output was unsorted .sam

ADD REPLYlink modified 14 days ago • written 14 days ago by Angel3.5k
1

You may also need to use --limitBAMsortRAM if you don't have enough RAM available.

ADD REPLYlink written 14 days ago by genomax71k
Please log in to add an answer.

Help
Access

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