pigeon_feather.data.RangeList
- class pigeon_feather.data.RangeList(range_list_file=None, range_df=None)
- __init__(range_list_file=None, range_df=None)
A class to handle a list of peptides.
- Parameters:
range_list_file – csv file with Start, End columns
range_df – a dataframe
- Variables:
range_list – a dataframe with Start, End columns
range_set – a set of tuples (Start, End)
Methods
to_set
()convert the range list to a set of tuples (Start, End)
to_dataframe
()return the range list as a dataframe
to_csv
(path)save the range list to a csv file
union
(other)return the union of two range lists
intersection
(other)return the intersection of two range lists
difference
(other)return the difference of two range lists
pigeon_feather.data.HDXMSDataCollection
pigeon_feather.data.HDXMSData
- class pigeon_feather.data.HDXMSData(protein_name, n_fastamides=2, protein_sequence=None, saturation=1)
- __init__(protein_name, n_fastamides=2, protein_sequence=None, saturation=1)
A class to store one HDX-MS replicate data. It can contain multiple states.
- Parameters:
protein_name – string, name of the protein
n_fastamides – int, defaults to 2
protein_sequence – string
saturation – D saturation, defaults to 1
- Variables:
states – a list of ProteinState objects
Methods
add_state
(state)add a state to the HDXMSData object
load_protein_sequence
(sequence)load protein sequence to the HDXMSData object
get_state
(state_name)return a state by name
plot_res_coverage
()plot residue coverage of the protein
reindex_peptide_from_pdb
(pdb_file[, ...])reindex peptides based on the pdb file, aften there is a index offset.
to_dataframe
([if_percent])convert the HDXMSData object to a dataframe
to_bayesianhdx_format
([OUTPATH])convert the HDXMSData object to BayesianHDX format and save to a file
Attributes
num_states
return the number of states in the HDXMSData object
pigeon_feather.data.ProteinState
- class pigeon_feather.data.ProteinState(state_name, hdxms_data=None)
- __init__(state_name, hdxms_data=None)
A class to store one state of a protein. It can contain multiple peptides.
- Parameters:
state_name – name of the state
hdxms_data – HDXMSData object
- Variables:
peptides – a list of Peptide objects
if_subtracted – if subtracted peptides have been added
num_subtracted_added – number of subtracted peptides added
Methods
add_peptide
(peptide)add a peptide to the ProteinState object
num_peptides
return the number of peptides in the ProteinState
get_peptide
(identifier)return a peptide by identifier
add_new_peptides_by_subtract
()add new peptides to the protein state by subtracting the overlapped peptides
add_all_subtract
()add all possible subtracted peptides to the protein state
pigeon_feather.data.Peptide
- class pigeon_feather.data.Peptide(raw_sequence, raw_start, raw_end, protein_state=None, n_fastamides=0, RT=None)
- __init__(raw_sequence, raw_start, raw_end, protein_state=None, n_fastamides=0, RT=None)
A class to store one peptide. It can contain multiple timepoints.
- Parameters:
raw_sequence – peptide sequence
raw_start – peptide start residue number, including fastamides, 1-based
raw_end – peptide end residue number, including fastamides, 1-based
protein_state – ProteinState it belongs to
n_fastamides – number of fastamides
- Variables:
identifier – used for peptide identification, raw sequence including fastamides, e.g. “1-10 ABCDEFGHIJ”
sequence – peptide sequence excluding fastamides, 1-based
start – peptide start residue number excluding fastamides, 1-based
end – peptide end residue number, 1-based
timepoints – a list of Timepoint objects
note – a note for the peptide
Methods
add_timepoint
(timepoint)add a timepoint to the peptide
get_deut
(deut_time)return deuterium num at a specific deuteration time
get_deut_percent
(deut_time)return normalized deuterium incorporation at a specific deuteration time
get_timepoint
(deut_time[, charge_state])return a timepoint by deuteration time and charge state
pigeon_feather.data.Timepoint
- class pigeon_feather.data.Timepoint(peptide, deut_time, num_d, stddev, charge_state=None)
- __init__(peptide, deut_time, num_d, stddev, charge_state=None)
A class to store one timepoint of a peptide.
- Parameters:
peptide – Peptide object it belongs to
deut_time – deuteration time
num_d – number of deuterium incorporated
stddev – standard deviation of the number of deuterium incorporated
charge_state – charge state
Methods
load_raw_ms_csv
(csv_file)load raw mass spec data from a HDExaminer csv file
pigeon_feather.HDXStatePeptideCompares
- class pigeon_feather.data.HDXStatePeptideCompares(state1_list, state2_list)
- __init__(state1_list, state2_list)
A class to compare peptides between two states.
- Parameters:
state1_list – a list of ProteinState objects
state2_list – a list of ProteinState objects
Methods
add_all_compare
()add all possible peptide compares between two states
to_dataframe
()convert the HDXStatePeptideCompares object to a dataframe
pigeon_feather.PeptideCompare
- class pigeon_feather.data.PeptideCompare(peptide1_list, peptide2_list)
- __init__(peptide1_list, peptide2_list)
A class to compare one peptide between two states.
- Parameters:
peptide1_list – a list of Peptide objects
peptide2_list – a list of Peptide objects
- Raises:
ValueError – if peptides have different sequences
Methods
get_deut_diff
(timepoint)deuterium difference between two peptides at a specific timepoint
pigeon_feather.HDXStateResidueCompares
- class pigeon_feather.data.HDXStateResidueCompares(resids, state1_list, state2_list)
- __init__(resids, state1_list, state2_list)
A class to compare pseudo residues between two states.
- Parameters:
resids – a list of residue numbers
state1_list – a list of ProteinState objects
state2_list – a list of ProteinState objects
Methods
add_all_compare
()add all possible residue compares between two states
get_residue_compare
(resid)return a residue compare by residue number
pigeon_feather.ResidueCompare
- class pigeon_feather.data.ResidueCompare(resid, state1_list, state2_list)
- __init__(resid, state1_list, state2_list)
A class to compare one pseudo residue between two states.
- Parameters:
resid – residue number, 1-based
state1_list – a list of ProteinState objects
state2_list – a list of ProteinState objects
Methods
find_peptides_containing_res
(state_list)find peptides containing the residue in a state list
get_deut_diff
(timepoint)deuterium difference between two residues at a specific timepoint
pigeon_feather.SimulatedData
- class pigeon_feather.data.SimulatedData(length=100, seed=42, noise_level=0, saturation=1.0, random_backexchange=False)
- __init__(length=100, seed=42, noise_level=0, saturation=1.0, random_backexchange=False)
A class to generate simulated HDX-MS data.
- Parameters:
length – protein length, defaults to 100
seed – random seeds, defaults to 42
noise_level – noise add to the isotopic envelope
Methods
gen_seq
()generate a random protein sequence of the given length
gen_logP
()cal_k_init
()calculate intrinsic exchange rate for each residue
cal_k_ex
()calculate exchange rate for each residue
calculate_incorporation
()calculate deuterium incorporation for each residue
gen_peptides
([min_len, max_len, ...])generate random peptides from the protein sequence
convert_to_hdxms_data
()convert the simulated data to a HDXMSData object
pigeon_feather.plot.UptakePlotsCollection
- class pigeon_feather.plot.UptakePlotsCollection(color_dict=None, if_plot_fit=True, pdb_file=None)
- __init__(color_dict=None, if_plot_fit=True, pdb_file=None)
A class to store multiple UptakePlot objects
- Parameters:
color_dict – a dictionary of colors for each state, e.g. {‘state1’: ‘red’, ‘state2’: ‘blue’}
if_plot_fit – if True, plot the fit line
Methods
add_plot
(hdxms_datas, idf[, ...])add a UptakePlot of a peptide to the collection
add_plot_all
(hdxms_datas)add UptakePlot objects of all peptides to the collection
save_plots
(path)save all plots to a folder
pigeon_feather.plot.UptakePlot
- class pigeon_feather.plot.UptakePlot(hdxms_datas, identifier: str, states_subset=None, color_dict=None, if_plot_fit=True, figure=None, ax=None, if_d_percent=False, exp_only=False)
- __init__(hdxms_datas, identifier: str, states_subset=None, color_dict=None, if_plot_fit=True, figure=None, ax=None, if_d_percent=False, exp_only=False)
hdxms_datas: list of class HDXMSData objects
- Parameters:
hdxms_datas – list of HDXMSData objects
identifier – peptide identifier
states_subset – list of states to plot
color_dict – dictionary of colors for each state
if_plot_fit – if True, plot the fit line
figure – figure object
ax – axis object
- Variables:
hdxms_datas_df – pandas DataFrame of the HDX-MS data of the peptide
Methods
make_uptakeplot
()make a uptakeplot for a peptide
get_average_peptide
(state_name)return an averaged peptide for a state
make_title
()make a title for the plot
make_color_dict
([color_dict])make a color dictionary for the states in the plot