viola.Bedpe
- class Bedpe(df_svpos: DataFrame, odict_df_info: OrderedDict[str, DataFrame], patient_name=None)
Relational database-like object containing SV position dataframes and INFO dataframes. The instances of this class have information equal to the BEDPE files. …
- Variables
sv_count (int) – Number of SV records
table_list – List of names of all tables included in the object
ids – List of all SV id.
patient_name – Patient name.
- Parameters
df_svpos (DataFrame) – DataFrame containing information such as position, strand, svtype, etc. Columns should be following: [‘id’, ‘chrom1’, ‘pos1’, ‘chrom2’, ‘pos2’, ‘strand1’, ‘strand2’, ‘ref’, ‘alt’, ‘qual’, ‘svtype’] Main key is ‘id’.
odict_df_info (dict[str, DataFrame]) – OrderedDict of DataFrames which contain additional information on SV record (equivalent to INFO field of vcf). Each item of the dictionary contains single INFO. The dictionary key is the name of each INFO and should be in lowercase. Columns of the DataFrame should be following: [‘id’, ‘value_idx’, ‘infoname’] The ‘value_idx’ column contains 0-origin indice of INFO values. This is important when one SV record has multiple values of an INFO (eg. cipos). Main key is the combination of (‘id’, ‘value_idx’) and ‘id’ is the foreign key coming from df_svpos table.
- get_table(table_name)
Return a table specified in the argument as pandas DataFrame object.
- to_bedpe_like(custom_infonames=[], confidence_intervals=False)
Return a DataFrame in bedpe-like format.
- filter(ls_query, query_logic='and')
Filter Bedpe object by the list of queries. Return object is also an instance of the Bedpe object
- filter_by_id(arrlike_id)
Filter Bedpe object according to the list of SV ids. Return object is also an instance of the Bedpe object
- __init__(df_svpos: DataFrame, odict_df_info: OrderedDict[str, DataFrame], patient_name=None)
Methods
__init__(df_svpos, odict_df_info[, patient_name])add_info_table(table_name, df)Add a new INFO table to self.
annotate_bed(bed, annotation[, suffix])Annotate SV breakpoints using Bed class object.
append_infos(base_df, ls_tablenames[, left_on])Append INFO tables to the right of the base_df, based on the SV id columns.
calculate_info(operation, name)Calculate values of INFO tables according to the 'operation' argument and add a new INFO table as the result.
change_repr_config(key, value)classify_manual_svtype(definitions, ...[, ...])Classify SV records by user-defined criteria.
copy()Return copy of the instance
filter(ls_query, query_logic)Filter Bedpe object by the list of queries.
filter_by_id(arrlike_id)Filter Bedpe object according to the list of SV ids.
get_feature_count_as_series(feature, ls_order)Return counts of unique values as a pd.Series for the INFO specified in the "feature" argument.
get_ids()Return all SV ids as the set type.
get_info(info_name)Return a info specified in the argument as pandas DataFrame object.
get_microhomology(fasta[, max_homlen])Infer microhomology length and sequence in each breakpoint.
get_table(table_name)Return a table specified in the argument as pandas DataFrame object.
is_reciprocal()merge(ls_bedpe, ls_caller_names, threshold)Return a merged bedpe object from mulitple caller's bedpe objects in ls_bedpe
remove_info_table(table_name)Remove an INFO table from self.
replace_table(table_name, table)Replace existing table into new table.
set_value_for_info_by_id(table_name, sv_id, ...)Set value to the specified info table by sv_id.
to_bedpe(path_or_buf[, custom_infonames, ...])to_beddpe(path_or_buf, custom_infonames, confidence_intervals) Return a BEDPE file.
to_bedpe_like([custom_infonames, ...])Return a DataFrame in bedpe-like format.
view(custom_infonames, return_as_dataframe)Quick view function of the Vcf object.
Attributes
contigsReturn a list of contigs(chromosomes) included in the object.
Return all SV ids as list.
idxpatient_nameReturn the name of the patient.
repr_configReturn current configuration of __repr__() function.
Return number of SV records.
Return a list of names of all tables in the object.