unidec.IsoDec.IsoGen package¶
Submodules¶
unidec.IsoDec.IsoGen.isogen_base module¶
- class unidec.IsoDec.IsoGen.isogen_base.HighMassNeuralNetwork(isolen=1024, vectorlen=6)¶
Bases:
Module
Very simple neural net for generating the isotope distirbution.
- forward(x)¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class unidec.IsoDec.IsoGen.isogen_base.IsoGenDatasetBase(inputs, dists, vectors)¶
Bases:
Dataset
Dataset class for IsoGen
- class unidec.IsoDec.IsoGen.isogen_base.IsoGenEngineBase(isolen=128)¶
Bases:
object
- check(seq)¶
- create_data_loaders(traindata, testdata, batchsize=32, testbatchsize=2048)¶
- inputs_to_vectors(inputs)¶
- predict(seq)¶
- setup_data(dists, seqs, trainper=0.9)¶
- train(train_fname, epochs=10, forcenew=False, inputname=None)¶
- train_multiple(train_fnames, epochs=10, forcenew=False, inputname=None)¶
- class unidec.IsoDec.IsoGen.isogen_base.IsoGenModelBase(working_dir=None, isolen=128, vectorlen=20, savename='isogenpep_model_', modelid=0)¶
Bases:
object
General model class for isotope distrubution generation.
Includes functions to train, evaluate, and predict isotope distributions.
- batch_predict(vectors)¶
Predict the isotope distribution for a list of masses :param masses: List of mass values :return: Predicted isotope distribution intensity vectors
- evaluate_model(dataloader)¶
Evaluate the model on a test set. :param dataloader: Test DataLoader object :return: None
- get_model(modelid)¶
Get the model based on the model ID. :param modelid: Model ID integer. Options are 0, 1, and 2. :return: None
- load_model()¶
Load model from savepath. :return: None
- predict(vec)¶
Predict the isotope distribution for a given mass :param mass: Mass value :return: Predicted isotope distribution intensity vector
- run_training(train_dataloader, test_dataloader, epochs=10, lossfn='mse', forcenew=False, save=True)¶
- save_model()¶
Save model to savepath. :return: None
- setup_model(modelid=None, forcenew=False)¶
Setup model and load if savepath exists. Set device. :param modelid: Model ID passed to self.get_model() :param forcenew: Whether to force starting over from scratch on model parameters :return: None
- setup_training(lossfn='mse', forcenew=False)¶
” Setup loss function, optimizer, and scheduler. :param lossfn: Loss function to use. Options are “crossentropy”, “weightedcrossentropy”, and “focal”. :return: None
- train_model(dataloader, lossfn='mse', forcenew=False)¶
Train the model on a DataLoader object. :param dataloader: Training DataLoader object :param lossfn: Loss function to use. Options are “crossentropy”, “weightedcrossentropy”, and “focal”. :return: None
- class unidec.IsoDec.IsoGen.isogen_base.IsoGenNeuralNetwork(isolen=128, vectorlen=20)¶
Bases:
Module
Very simple neural net for generating the isotope distirbution.
- forward(x)¶
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- unidec.IsoDec.IsoGen.isogen_base.save_model_to_binary(model, outfile)¶
unidec.IsoDec.IsoGen.isogen_tools module¶
- unidec.IsoDec.IsoGen.isogen_tools.dnaseq_to_dist(dnaseq, isolen=128, cutoff=0.001)¶
- unidec.IsoDec.IsoGen.isogen_tools.dnaseq_to_vector(dnaseq)¶
- unidec.IsoDec.IsoGen.isogen_tools.formula_to_vector(formula)¶
Convert a chemical formula to a vector of atom counts :param formula: Chemical formula string :return: Vector of atom counts
- unidec.IsoDec.IsoGen.isogen_tools.get_dist_from_formula(formula, isolen=128, cutoff=0.001)¶
- unidec.IsoDec.IsoGen.isogen_tools.isojim(isolist, length=128)¶
Thanks to Jim Prell for Sketching this Code
- unidec.IsoDec.IsoGen.isogen_tools.makemass(testmass)¶
- unidec.IsoDec.IsoGen.isogen_tools.mass_to_dist(mass, isolength=128)¶
- unidec.IsoDec.IsoGen.isogen_tools.mass_to_vector(x)¶
- unidec.IsoDec.IsoGen.isogen_tools.peptide_to_dist(peptide)¶
- unidec.IsoDec.IsoGen.isogen_tools.peptide_to_vector(peptide)¶
- unidec.IsoDec.IsoGen.isogen_tools.rnaseq_to_dist(rnaseq, isolen=128, cutoff=0.001)¶
- unidec.IsoDec.IsoGen.isogen_tools.rnaseq_to_vector(rnaseq)¶