Exemplo n.º 1
0
    def __init__(self, id, type, chrom, genomePos, ref, obs, coding,
                 isHomozygous, isSynonymous, experimentalDesign=None, metadata=None):
        """
        Constructor for a variant, see init-types in class parameters

        :param str id: :class:`~Fred2.Core.Variant.Variant` id
        :param type: An Enum type of the :class:`~Fred2.Core.Variant.Variant` either SNP, DEL, or INS
        :type type: :func:`~Fred2.Core.Variant.VariationType`
        :param str chrom: The chromosome on which the variant lies
        :param int genomePos: The genomic position of the :class:`~Fred2.Core.Variant.Variant`
        :param str ref: The reference seq at the genomic position
        :param str obs: The observed variation at the genomic position
        :param coding: A dictionary of associated transcripts. Key=transcript_id,
                       value=:class:`~Fred2.Core.Variant.MutationSyntax`
        :type coding: dict(str,:class:`~Fred2.Core.Variant.MutationSyntax`)
        :param bool isHomozygous: Defines if variant is homozygous or not
        :param bool isSynonymous: Defines if variant is a synonymous mutation or not
        :param str experimentalDesign: String specifying the experimental condition (e.g. tumor)
        :param dict(list) metadata: meta information (not relevant for core functionality of Fred2)
        """
        MetadataLogger.__init__(self)
        self.id = id
        self.type = type
        self.chrom = chrom
        self.genomePos = genomePos
        self.ref = ref.upper()
        self.obs = obs.upper()
        self.isHomozygous = isHomozygous
        self.isSynonymous = isSynonymous
        self.coding = coding  # dict transcript_id:MutationSyntax
        self.experimentalDesign = "" if experimentalDesign is None else experimentalDesign

        if metadata is not None:
            for meta in metadata:
                self.log_metadata(meta, metadata[meta])
Exemplo n.º 2
0
    def __init__(self, name, prob=None):
        MetadataLogger.__init__(self)
        allele = name.split("-")[-1].replace("H-2-", "")

        self.organism = "H-2"
        self.name = allele
        self.prob = prob
Exemplo n.º 3
0
 def __init__(self,
              _seq,
              gene_id="unknown",
              transcript_id=None,
              orig_transcript=None,
              vars=None):
     """
     :param str _seq: String of an IUPACProtein alphabet, representing the protein
     :param str gene_id: ID of the genome the protein originated from
     :param str transcript_id: ID of the transcript the protein originated from
     :param orig_transcript: Reference to the originating transcript object
     :type orig_transcript: :class:`~Fred2.Core.Transcript.Transcript`
     :param vars: Nonsynonymous variants that are associated with the protein. key=position within protein,
                  value=list of variants at that pos
     :type vars: dict(int,list(:class:`~Fred2.Core.Variant.Variant`))
     """
     # Init parent type:
     MetadataLogger.__init__(self)
     Seq.__init__(self, _seq.upper(), IUPAC.IUPACProtein)
     # Init own member:
     if vars is None:
         self.vars = dict()
     else:
         self.vars = vars  # {prot-position: list(variant)}
     self.orig_transcript = orig_transcript
     self.transcript_id = "Protein_%i" % Protein.newid(
     ) if transcript_id is None else transcript_id
     self.gene_id = gene_id
Exemplo n.º 4
0
 def __init__(self, _seq, _gene_id="unknown", _transcript_id=None, _orig_transcript=None, _vars=None):
     """
     :param str _seq: String of an IUPACProtein alphabet, representing the
                      protein
     :param str _gene_id: ID of the genome the protein originated from
     :param str _transcript_id: ID of the transcript the protein originated 
                                from
     :param Transcript _orig_transcript: Reference to the originating 
                                         transcript
     :param dict(int,list(Variant)) _vars: Nonsynonymous variants that are
                                           assoziated with the protein. 
                                           key=position within protein, 
                                           value=list of variants at that pos
     """
     # Init parent type:
     MetadataLogger.__init__(self)
     Seq.__init__(self, _seq.upper(), IUPAC.IUPACProtein)
     # Init own member:
     if _vars is None:
         self.vars = dict()
     else:
         self.vars = _vars  # {prot-position: list(variant)}
     self.orig_transcript = _orig_transcript
     self.transcript_id = "Protein_%i"%Protein.newid() if _transcript_id is None else _transcript_id
     self.gene_id = _gene_id
Exemplo n.º 5
0
    def __init__(self, name, prob=None):
        MetadataLogger.__init__(self)
        allele = name.split("-")[-1].replace("H-2-", "")

        self.organism = "H-2"
        self.name = allele
        self.prob = prob
Exemplo n.º 6
0
 def __init__(self, _name, prob=None):
     """
     :param str _name: input name in new nomenclature (A*01:01)
     """
     MetadataLogger.__init__(self)
     name = _name.split("-")[-1].replace("HLA-", "")
     self.name = name
     self.locus, rest = name.split('*')
     self.supertype, self.subtype = rest.split(':')[:2]
     self.prob = prob
Exemplo n.º 7
0
    def __init__(self, _seq, proteins=None, vars=None,  transcripts=None):
        """
        :param str _seq: sequence of the peptide in one letter amino acid code

        """
        MetadataLogger.__init__(self)
        Seq.__init__(self, _seq, IUPAC.IUPACProtein)
        self.proteins = {} if proteins is None else proteins
        self.vars = {} if vars is None else vars
        self.transcripts = {} if transcripts is None else transcripts
Exemplo n.º 8
0
 def __init__(self, name, prob=None):
     """
     :param str name: input name in new nomenclature (A*01:01)
     :param float prob: optional population frequency of allele in [0,1]
     """
     MetadataLogger.__init__(self)
     name = name.split("-")[-1].replace("HLA-", "")
     self.name = name
     self.locus, rest = name.split('*')
     self.supertype, self.subtype = rest.split(':')[:2]
     self.prob = prob
Exemplo n.º 9
0
 def __init__(self, _seq, _gene_id="unknown", _transcript_id=None, _vars=None):
     """
     :param str _gene_id: input genome ID
     :param str _transcript_id: input transcript RefSeqID
     :param str _seq: Transcript RefSeq sequence
     :param dict(int,Variant) _vars: a dict of transcript position to Variant that is specific to the transcript.
     """
     MetadataLogger.__init__(self)
     Seq.__init__(self, _seq.upper(), generic_rna)
     self.gene_id = _gene_id
     self.transcript_id = Transcript.newid() if _transcript_id is None else _transcript_id
     #TODO: this is not what the doc string says:
     self.vars = dict() if _vars is None else _vars
Exemplo n.º 10
0
 def __init__(self, seq, gene_id="unknown", transcript_id=None, vars=None):
     """
     :param str gene_id: Genome ID
     :param str transcript_id: :class:`~Fred2.Core.Transcript.Transcript` RefSeqID
     :param str seq: :class:`~Fred2.Core.Transcript.Transcript` sequence
     :param vars: A dict of :class:`~Fred2.Core.Transcript.Transcript` position to :class:`Fred2.Core.Variant.Variant`
                  that is specific to the :class:`~Fred2.Core.Transcript.Transcript`
     :type vars: dict(int,:class:`Fred2.Core.Variant.Variant`)
     """
     MetadataLogger.__init__(self)
     Seq.__init__(self, seq.upper(), generic_rna)
     self.gene_id = gene_id
     self.transcript_id = Transcript.newid() if transcript_id is None else transcript_id
     self.vars = dict() if vars is None else vars
Exemplo n.º 11
0
 def __init__(self, seq, gene_id="unknown", transcript_id=None, vars=None):
     """
     :param str gene_id: Genome ID
     :param str transcript_id: :class:`~Fred2.Core.Transcript.Transcript` RefSeqID
     :param str seq: :class:`~Fred2.Core.Transcript.Transcript` sequence
     :param vars: A dict of :class:`~Fred2.Core.Transcript.Transcript` position to :class:`Fred2.Core.Variant.Variant`
                  that is specific to the :class:`~Fred2.Core.Transcript.Transcript`
     :type vars: dict(int,:class:`Fred2.Core.Variant.Variant`)
     """
     MetadataLogger.__init__(self)
     Seq.__init__(self, seq.upper(), generic_rna)
     self.gene_id = gene_id
     self.transcript_id = Transcript.newid(
     ) if transcript_id is None else transcript_id
     self.vars = dict() if vars is None else vars
Exemplo n.º 12
0
    def __init__(self, name, prob=None):
        """
        :param str name: input name in new nomenclature (DPA1*01:03-DPB1*01:01)
        :param float prob: optional population frequency of allele in [0,1]
        """
        MetadataLogger.__init__(self)
        alpha_chain = name.replace("HLA-", "").split("-")[0]
        beta_chain = name.replace("HLA-", "").split("-")[1]
        name = alpha_chain+"-"+beta_chain

        self.name = name
        self.alpha_chain = alpha_chain
        self.beta_chain = beta_chain
        self.alpha_locus, alpha_rest = self.alpha_chain.split('*')
        self.alpha_supertype, self.alpha_subtype = alpha_rest.split(':')[:2]
        self.beta_locus, beta_rest = self.beta_chain.split('*')
        self.beta_supertype, self.beta_subtype = beta_rest.split(':')[:2]
        self.prob = prob
Exemplo n.º 13
0
    def __init__(self, _seq, _gene_id="unknown", _transcript_id=None, _vars=None):
        """
        :param str _gene_id: input genome ID
        :param str _transcript_id: input transcript RefSeqID
        :param str _seq: Transcript RefSeq sequence
        :param dict(int,Variant) _vars: Dict of Variants for specific positions 
                                        in the transcript. key=position, 
                                        value=Variant
        """
        MetadataLogger.__init__(self)
        Seq.__init__(self, _seq, generic_rna)
        self.gene_id = _gene_id
        self.transcript_id = Transcript.newid() if _transcript_id is None else _transcript_id
        if _vars is not None:
            self.vars = {v.get_transcript_position(_transcript_id): v \
                         for v in _vars}

        else:
            self.vars = dict()
Exemplo n.º 14
0
    def __init__(self, id, type, chrom, genomePos, ref, obs, coding,
                 isHomozygous, isSynonymous, experimentalDesign=None, metadata=None):
        """
        Constructor for a variant, see init-types in class parameters
        """
        MetadataLogger.__init__(self)
        self.id = id
        self.type = type
        self.chrom = chrom
        self.genomePos = genomePos
        self.ref = ref.upper()
        self.obs = obs.upper()
        self.gene = None
        self.isHomozygous = isHomozygous
        self.isSynonymous = isSynonymous
        self.coding = coding  # dict transcript_id:MutationSyntax
        self.experimentalDesign = "" if experimentalDesign is None else experimentalDesign

        if metadata is not None:
            for meta in metadata:
                self.log_metadata(meta, metadata[meta])
Exemplo n.º 15
0
 def __init__(self, _seq, gene_id="unknown", transcript_id=None, orig_transcript=None, vars=None):
     """
     :param str _seq: String of an IUPACProtein alphabet, representing the protein
     :param str gene_id: ID of the genome the protein originated from
     :param str transcript_id: ID of the transcript the protein originated from
     :param orig_transcript: Reference to the originating transcript object
     :type orig_transcript: :class:`~Fred2.Core.Transcript.Transcript`
     :param vars: Nonsynonymous variants that are associated with the protein. key=position within protein,
                  value=list of variants at that pos
     :type vars: dict(int,list(:class:`~Fred2.Core.Variant.Variant`))
     """
     # Init parent type:
     MetadataLogger.__init__(self)
     Seq.__init__(self, _seq.upper(), IUPAC.IUPACProtein)
     # Init own member:
     if vars is None:
         self.vars = dict()
     else:
         self.vars = vars  # {prot-position: list(variant)}
     self.orig_transcript = orig_transcript
     self.transcript_id = "Protein_%i"%Protein.newid() if transcript_id is None else transcript_id
     self.gene_id = gene_id
Exemplo n.º 16
0
    def __init__(self, id, type, chrom, genomePos, ref, obs, coding,
                 isHomozygous, isSynonymous, experimentalDesign=None, metadata=None):
        """
        Constructor for a variant, see init-types in class parameters

        :param str id: :class:`~Fred2.Core.Variant.Variant` id
        :param type: An Enum type of the :class:`~Fred2.Core.Variant.Variant` either SNP, DEL, or INS
        :type type: :func:`~Fred2.Core.Variant.VariationType`
        :param str chrom: The chromosome on which the variant lies
        :param int genomePos: The genomic position of the :class:`~Fred2.Core.Variant.Variant`
        :param str ref: The reference seq at the genomic position
        :param str obs: The observed variation at the genomic position
        :param coding: A dictionary of associated transcripts. Key=transcript_id,
                       value=:class:`~Fred2.Core.Variant.MutationSyntax`
        :type coding: dict(str,:class:`~Fred2.Core.Variant.MutationSyntax`)
        :param bool isHomozygous: Defines if variant is homozygous or not
        :param bool isSynonymous: Defines if variant is a synonymous mutation or not
        :param str experimentalDesign: String specifying the experimental condition (e.g. tumor)
        :param dict(list) metadata: meta information (not relevant for core functionality of Fred2)
        """
        MetadataLogger.__init__(self)
        self.id = id
        self.type = type
        self.chrom = chrom
        self.genomePos = genomePos
        self.ref = ref.upper()
        self.obs = obs.upper()
        self.gene = None
        self.isHomozygous = isHomozygous
        self.isSynonymous = isSynonymous
        self.coding = coding  # dict transcript_id:MutationSyntax
        self.experimentalDesign = "" if experimentalDesign is None else experimentalDesign

        if metadata is not None:
            for meta in metadata:
                self.log_metadata(meta, metadata[meta])