Package: bgsignature
bgsignatureis a package used to compute signatures.The most basic type of computation is the computation
of the counts of the different k-mers (e.g. 3 or 5).
This computation can be done for a set of mutations,
for a set of regions or for a set of mutation
that fall within certain regions.bgsignatureconsists of 3 tools:count: count different k-mersfrequency: divide the counts by the total countsnormalize: divide the counts by counts obtained
separately and normalize the results.Advanced featuresinclude:ability to group the counts (e.g. group mutations by sample)normalize the counts by the context taken from a regions filecollapse (add together) reverse complementary sequencesInstallationThis project is a Python package
and can be installed withpip.
Download the source code, get into this
project directory and execute:pipinstall.UsageCommand line interfaceThe 3 tools can be called usingbgsignature countbgsignature frequencybgsignature normalizeSome examples:getting help:bgsignature-hbgsignaturefrequency-hcount triplets in mutation that fall in certain regions using hg38:bgsignaturecount-mmy/muts/file-rmy/regions/file-ghg38-omy/output.json--cores4PythonAlternative, the command line options have an equivalent in Python:frombgsignatureimportcount,relative_frequency,normalizethat accept similar parameters except the output.
The return object can be used as a dictionary.If you already have your files loaded in Python
you can use directly count function
in the corresponding module.
E.g.:frombgsignature.countimportmutationmutation.count(mutations,'hg38',3)In addition, you can also
use the the “low-level” functions that
do the count (count_allandcount_group)
which are much simple and do not
perform any kind of parallelization.
E.g.:frombgsignature.countimportmutationmutation.count_all(mutations,'hg38',3)# or to group mutations by samplemutation.count_group(mutations,'hg38',3,'SAMPLE')The return object can be normalized to 1,
using thesum1()method
or divided by some normalization counts
using thenormalize()method.ImportantThere are some behavioural characteristics that
must be taken into account:bgsignaturefilters out mutations whose reference nucleotide
(as provided in the file), and the
corresponding one in the reference genome do not match.when using thecollapseoption (enabled by default),bgsignaturedoes not remove one of the collapsed sequences but keeps both.
This means that you need to manually remove the ones you
are not interested in.when usingbgsignature.count.mutation.countorbgsignature.count.region.countfunction
and a number ofcoresfor paralelization,
thechunkparameter must be selected
adequately, as a it can have a huge impact on performance.File formatsMutations fileTab separated file
(can be compressed intogz,bgzorxzformats)
with a header and at least these columns:CHROMOSOME,POSITION,REF,ALT.
In addition,SAMPLE,CANCER_TYPEandSIGNATUREare optional columns that can be used for
grouping the signature.Regions fileTab separated file
(can be compressed intogz,bgzorxzformats)
with a header and at least these columns:CHROMOSOME,START,END,ELEMENT.
In addition,SYMBOL, andSEGMENTare optional columns that can be used for
grouping the signature.SupportIf you are having issues, please let us know.
You can contact us at:bbglab@irbbarcelona.org