changeo.Gene

Gene annotations

changeo.Gene.buildClonalGermline(receptors, references, seq_field='sequence_imgt', v_field='v_call', d_field='d_call', j_field='j_call', amino_acid=False)

Determine consensus clone sequence and create germline for clone

Parameters:
  • receptors (changeo.Receptor.Receptor) – list of Receptor objects

  • references (dict) – dictionary of IMGT gapped germline sequences

  • seq_field (str) – Receptor attribute in which to look for sequence

  • v_field (str) – Receptor attributein which to look for V call

  • d_field (str) – Receptor attributein which to look for D call

  • j_field (str) – Receptor attributein which to look for J call

  • amino_acid (bool) – if True then use the amino acid positional fields, otherwise use the nucleotide fields.

Returns:

log dictionary, dictionary of {germline_type: germline_sequence},

dictionary of consensus {segment: gene call}

Return type:

tuple

changeo.Gene.buildGermline(receptor, references, seq_field='sequence_imgt', v_field='v_call', d_field='d_call', j_field='j_call', amino_acid=False)

Join gapped germline sequences aligned with sample sequences

Parameters:
  • receptor (changeo.Receptor.Receptor) – Receptor object.

  • references (dict) – dictionary of IMGT gapped germline sequences.

  • seq_field (str) – Receptor attribute in which to look for sequence.

  • v_field (str) – Receptor attribute in which to look for V call.

  • d_field (str) – Receptor attribute in which to look for V call.

  • j_field (str) – Receptor attribute in which to look for V call.

  • amino_acid (bool) – if True then use the amino acid positional fields, otherwise use the nucleotide fields.

Returns:

log dictionary, dictionary of {germline_type: germline_sequence}, dictionary of {segment: gene call}

Return type:

tuple

changeo.Gene.getAllele(gene, action='first')

Extract allele from gene call string

Parameters:
  • gene (str) – string with gene calls

  • action (str) – action to perform for multiple alleles; one of (‘first’, ‘set’, ‘list’).

Returns:

String of the first allele calls when action is ‘first’. tuple: Tuple of allele calls for ‘set’ or ‘list’ actions.

Return type:

str

changeo.Gene.getAlleleNumber(gene, action='first')

Extract allele number from gene call string

Parameters:
  • gene (str) – string with gene calls

  • action (str) – action to perform for multiple alleles; one of (‘first’, ‘set’, ‘list’).

Returns:

String of the first allele number call when action is ‘first’. tuple: Tuple of allele numbers for ‘set’ or ‘list’ actions.

Return type:

str

changeo.Gene.getCAllele(gene, action='first')

Extract C-region allele gene call string

Parameters:
  • gene (str) – string with C-region gene calls

  • action (str) – action to perform for multiple alleles; one of (‘first’, ‘set’, ‘list’).

Returns:

String of the first C-region allele call when action is ‘first’. tuple: Tuple of allele calls for ‘set’ or ‘list’ actions.

Return type:

str

changeo.Gene.getCGene(gene, action='first')

Extract C-region gene from gene call string

Parameters:
  • gene (str) – string with C-region gene calls

  • action (str) – action to perform for multiple alleles; one of (‘first’, ‘set’, ‘list’).

Returns:

String of the first C-region gene call when action is ‘first’. tuple: Tuple of gene calls for ‘set’ or ‘list’ actions.

Return type:

str

changeo.Gene.getDAllele(gene, action='first')

Extract D allele gene from gene call string

Parameters:
  • gene (str) – string with D gene calls

  • action (str) – action to perform for multiple alleles; one of (‘first’, ‘set’, ‘list’).

Returns:

String of the first D allele call when action is ‘first’. tuple: Tuple of D allele calls for ‘set’ or ‘list’ actions.

Return type:

str

changeo.Gene.getDGermline(receptor, references, d_field='d_call', amino_acid=False)

Extract D allele and germline sequence

Parameters:
  • receptor (changeo.Receptor.Receptor) – Receptor object

  • references (dict) – dictionary of germline sequences

  • d_field (str) – Receptor attribute containing the D allele assignment

  • amino_acid (bool) – if True then use the amino acid positional fields, otherwise use the nucleotide fields.

Returns:

D allele name, D segment germline sequence

Return type:

tuple

changeo.Gene.getFamily(gene, action='first')

Extract family from gene call string

Parameters:
  • gene (str) – string with gene calls

  • action (str) – action to perform for multiple alleles; one of (‘first’, ‘set’, ‘list’).

Returns:

String of the first family call when action is ‘first’. tuple: Tuple of allele calls for ‘set’ or ‘list’ actions.

Return type:

str

changeo.Gene.getGene(gene, action='first')

Extract gene from gene call string

Parameters:
  • gene (str) – string with gene calls

  • action (str) – action to perform for multiple alleles; one of (‘first’, ‘set’, ‘list’).

Returns:

String of the first gene call when action is ‘first’. tuple: Tuple of gene calls for ‘set’ or ‘list’ actions.

Return type:

str

changeo.Gene.getJAllele(gene, action='first')

Extract J allele gene from gene call string

Parameters:
  • gene (str) – string with J gene calls

  • action (str) – action to perform for multiple alleles; one of (‘first’, ‘set’, ‘list’).

Returns:

String of the first J allele call when action is ‘first’. tuple: Tuple of J allele calls for ‘set’ or ‘list’ actions.

Return type:

str

changeo.Gene.getJGermline(receptor, references, j_field='j_call', amino_acid=False)

Extract J allele and germline sequence

Parameters:
  • receptor (changeo.Receptor.Receptor) – Receptor object

  • references (dict) – dictionary of germline sequences

  • j_field (str) – Receptor attribute containing the J allele assignment

  • amino_acid (bool) – if True then use the amino acid positional fields, otherwise use the nucleotide fields.

Returns:

J allele name, J segment germline sequence

Return type:

tuple

changeo.Gene.getLocus(gene, action='first')

Extract locus from gene call string

Parameters:
  • gene (str) – string with gene calls

  • action (str) – action to perform for multiple alleles; one of (‘first’, ‘set’, ‘list’).

Returns:

String of the first locus call when action is ‘first’. tuple: Tuple of locus calls for ‘set’ or ‘list’ actions.

Return type:

str

changeo.Gene.getVAllele(gene, action='first')

Extract V allele gene from gene call string

Parameters:
  • gene (str) – string with V gene calls

  • action (str) – action to perform for multiple alleles; one of (‘first’, ‘set’, ‘list’).

Returns:

String of the first V allele call when action is ‘first’. tuple: Tuple of V allele calls for ‘set’ or ‘list’ actions.

Return type:

str

changeo.Gene.getVGermline(receptor, references, v_field='v_call', amino_acid=False)

Extract V allele and germline sequence

Parameters:
  • receptor (changeo.Receptor.Receptor) – Receptor object

  • references (dict) – dictionary of germline sequences

  • v_field (str) – Receptor attribute containing the V allele assignment

  • amino_acid (bool) – if True then use the amino acid positional fields, otherwise use the nucleotide fields.

Returns:

V allele name, V segment germline sequence

Return type:

tuple

changeo.Gene.parseGeneCall(gene, regex, action='first')

Extract alleles from strings

Parameters:
  • gene (str) – string with gene calls

  • regex (re.Pattern) – compiled regular expression for allele match

  • action (str) – action to perform for multiple alleles; one of (‘first’, ‘set’, ‘list’).

Returns:

String of the allele when action is ‘first’; tuple: Tuple of allele calls for ‘set’ or ‘list’ actions.

Return type:

str

changeo.Gene.stitchRegions(receptor, v_seq, d_seq, j_seq, amino_acid=False)

Assemble full length region encoding

Parameters:
  • receptor (changeo.Receptor.Receptor) – Receptor object

  • v_seq (str) – V segment germline sequence as a string

  • d_seq (str) – D segment germline sequence as a string

  • j_seq (str) – J segment germline sequence as a string

  • amino_acid (bool) – if True use amino acid positional fields, otherwise use nucleotide fields.

Returns:

string defining germline regions

Return type:

str

changeo.Gene.stitchVDJ(receptor, v_seq, d_seq, j_seq, amino_acid=False)

Assemble full length germline sequence

Parameters:
  • receptor (changeo.Receptor.Receptor) – Receptor object

  • v_seq (str) – V segment sequence as a string

  • d_seq (str) – D segment sequence as a string

  • j_seq (str) – J segment sequence as a string

  • amino_acid (bool) – if True use X for N/P regions and amino acid positional fields, otherwise use N and nucleotide fields.

Returns:

full germline sequence

Return type:

str