NAME
Bio::PopGen::HtSNP.pm- Select htSNP from a haplotype set
SYNOPSIS
use Bio::PopGen::HtSNP;my $obj = Bio::PopGen::HtSNP->new($hap,$snp,$pop);
DESCRIPTION
Select the minimal set of SNP that contains the full information about the haplotype without redundancies.
Take as input the followin values:
- - the haplotype block (array of array).
- - the snp id (array).
- - family information and frequency (array of array).
The final haplotype is generated in a numerical format and the SNP's sets can be retrieve from the module.
considerations:
- If you force to include a family with indetermination, the SNP's with indetermination will be removed from the analysis, so consider before to place your data set what do you really want to do.
- If two families have the same information (identical haplotype), one of them will be removed and the removed files will be stored classify as removed.
- Only are accepted for calculation A, C, G, T and - (as deletion) and their combinations. Any other value as n or ? will be considered as degenerations due to lack of information.
RATIONALE
On a haplotype set is expected that some of the SNP and their variations contribute in the same way to the haplotype. Eliminating redundancies will produce a minimal set of SNP's that can be used as input for a taging selection process. On the process SNP's with the same variation are clustered on the same group.
The idea is that because the tagging haplotype process is exponential. All redundant information we could eliminate on the tagging process will help to find a quick result.
CONSTRUCTORS
my $obj = Bio::PopGen::HtSNP->new(-haplotype_block => \@haplotype_patterns,-snp_ids => \@snp_ids,-pattern_freq => \@pattern_name_and_freq);
where $hap, $snp and $pop are in the format:
my $hap = ['acgt','agtc','cgtc']; # haplotype patterns' idmy $snp = [qw/s1 s2 s3 s4/]; # snps' Id'smy $pop = [[qw/ uno 0.20/],[qw/ dos 0.20/],[qw/ tres 0.15/],]; # haplotype_pattern_id Frequency
OBJECT METHODS
See Below for more detailed summaries.
DETAILS
How the process is working with one example
Let's begin with one general example of the code.
Input haplotype:
acgtcca-tcggtagtgccccccgtgccgctcgtgc
The first thing to to is to split the haplotype into characters.
a c g t c c a - tc g g t a g t g cc c c c c g t g cc g c t c g t g c
Now we have to convert the haplotype to Upercase. This will produce the same SNP if we have input a or A.
A C G T C C A - TC G G T A G T G CC C C C C G T G CC G C T C G T G C
The program admit as values any combination of ACTG and - (deletions). The haplotype is converted to number, considering the first variation as zero and the alternate value as 1 (see expanded description below).
0 0 0 0 0 0 0 0 01 1 0 0 1 1 1 1 11 0 1 1 0 1 1 1 11 1 1 0 0 1 1 1 1
Once we have the haplotype converted to numbers we have to generate the snp type information for the haplotype.
SNP code = SUM ( value * multiplicity ^ position );
where:SUM is the sum of the values for the SNPvalue is the SNP number code (0 [generally for the mayor allele],1 [for the minor allele].position is the position on the block.
For this example the code is:
0 0 0 0 0 0 0 0 01 1 0 0 1 1 1 1 11 0 1 1 0 1 1 1 11 1 1 0 0 1 1 1 1------------------------------------------------------------------14 10 12 4 2 14 14 14 1414 = 0*2^0 + 1*2^1 + 1*2^2 + 1*2^312 = 0*2^0 + 1*2^1 + 0*2^2 + 1*2^3....
Once we have the families classify. We will take just the SNP's not redundant.
14 10 12 4 2
This information will be passed to the tag module is you want to tag the htSNP.
Whatever it happens to one SNPs of a class will happen to a SNP of the same class. Therefore you don't need to scan redundancies
Working with fuzzy data.
This module is designed to work with fuzzy data. As the source of the haplotype is diverse. The program assume that some haplotypes can be generated using different values. If there is any indetermination (? or n) or any other degenerated value or invalid. The program will take away This SNP and will leave that for a further analysis.
On a complex situation:
a c g t ? c a c ta c g t ? c a - tc g ? t a g ? g cc a c t c g t g cc g c t c g t g cc g g t a g ? g ca c ? t ? c a c t
On this haplotype everything is happening. We have a multialelic variance. We have indeterminations. We have deletions and we have even one SNP which is not a real SNP.
The buiding process will be the same on this situation.
Convert the haplotype to uppercase.
A C G T ? C A C TA C G T ? C A - TC G ? T A G ? G CC A C T C G T G CC G C T C G T G CC G G T A G ? G CA C ? T ? C A C T
All columns that present indeterminations will be removed from the analysis on this Step.
hapotype after remove columns:
A C T C C TA C T C - TC G T G G CC A T G G CC G T G G CC G T G G CA C T C C T
All changes made on the haplotype matrix, will be also made on the SNP list.
snp_id_1 snp_id_2 snp_id_4 snp_id_6 snp_id_8 snp_id_9
now the SNP that is not one SNP will be removed from the analysis. SNP with Id snp_id_4 (the one with all T's).
because of the removing. Some of the families will become the same and will be clustered. A posteriori analysis will diference these families. but because of the indetermination can not be distinguish.
A C C C TA C C - TC G G G CC A G G CC G G G CC G G G CA C C C T
The result of the mergering will go like:
A C C C TA C C - TC G G G CC A G G C
Once again the changes made on the families and we merge the frequency (to be implemented)
Before to convert the haplotype into numbers we consider how many variations we have on the set. On this case the variations are 3.
The control code will use on this situation base three as mutiplicity
0 0 0 0 00 0 0 1 01 1 1 2 11 2 1 2 1-----------------------------------36 63 36 75 36
And the minimal set for this combination is
0 0 00 0 11 1 21 2 2
NOTE: this second example is a remote example an on normal conditions. This conditions makes no sense, but as the haplotypes, can come from many sources we have to be ready for all kind of combinations.
FEEDBACK
Mailing Lists
User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated.
[email protected] - General discussionhttp://bioperl.org/wiki/Mailing_lists - About the mailing lists
Support
Please direct usage questions or support issues to the mailing list:
rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.
Reporting Bugs
Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web:
https://github.com/bioperl/bioperl-live/issues
AUTHOR - Pedro M. Gomez-Fabre
Email pgf18872-at-gsk-dot-com
APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
new
Title : newFunction: constructor of the class.Usage : $obj-> Bio::PopGen::HtSNP->new(-haplotype_block-snp_ids-pattern_freq)Returns : self hashArgs : input haplotype (array of array)snp_ids (array)pop_freq (array of array)Status : public
haplotype_block
Title : haplotype_blockUsage : my $haplotype_block = $HtSNP->haplotype_block();Function: Get the haplotype block for a haplotype tagging selectionReturns : reference of arrayArgs : reference of array with haplotype pattern
snp_ids
Title : snp_idsUsage : my $snp_ids = $HtSNP->$snp_ids();Function: Get the ids for a haplotype tagging selectionReturns : reference of arrayArgs : reference of array with SNP ids
pattern_freq
Title : pattern_freqUsage : my $pattern_freq = $HtSNP->pattern_freq();Function: Get the pattern id and frequency for a haplotypetagging selectionReturns : reference of arrayArgs : reference of array with SNP ids
_check_input
Title : _check_inputUsage : _check_input($self)Function: check for errors on the inputReturns : self hashArgs : selfStatus : internal
_haplotype_length_error
Title : _haplotype_length_errorUsage : _haplotype_length_error($self)Function: check if the haplotype length is the same that the one on theSNP id list. If not break and exitReturns : self hashArgs : selfStatus : internal
_population_error
Title : _population_errorUsage : _population_error($self)Function: use input_block and pop_freq test if the number of elementsmatch. If doesn't break and quit.Returns : self hashArgs : selfStatus : internal
_do_it
Title : _do_itUsage : _do_it($self)Function: Process the input generating the results.Returns : self hashArgs : selfStatus : internal
input_block
Title : input_blockUsage : $obj->input_block()Function: returns input blockReturns : reference to array of arrayArgs : noneStatus : public
hap_length
Title : hap_lengthUsage : $obj->hap_length()Function: get numbers of SNP on the haplotypeReturns : scalarArgs : noneStatus : public
pop_freq
Title : pop_freqUsage : $obj->pop_freq()Function: returns population frequencyReturns : reference to arrayArgs : noneStatus : public
deg_snp
Title : deg_snpUsage : $obj->deg_snp()Function: returns snp_removes due to indetermination on their valuesReturns : reference to arrayArgs : noneStatus : public
snp_type
Title : snp_typeUsage : $obj->snp_type()Function: returns hash with SNP typeReturns : reference to hashArgs : noneStatus : public
silent_snp
Title : silent_snpUsage : $obj->silent_snp()Function: some SNP's are silent (not contibuting to the haplotype)and are not considering for this analysisReturns : reference to a arrayArgs : noneStatus : public
useful_snp
Title : useful_snpUsage : $obj->useful_snp()Function: returns list of SNP's that are can be used as htSNP. Someof them can produce the same information. But this isnot considered here.Returns : reference to a arrayArgs : noneStatus : public
ht_type
Title : ht_typeUsage : $obj->ht_type()Function: every useful SNP has a numeric code dependending of itsvalue and position. For a better description seedescription of the module.Returns : reference to a arrayArgs : noneStatus : public
ht_set
Title : ht_setUsage : $obj->ht_set()Function: returns the minimal haplotype in numerical format. Thishaplotype contains the maximal information about thehaplotype variations but with no redundancies. It's theminimal set that describes the haplotype.Returns : reference to an array of arraysArgs : noneStatus : public
snp_type_code
Title : snp_type_codeUsage : $obj->snp_type_code()Function: returns the numeric code of the SNPs that need to betagged that correspond to the SNP's considered in ht_set.Returns : reference to an arrayArgs : noneStatus : public
snp_and_code
Title : snp_and_codeUsage : $obj->snp_and_code()Function: Returns the full list of SNP's and the code associate tothem. If the SNP belongs to the group useful_snp it keepthis code. If the SNP is silent the code is 0. And if theSNP is degenerated the code is -1.Returns : reference to an array of arrayArgs : noneStatus : public
deg_pattern
Title : deg_patternUsage : $obj->deg_pattern()Function: Returns the a list with the degenerated haplotype.Sometimes due to degeneration some haplotypes looksthe same and if we don't remove them it won't findany tag.Returns : reference to a hash of arrayArgs : noneStatus : public
split_hap
Title : split_hapUsage : $obj->split_hap()Function: simple representation of the haplotype base by baseSame information that input haplotype but base based.Returns : reference to an array of arrayArgs : noneStatus : public
_split_haplo
Title : _split_haploUsage : _split_haplo($self)Function: Take a haplotype and split it into basesReturns : selfArgs : noneStatus : internal
_to_upper_case
Title : _to_upper_caseUsage : _to_upper_case()Function: make SNP or in-dels Upper caseReturns : selfArgs : an AoA refStatus : private
_remove_deg
Title : _remove_degUsage : _remove_deg()Function: when have a indetermination or strange value this SNPis removedReturns : haplotype family set and degeneration listArgs : ref to an AoA and a ref to an arrayStatus : internal
_rem_silent_snp
Title : _rem_silent_snpUsage : _rem_silent_snp()Function: there is the remote possibility that one SNP won't be areal SNP on this situation we have to remove this SNP,otherwise the program won't find any tagReturns : nonthingArgs : ref to an AoA and a ref to an arrayStatus : internal
_find_silent_snps
Title : _find_silent_snpsUsage :Function: list of snps that are not SNPs. All values for thatSNPs on the set is the same one. Look stupid but canhappened and if this happend you will not find any tagReturns : nothingArgs :Status :
_find_indet
Title : _find_indetUsage :Function: find column (SNP) with invalid or degenerated valuesand store this values into the second parameter supplied.Returns : nothingArgs : ref to AoA and ref to an arrayStatus : internal
_remove_col
Title : _remove_colUsage :Function: remove columns contained on the second array fromthe first arrReturns : nothingArgs : array of array reference and array referenceStatus : internal
_remove_snp_id
Title : _remove_snp_idUsage :Function: remove columns contained on the second array fromthe first arrReturns : nothingArgs : array of array reference and array referenceStatus : internal
_find_deg_pattern
Title : _find_deg_patternUsage :Function: create a list with the degenerated patternsReturns : @arrayArgs : a ref to AoAStatus : public
_keep_these_patterns
Title : _keep_these_patternsUsage :Function: this is a basic approach, take a LoL and a list,keep just the columns included on the listReturns : nothingArgs : an AoA and an arrayStatus : public
compare_arrays
Title : compare_arraysUsage :Function: take two arrays and compare their valuesReturns : 1 if the two values are the same0 if the values are differentArgs : an AoA and an arrayStatus : public
_convert_to_numbers
Title : _convert_to_numbersUsage : _convert_to_numbers()Function: transform the haplotype into numbers. before to do thatwe have to consider the variation on the set.Returns : nonthingArgs : ref to an AoA and a ref to an arrayStatus : internal
_snp_type_code
Title : _snp_type_codeUsage :Function:we have to create the snp type code for each version.The way the snp type is created is the following:we take the number value for every SNP and do thefollowing calculationlet be a SNP set as follow:0 01 11 2and multiplicity 3on this case the situation is:sum (value * multiplicity ^ position) for each SNP0 * 3 ^ 0 + 1 * 3 ^ 1 + 1 * 3 ^ 2 = 120 * 3 ^ 0 + 1 * 3 ^ 1 + 2 * 3 ^ 2 = 21Returns : nothingArgs : $selfStatus : private
_alleles_number
Title : _alleles_numberUsage :Function: calculate the max number of alleles for a haplotype andif the number. For each SNP the number is stored and themax number of alleles for a SNP on the set is returnedReturns : max number of alleles (a scalar storing a number)Args : ref to AoAStatus : public
_htSNP
Title : _htSNPUsage : _htSNP()Function: calculate the minimal set that contains all information of thehaplotype.Returns : nonthingArgs : ref to an AoA and a ref to an arrayStatus : internal
_snp_and_code_summary
Title : _snp_and_code_summaryUsage : _snp_and_code_summary()Function: compile on a list all SNP and the code for each. Thisinformation can be also obtained combining snp_type andsnp_type_code but on these results the information aboutthe rest of SNP's are not compiled as table.0 will be silent SNPs-1 are degenerated SNPsand the rest of positive values are the code for useful SNPReturns : nonthingArgs : ref to an AoA and a ref to an arrayStatus : internal