ekg / bamaddrg Goto Github PK
View Code? Open in Web Editor NEWadds sample names and read-group (RG) tags to BAM alignments
License: MIT License
adds sample names and read-group (RG) tags to BAM alignments
License: MIT License
bamaddrg: adds read groups to input BAM files, streams BAM output on stdout. This is intended for use "fixing up" RG tags on the fly so that they reflect the source file from which the aligment originated from. This allows the "safe" merging of many files from many individuals into one stream, suitable for input into downstream processing systems such as freebayes (a population variant detector). Usage: To tag multiple files simultaneously, use as such: % bamaddrg -b file1.bam -s jill -r group.s1.1 \ -b file2.bam -s jill -r group.s1.2 \ -b file3.bam -s bill \ -b file4.bam \ | freebayes ... This would add the sample name "jill" to records from file1.bam and file2.bam, while specifying that specific read group identify alignments from each file. Alignments from file3.bam would be tagged with sample name "bill" and read group id "bill", and samples from file4.bam would be tagged with sample name "file4.bam" and read group id "file4.bam."
I've discovered that bamaddrg
fails when presented with one file having @HD VN:1.5 SO:coordinate
and the other @HD VN:1.0 SO:coordinate
. Is this expected behavior? Is there any reason SAM streams with different version should not be combined?
I wanted to package your tool for conda but without license I'm stuck because we don't know if we are allowed to redistribute your work...
Could you add a license file please?
Hi, I have downloaded the code from your repository. How do I install it on Ubuntu?
Thank you.
Hello,
I installed bamaddrg by conda and followed the usage guildline: bamaddrg [-b FILE [-s NAME [-r GROUP]]] > output.bam
I use SLRUM job to submit the work.
I already test 50G, 100G, 600G RAM and 30 and 60 cores, but it is still showing the following wrong message.
Here is the wrong message:
could not open input BAM files
/var/spool/slurmd/job01309/slurm_script: line 26: 3413432 Segmentation fault (core dumped) bamaddrg -b ...
I check the StackOverflow and followed the first solution code, but it is still not working. Can anyone help me to solve this issue? Thanks!
Hi,
We used bamaddrg on a large set of BAMs, but are now getting the following error on all BAMs when using Picard MarkDuplicates:
"Exception in thread "main" htsjdk.samtools.SAMFormatException: SAM validation error: ERROR: Record 2766497, Read name HS2000-940_255:4:1316:2078:6895, bin field of BAM record does not equal value computed based on alignment start and end, and length of sequence to which read is aligned"
The only resolution we're aware of is to convert the bam > sam > bam so it recomputes the bin. Have you seen this before?
EDIT: I should add that we have 1000+ whole genomes, so converting bam > sam > bam seems a bit ridiculous. I can't understand why we get the error since bamaddrg didn't change the alignment start or end values. We also can't ignore these reads for our study.
I have been using bamaddrg to assign tags to my four samples of sequence data, and then saved the output as a new .bam file rather than feeding it straight into freebayes.
The files parsed through bamaddrg were raw alignment bam files, and then I plan to send them through samtools, sort, rmdup and index them. However one concern I have is that the .bam file output by bamaddrg is about 40% of the original size of the input bam file. Can anyone explain why, and does this matter?
Sorry if this was explained somewhere else, but I couldnt find the information anywhere.
I understand the usage of the readgroup, but I don't understand what is the -s for. When adding a new sample name and reagroup (with options -s and -r, respectively), the bam file will only keep the readgroup I added, and no sample name.
So, what does it do?
Thanks!
I cloned the package, when I compiled bamtools (independently but still within the bamaddrg cloned structure), I always got a directory structure:
Bamtools/include/bamtools/shared & Bamtools/include/bamtools/api
instead of
Bamtools/include/shared & Bamtools/include/api
What did I do wrong? Thanks!
I tried to install using git clone --recursive, followed by make, but get the following errors:
/home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.cpp: In member function ‘bool BamTools::ResolveTool::ReadNamesFileReader::Read(std::map<std::__cxx11::basic_string, ReadGroupResolver>&)’:
/home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.cpp:401:74: error: no matching function for call to ‘make_pair(__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string > >::value_type&, bool)’
resolver.ReadNames.insert( make_pair<string,bool>(fields[1], true) ) ;
^
In file included from /usr/include/c++/6/bits/stl_algobase.h:64:0,
from /usr/include/c++/6/bits/char_traits.h:39,
from /usr/include/c++/6/string:40,
from /home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_tool.h:14,
from /home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.h:13,
from /home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.cpp:10:
/usr/include/c++/6/bits/stl_pair.h:493:5: note: candidate: template<class _T1, class _T2> constexpr std::pair<typename std::__decay_and_strip<_Tp>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&)
make_pair(_T1&& __x, _T2&& __y)
^~~~~~~~~
/usr/include/c++/6/bits/stl_pair.h:493:5: note: template argument deduction/substitution failed:
/home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.cpp:401:74: note: cannot convert ‘fields.std::vector<_Tp, _Alloc>::operator[]<std::__cxx11::basic_string, std::allocator<std::__cxx11::basic_string > >(1ul)’ (type ‘__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string > >::value_type {aka std::__cxx11::basic_string}’) to type ‘std::__cxx11::basic_string&&’
resolver.ReadNames.insert( make_pair<string,bool>(fields[1], true) ) ;
^
/home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.cpp: In member function ‘bool BamTools::ResolveTool::StatsFileReader::ParseReadGroupLine(const string&, std::map<std::__cxx11::basic_string, ReadGroupResolver>&)’:
/home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.cpp:598:75: error: no matching function for call to ‘make_pair(const string&, ReadGroupResolver&)’
readGroups.insert( make_pair<string, ReadGroupResolver>(name, resolver) );
^
In file included from /usr/include/c++/6/bits/stl_algobase.h:64:0,
from /usr/include/c++/6/bits/char_traits.h:39,
from /usr/include/c++/6/string:40,
from /home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_tool.h:14,
from /home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.h:13,
from /home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.cpp:10:
/usr/include/c++/6/bits/stl_pair.h:493:5: note: candidate: template<class _T1, class _T2> constexpr std::pair<typename std::__decay_and_strip<_Tp>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&)
make_pair(_T1&& __x, _T2&& __y)
^~~~~~~~~
/usr/include/c++/6/bits/stl_pair.h:493:5: note: template argument deduction/substitution failed:
/home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.cpp:598:61: note: cannot convert ‘name’ (type ‘const string {aka const std::__cxx11::basic_string}’) to type ‘std::__cxx11::basic_string&&’
readGroups.insert( make_pair<string, ReadGroupResolver>(name, resolver) );
^~~~
/home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.cpp: In member function ‘bool BamTools::ResolveTool::ResolveToolPrivate::MakeStats()’:
/home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.cpp:1001:93: error: no matching function for call to ‘make_pair(std::__cxx11::string&, const bool&)’
else resolver.ReadNames.insert( make_pair<string, bool>(al.Name, isCurrentMateUnique) );
^
In file included from /usr/include/c++/6/bits/stl_algobase.h:64:0,
from /usr/include/c++/6/bits/char_traits.h:39,
from /usr/include/c++/6/string:40,
from /home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_tool.h:14,
from /home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.h:13,
from /home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.cpp:10:
/usr/include/c++/6/bits/stl_pair.h:493:5: note: candidate: template<class _T1, class _T2> constexpr std::pair<typename std::__decay_and_strip<_Tp>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&)
make_pair(_T1&& __x, _T2&& __y)
^~~~~~~~~
/usr/include/c++/6/bits/stl_pair.h:493:5: note: template argument deduction/substitution failed:
/home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.cpp:1001:68: note: cannot convert ‘al.BamTools::BamAlignment::Name’ (type ‘std::__cxx11::string {aka std::__cxx11::basic_string}’) to type ‘std::__cxx11::basic_string&&’
else resolver.ReadNames.insert( make_pair<string, bool>(al.Name, isCurrentMateUnique) );
~~~^~~~
/home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.cpp: In member function ‘void BamTools::ResolveTool::ResolveToolPrivate::ParseHeader(const BamTools::SamHeader&)’:
/home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.cpp:1033:93: error: no matching function for call to ‘make_pair(const string&, ReadGroupResolver)’
m_readGroups.insert( make_pair<string, ReadGroupResolver>(rg.ID, ReadGroupResolver()) );
^
In file included from /usr/include/c++/6/bits/stl_algobase.h:64:0,
from /usr/include/c++/6/bits/char_traits.h:39,
from /usr/include/c++/6/string:40,
from /home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_tool.h:14,
from /home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.h:13,
from /home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.cpp:10:
/usr/include/c++/6/bits/stl_pair.h:493:5: note: candidate: template<class _T1, class _T2> constexpr std::pair<typename std::__decay_and_strip<_Tp>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&)
make_pair(_T1&& __x, _T2&& __y)
^~~~~~~~~
/usr/include/c++/6/bits/stl_pair.h:493:5: note: template argument deduction/substitution failed:
/home/wfl/programs/bamaddrg/bamtools/src/toolkit/bamtools_resolve.cpp:1033:70: note: cannot convert ‘rg.BamTools::SamReadGroup::ID’ (type ‘const string {aka const std::__cxx11::basic_string}’) to type ‘std::__cxx11::basic_string&&’
m_readGroups.insert( make_pair<string, ReadGroupResolver>(rg.ID, ReadGroupResolver()) );
~~~^~
src/toolkit/CMakeFiles/bamtools_cmd.dir/build.make:254: recipe for target 'src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_resolve.cpp.o' failed
make[3]: *** [src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_resolve.cpp.o] Error 1
make[3]: Leaving directory '/home/wfl/programs/bamaddrg/bamtools/build'
CMakeFiles/Makefile2:520: recipe for target 'src/toolkit/CMakeFiles/bamtools_cmd.dir/all' failed
make[2]: *** [src/toolkit/CMakeFiles/bamtools_cmd.dir/all] Error 2
make[2]: Leaving directory '/home/wfl/programs/bamaddrg/bamtools/build'
Makefile:127: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/wfl/programs/bamaddrg/bamtools/build'
Makefile:10: recipe for target 'libbamtools.a' failed
make: *** [libbamtools.a] Error 2
This repo does not have an explicit license in the base directory. Is this still covered under the MIT license like your other repos? If so, could you add the License to this repo?
Hi
Im trying to install bamaddrg on my ubuntu 19.10, and I keep having this error:
make[3]: *** [src/toolkit/CMakeFiles/bamtools_cmd.dir/build.make:167: src/toolkit/CMakeFiles/bamtools_cmd.dir/bamtools_resolve.cpp.o] Error 1
make[3]: Leaving directory '/home/cravinhos/bamaddrg/bamtools/build'
make[2]: *** [CMakeFiles/Makefile2:526: src/toolkit/CMakeFiles/bamtools_cmd.dir/all] Error 2
make[2]: Leaving directory '/home/cravinhos/bamaddrg/bamtools/build'
make[1]: *** [Makefile:130: all] Error 2
make[1]: Leaving directory '/home/cravinhos/bamaddrg/bamtools/build'
make: *** [Makefile:10: libbamtools.a] Error 2
I tried installing bamtools with conda and sudo apt install, but even though I can successful install bamtools both ways, i still have the same error when installing bamaddrg...
Did this happen to anyone else?
This is what I am doing:
(after bamtools installation)
sudo git clone --recursive https://github.com/ekg/bamaddrg.git
cd bamaddrg
sudo make
Thanks
Susana
I'm getting two "Connection timed out" error messages after running:
git clone --recursive https://github.com/ekg/bamaddrg
Is there an easy way to install using the downloaded *.zip instead?
Also: can someone confirm this is still compatible with the current bamtools (2.4.1?)?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.