File: none.py

package info (click to toggle)
cnvkit 0.9.12-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 96,464 kB
  • sloc: python: 12,407; makefile: 263; sh: 84; xml: 38
file content (30 lines) | stat: -rw-r--r-- 868 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Trivial segmentation: one segment per chromosome (or arm).

Assume the input CopyNumArray has already been split by chromosome and arm (if
the centromere location can be inferred) via CNA.by_arm().

This procedure calculates a single segment's mean and coordinates across the
given array.
"""
import pandas as pd

from ..segmetrics import segment_mean


def segment_none(cnarr):
    """Return a single segment for the given region."""
    colnames = ["chromosome", "start", "end", "log2", "gene", "probes"]
    rows = [
        (
            cnarr.chromosome.iat[0],
            cnarr.start.iat[0],
            cnarr.end.iat[-1],
            segment_mean(cnarr),
            "-",
            len(cnarr),
        )
    ]
    table = pd.DataFrame.from_records(rows, columns=colnames)
    segarr = cnarr.as_dataframe(table)
    segarr.sort_columns()
    return segarr