Exemple #1
0
def get_sufficient_psi_exons(name, target, sGraph, genome, ID, cutoff, upstream_exon, downstream_exon):
    """
    Utilizes the ExonSeek class to find flanking exons that are
    good enough to be called "constitutive".
    """
    # find appropriate flanking "constitutive" exon for primers
    exon_seek_obj = ExonSeek(target, sGraph, ID, cutoff, upstream_exon, downstream_exon)
    all_paths, upstream, downstream, component, psi_target, psi_upstream, psi_downstream = exon_seek_obj.get_info()

    # lack of successor/predecessor nodes
    if upstream is None or downstream is None:
        logging.debug("Error: %s does not have an upstream exon, downstream exon, or possibly both" % str(component))
        return ["Error: %s does not have an upstream exon, downstream exon, or possibly both" % str(component)]

    # get sequence of upstream/target/downstream combo
    genome_chr = genome[sGraph.chr]  # chr object from pygr
    upstream_seq, target_seq, downstream_seq = genome_chr[upstream[0]:upstream[1]], genome_chr[target[0]:target[1]], genome_chr[downstream[0]:downstream[1]]  # get sequence using pygr
    if sGraph.strand == '-':
        upstream_seq, target_seq, downstream_seq = -upstream_seq, -target_seq, -downstream_seq  # get reverse-complement if necessary

    return [sGraph.strand, name[1:], psi_target,
            sGraph.chr + ':' + '-'.join(map(str, upstream)),  # upstream eg. +chr1:1000-2000
            psi_upstream,
            sGraph.chr + ':' + '-'.join(map(str, downstream)),  # downstream eg. +chr1:1000-2000
            psi_downstream,
            all_paths, upstream_seq,
            target_seq, downstream_seq]
def get_sufficient_psi_exons(name, target, sGraph, genome, ID, cutoff,
                             upstream_exon, downstream_exon):
    """
    Utilizes the ExonSeek class to find flanking exons that are
    good enough to be called "constitutive".
    """
    # find appropriate flanking "constitutive" exon for primers
    exon_seek_obj = ExonSeek(target, sGraph, ID, cutoff, upstream_exon,
                             downstream_exon)
    all_paths, upstream, downstream, component, psi_target, psi_upstream, psi_downstream = exon_seek_obj.get_info(
    )

    # lack of successor/predecessor nodes
    if upstream is None or downstream is None:
        logging.debug(
            "Error: %s does not have an upstream exon, downstream exon, or possibly both"
            % str(component))
        return [
            "Error: %s does not have an upstream exon, downstream exon, or possibly both"
            % str(component)
        ]

    # get sequence of upstream/target/downstream combo
    genome_chr = genome[sGraph.chr]  # chr object from pygr
    upstream_seq, target_seq, downstream_seq = genome_chr[
        upstream[0]:upstream[1]], genome_chr[target[0]:target[1]], genome_chr[
            downstream[0]:downstream[1]]  # get sequence using pygr
    if sGraph.strand == '-':
        upstream_seq, target_seq, downstream_seq = -upstream_seq, -target_seq, -downstream_seq  # get reverse-complement if necessary

    return [
        sGraph.strand,
        name[1:],
        psi_target,
        sGraph.chr + ':' +
        '-'.join(map(str, upstream)),  # upstream eg. +chr1:1000-2000
        psi_upstream,
        sGraph.chr + ':' +
        '-'.join(map(str, downstream)),  # downstream eg. +chr1:1000-2000
        psi_downstream,
        all_paths,
        upstream_seq,
        target_seq,
        downstream_seq
    ]
def primerseq_defined_exons(tmp_sg, line, psi_option):
    """
    Get information about counts and paths if using PrimerSeq to define the flanking exons.
    """
    # not the best use of the ExonSeek object, initially intended to find appropriate flanking exons
    # but in this case ExonSeek is used to get the transcripts and associate counts
    ID = line[utils.ID]
    tgt_pos = utils.get_pos(line[utils.TARGET])
    exon_seek_obj = ExonSeek(
        tgt_pos,
        tmp_sg,
        ID,
        psi_option,
        None,  # no defined upstream exon
        None)  # no defined downstream exon
    all_paths, upstream, downstream, component, psi_target, psi_upstream, psi_downstream = exon_seek_obj.get_info(
    )
    return exon_seek_obj.paths, exon_seek_obj.counts
Exemple #4
0
def primerseq_defined_exons(tmp_sg, line, psi_option):
    """
    Get information about counts and paths if using PrimerSeq to define the flanking exons.
    """
    # not the best use of the ExonSeek object, initially intended to find appropriate flanking exons
    # but in this case ExonSeek is used to get the transcripts and associate counts
    ID = line[utils.ID]
    tgt_pos = utils.get_pos(line[utils.TARGET])
    exon_seek_obj = ExonSeek(tgt_pos,
                             tmp_sg,
                             ID,
                             psi_option,
                             None,  # no defined upstream exon
                             None)  # no defined downstream exon
    all_paths, upstream, downstream, component, psi_target, psi_upstream, psi_downstream = exon_seek_obj.get_info()
    return exon_seek_obj.paths, exon_seek_obj.counts