I ran suspenders on BAM files preprocessed by lapels & got a warning message that says - SO tag in input BAM files indicates not sorted by query_name.
I tried sorting BAM files by read name using:
samtools sort -o -n input.bam > Input_sorted.bam
From the header, it does appear that Input_sorted.bam is sorted by queryname
samtools view -H Input_sorted.bam
@HD VN:1.0 SO:queryname
@SQ SN:chr1 LN:195471971
@SQ SN:chr10 LN:130694993
@SQ SN:chr11 LN:122082543
@SQ SN:chr12 LN:120129022
@SQ SN:chr13 LN:120421639
@SQ SN:chr14 LN:124902244
@SQ SN:chr15 LN:104043685 I am using samtools 0.1.19
However, I get the same warning message when I run suspenders on Input_sorted.bam.
Can anyone tell what could be going wrong & how to get around this issue?
Also, samtools index cannot index this file.
Which version of
samtools
are you using?samtools 0.1.19-96b5f2294a
While this does not answer your question I wanted to see if you were using this pipeline. If yes, you could give
pylapels
a try. Perhaps that would do the trick.Samtools 0.1.19 is deprecated. Current version is 1.4. I am not sure if it would make a difference in the sorting but that may be another option to explore.
I am following the pipeline you mentioned and it actually uses pylapels.
Thanks, I will give 1.4 a try.
Then run
pylapels
with the-n
option as suggested, if you have not done so.I have
pylapels -n -o lapels/Mat.bam WSBEiJ_b38_f.mod WSBalign /accepted_hits.bam
Do you still get that error? You should not need to use samtools if you already name sorted using pylapels.
I second you in that I should not need to use samtools. Indeed, samtools view -H shows that the Input.bam (output BAM file from lapels ) is already sorted by queryname.
But since I get an empty suspenders output file along with the warning message, I will have to get rid of the warning message somehow.
Warnings may be ok to ignore (some times, based on context) but since you are getting an empty output that would need to be looked at. Has this install of the pipeline been successfully used before?
Yes, It has been successfully used by other groups (PMID: 27999113, 27933528) apart from the team (PMID 27933528) that came up with it.
I have emailed authors couple days ago and as of this writing waiting for the response.
It is explicitly stated in the pipeline that for suspenders to work successfully both input BAM files need to be sorted by read name and not by coordinates (will produce a warning).
I was asking if your local software installation for this package/pipeline is known to work right.
I have installed this software locally & no one else around has ever dealt with this pipeline - now looking into the installation. Thanks
Adding -t argument to the pysuspender command gives traceback error ( in addition to the original SO tag error):
File "/home/local_dir/suspenders-0.2.5 py2.7.egg/MergeImprove/MergeImprove.py", line 1910, in mainRun pysam.sort(args.outMergedBam+'.tmp0.pileup.sorted.bam', args.outMergedBam+'.tmp.pileup_all')
P.S. samtools 1.4 did not make any difference.
If there is a test dataset included in the software then try to run through that to see if the install itself works. If it does then come back to this problem.
I have tried running their test lapels output files as input files for suspenders and got same errors.
That is a good clue that it is likely not your files but the software install (or some incompatibility there in). Check on @h.mon's suggestion.
Yes, it turned out that I have missed stuff during installation.
I thought I did not have to install pysam separately as it was already a part of suspenders package. But I see two different versions in there
pysam-0.11-py2.7-linux-x86_64.egg
pysam-0.7.6-py2.7-linux-x86_64.egg
But the suspenders seems to have been tested with pysam 0.7.4, to which I did not pay attention originally
https://github.com/holtjma/suspenders
This link also mentions that I also need to have matplotlib & argparse - I dont see them as part of the package so was supposed to install them - but where? Same directory? I can’t figure this out as they are not called in the suspenders command line.
Thanks a lot for your patience on this @ genomax2 & @h.mon
P.S. Lapels is installed in the same directory
Install in the same directory and start there (or at least make sure they are available in
$PATH
). Hopefully useful error messages will guide you through the rest.I could easily install with virtualenv:
pip takes care of python package dependencies, however, it did install pysam-0.11. To install an older version of pysam (0.7.4 is not available), install pysam before instaling suspenders / lapels:
To use suspenders, you have to issue:
Which version of pysam you have installed? There are some incompatible changes between some pysam versions.