INIT / ftINIT#
MATLAB functions in RAVEN/src/INIT of the RAVEN toolbox.
Functions#
Function |
Summary |
|---|---|
Generate a model using the ftINIT algorithm. |
|
This function runs the MILP for a step in ftINIT. |
|
Generate a model using the original tINIT algorithm. |
|
Define the steps used as input to ftINIT. |
|
This function sums up the reaction scores for all reactions that were merged |
|
Simplifies a model by merging rxns with linear dependencies. There are two |
|
Parse a database dump of the Human Protein Atlas (HPA). |
|
Parse a dump of Human Protein Atlas (HPA) RNA-Seq data. |
|
Precompute omics-independent data for ftINIT. |
|
Rescale a model to avoid large stoichiometric differences. |
|
Solve the MILP of the original INIT algorithm. |
|
Score reactions and genes in a model with complex gene rules. |
Reference#
ftINIT#
function [model, metProduction, addedRxnsForTasks, deletedRxnsInINIT, fullMipRes] = ftINIT(prepData, tissue, celltype, hpaData, varargin)
Generate a model using the ftINIT algorithm.
Main function for generating a model using the ftINIT algorithm, based on proteomics and/or transcriptomics and/or metabolomics and/or metabolic tasks. The algorithm is not designed for running with metabolomics only. The function prepINITModel needs to be run first for the template model (such as the generic Human-GEM), but only needs to be run once. This function precalculates things independent of the omics to speed up the model generation process, and outputs the prepData, which is input to this function.
Parameters
prepData: structthe prepData for the model.
tissue: chartissue to score for. Should exist in either hpaData.tissues or transcrData.tissues.
celltype: charcell type to score for. Should exist in either hpaData.celltypes or transcrData.celltypes for this tissue (default is to use the max values among all the cell types for the tissue).
hpaData: structHPA data structure from parseHPA (optional if transcrData is supplied, default []).
Name-Value Arguments
transcrData: structgene expression data structure (optional if hpaData is supplied, default []). With fields:
genes : cell array with the unique gene names.
tissues : cell array with the tissue names. The list may not be unique, as there can be multiple cell types per tissue.
celltypes : cell array with the cell type names for each tissue.
levels : GENESxTISSUES array with the expression level for each gene in each tissue/celltype. NaN should be used when no measurement was performed.
threshold : a single value or a vector of gene expression thresholds, above which genes are considered to be "expressed". (default 1; by default, the mean expression levels of each gene across all tissues in transcrData will be used as the threshold values).
singleCells : binary value selecting whether to use the single-cell algorithm to identify expressed genes. If used, specify cell subpopulations in CELLTYPES (default []).
plotResults : true if single cell probability distributions should be plotted (default false).
metabolomicsData: cellcell array with metabolite names that the model should produce (default []).
INITSteps: cellspecifies the steps in the algorithm. For more info, see INITStepDesc and getINITSteps (default getINITSteps(), which is the standard ftINIT).
removeGenes: logicalif true, low-abundance genes will be removed from grRules, unless they are the only gene associated with a reaction, or a subunit of an enzyme complex (see "removeLowScoreGenes" function for details). If false, grRules will not be modified; however, genes that were associated only with removed reactions will not be present in the final model (default true).
useScoresForTasks: logicaltrue if the calculated reaction scores should be used as weights when fitting to tasks (default true).
paramsFT: structobsolete option.
verbose: logicalif true, the MILP progression will be shown (default false).
resolveTies: logicalif true, pin each step's degenerate MILP to a canonical answer instead of relying on the solver Seed alone: hold the score objective at its optimum, then minimise the count of removable ("on") reactions, then, among the sparsest, minimise their summed reaction-id rank. Applies to every main-extraction step (ftINITInternalAlg) and to the final gap-filling step (fitTasks' resolveTies) -- see raven-gecko-parity#104 and raven-toolbox's resolve_ties (default false).
proveAbsGap: doubleif set, prove each step to this fixed absolute MILP gap in a single solve, instead of the relative-gap escalation below (stp.MILPParams). The escalation's final near-zero-objective run otherwise accepts an arbitrary within-gap incumbent -- measured on genome-scale Human-GEM to return a solution 2.0-4.0 objective units below the true optimum (see raven-toolbox's prove_abs_gap and the ftINIT reproducibility study on raven-docs). 1.0 is the recommended value: tighter (down to 0.05) proves nothing further and costs substantially more runtime. Pairs naturally with resolveTies (default [], i.e. use the escalation).
Returns
model: structthe resulting model structure.
metProduction: doublearray that indicates which of the metabolites in metabolomicsData that could be produced. Note that this is before the gap-filling process to enable defined tasks. To see which metabolites that can be produced in the final model, use canExchange:
-2 : metabolite name not found in model.
-1 : metabolite found, but it could not be produced.
1 : metabolite could be produced.
addedRxnsForTasks: cellcell array of the reactions which were added in order to perform the tasks.
deletedRxnsInINIT: cellcell array of reactions deleted because they could not carry flux (INIT requires a functional input model).
fullMipRes: structthe solver results from the last MILP step run.
Notes
Exchange metabolites should normally not be removed from the model when using this approach, since checkTasks/fitTasks rely on putting specific constraints for each task. The INIT algorithm will remove exchange metabolites if any are present. Use importModel(file,false) to import a model with exchange metabolites remaining.
ftINITInternalAlg#
function [deletedRxns,metProduction,res,turnedOnRxns,fluxes]=ftINITInternalAlg(model,rxnScores,metData,essentialRxns,prodWeight,allowExcretion,remPosRev,params,startVals,fluxes,verbose,forceOn,resolveTies)
This function runs the MILP for a step in ftINIT.
model a reference model structure
rxnScores a vector of scores for the reactions in the model.
Positive scores are reactions to keep and negative
scores are reactions to exclude. Rxns set to 0 are excluded
from the problem.
metData boolean matrix with mets as rows and rxns as columns
saying which reaction produces each detected met (optional, default [])
essentialRxns cell array of reactions that are essential and that
have to be in the resulting model. This is normally
used when fitting a model to task (see fitTasks)
prodWeight a score that determines the value of having
net-production of metabolites. This is a way of having
a more functional network as it provides a reason for
including bad reactions for connectivity reasons. This
score is for each metabolite, and the sum of these weights
and the scores for the reactions is what is optimized
allowExcretion true if excretion of all metabolites should be allowed.
This results in fewer reactions being considered
dead-ends, but all reactions in the resulting model may
not be able to carry flux. If this is "false" then the
equality constraints are taken from model.b. If the
input model lacks exchange reactions then this should
probably be "true", or a large proportion of the model
would be excluded for connectivity reasons
remPosRev If true, the positive reversible reactions are removed from the problem.
This is used in step 1 of ftINIT
params parameters for the MILP, for example MIPGap and TimeLimit
startVals Start values for the MILP, typically used when rerunning
with a higher MIPGap, to use the results from the previous
run
fluxes Fluxes from the last run.
verbose If true, the MILP progression will be shown.
forceOn minimum flux magnitude enforced through a reaction once
it is turned on in the MILP (optional, default 0.1)
resolveTies if true, pin the MILP's degenerate optimum to a canonical
answer instead of relying on the solver Seed alone: hold
the score objective at its optimum, then minimise the
count of "on" removable (negative-score) reactions, then,
among the sparsest, minimise their summed reaction-id
rank. Positive-score reactions carry a continuous, not a
free binary, on/off variable (pinned near 1 by the score
objective), so only the negative-score ones are a genuine
tie to resolve -- matches raven-toolbox's resolve_ties /
_resolve_ties (raven-gecko-parity#104) (optional, default
false)
deletedRxns reactions which were deleted by the algorithm (only
rxns included in the problem)
metProduction array that indicates which of the
metabolites in presentMets that could be
produced
0: metabolite could not be produced
1: metabolite could be produced
res The result from the MILP
turnedOnRxns The reactions determined to be present (only
rxns included in the problem)
fluxes The fluxes from the MILP
This function is the actual implementation of the algorithm. See
ftINIT for a higher-level function for model reconstruction.
Usage: [deletedRxns,metProduction,res,turnedOnRxns,fluxes]=runINIT9(model,...
rxnScores,presentMets,essentialRxns,prodWeight,allowExcretion,...
remPosRev,params)
getINITModel#
function [model, metProduction, essentialRxnsForTasks, addedRxnsForTasks, deletedDeadEndRxns, deletedRxnsInINIT, taskReport]=getINITModel(refModel, tissue, varargin)
Generate a model using the original tINIT algorithm.
Generates a model using the tINIT algorithm, based on proteomics and/or transcriptomics and/or metabolomics and/or metabolic tasks (PLoS Comput Biol. 2012;8(5):e1002518, Mol Syst Biol. 2014;10:721).
ftINIT is the recommended method for context-specific model extraction. Use this function to reproduce models built with the original tINIT. It remains supported, and issues a RAVEN:legacyMethod notice once per session, which warning('off','RAVEN:legacyMethod') silences.
Not all settings are reachable through this function; runINIT and fitTasks can be called individually for the ones that are not.
Parameters
refModel: structa model structure. The model should be in the closed form (no exchange reactions open). Import using import(filename,false). If the model is not loaded using importModel, it might be that there is no "unconstrained" field. In that case, manually add the field like: model.unconstrained=false(numel(model.mets),1).
tissue: chartissue to score for. Should exist in either hpaData.tissues or arrayData.tissues.
Name-Value Arguments
celltype: charcell type to score for. Should exist in either hpaData.celltypes or arrayData.celltypes for this tissue (default is to use the best values among all the cell types for the tissue).
hpaData: structHPA data structure from parseHPA (optional if arrayData is supplied, default []).
arrayData: structgene expression data structure (optional if hpaData is supplied, default []). With fields:
genes : cell array with the unique gene names.
tissues : cell array with the tissue names. The list may not be unique, as there can be multiple cell types per tissue.
celltypes : cell array with the cell type names for each tissue.
levels : GENESxTISSUES array with the expression level for each gene in each tissue/celltype. NaN should be used when no measurement was performed.
threshold : a single value or a vector of gene expression thresholds, above which genes are considered to be "expressed". (default, by default the mean expression levels of each gene across all tissues in arrayData will be used as the threshold values).
singleCells : binary value selecting whether to use the single-cell algorithm to identify expressed genes. If used, specify cell subpopulations in CELLTYPES (default []).
plotResults : true if single cell probability distributions should be plotted (default false).
metabolomicsData: cellcell array with metabolite names that the model should produce (default []).
taskFile: chara task list in Excel format. See parseTaskList for details (default []).
useScoresForTasks: logicaltrue if the calculated reaction scores should be used as weights in the fitting to tasks (default true).
printReport: logicaltrue if a report should be printed to the screen (default true).
taskStructure: structtask structure as from parseTaskList. Can be used as an alternative way to define tasks when Excel sheets are not suitable. Overrides taskFile (default []).
params: structparameter structure for use by the INIT solver (default []).
paramsFT: structparameter structure for the fitTasks step (default []).
seed: doubleseed for the random number generator used to break ties among genes with equally uninformative (-Inf) scores, so which gene is kept is reproducible across runs (default: current rng state is left untouched).
Returns
model: structthe resulting model structure.
metProduction: doublearray that indicates which of the metabolites in metabolomicsData that could be produced. Note that this is before the gap-filling process to enable defined tasks. To see which metabolites that can be produced in the final model, use canExchange:
-2 : metabolite name not found in model.
-1 : metabolite found, but it could not be produced.
1 : metabolite could be produced.
essentialRxnsForTasks: cellcell array of the reactions which were essential to perform the tasks.
addedRxnsForTasks: cellcell array of the reactions which were added in order to perform the tasks.
deletedDeadEndRxns: cellcell array of reactions deleted because they could not carry flux (INIT requires a functional input model).
deletedRxnsInINIT: cellcell array of the reactions which were deleted by the INIT algorithm.
taskReport: structstructure with the results for each task. With fields:
id : cell array with the id of the task.
description : cell array with the description of the task.
ok : boolean array with true if the task was successful.
essential : cell array with cell arrays of essential reactions for the task.
gapfill : cell array of cell arrays of reactions included in the gap-filling for the task.
Notes
Exchange metabolites should normally not be removed from the model when using this approach, since checkTasks/fitTasks rely on putting specific constraints for each task. The INIT algorithm will remove exchange metabolites if any are present. Use importModel(file,false) to import a model with exchange metabolites remaining.
See Also
ftINIT, prepINITModel, runINIT, scoreModel
getINITSteps#
function steps = getINITSteps(varargin)
Define the steps used as input to ftINIT.
Defines the steps in the way ftINIT is run. Note that all combinations of steps will not work. Avoid "exclude" if you want to define new ways to run the algorithm.
Name-Value Arguments
metsToIgnore: structstructure describing mets that can be removed from the model before running ftINIT, such as water etc. With fields:
simpleMets.mets : names of metabolites to remove.
simpleMets.compsToKeep : compartments for which metabolites are kept.
(default []).
series: chardescribes the way to run ftINIT (default "1+1"):
"1+1" : standard behavior. Step 1 and 2 described in the paper are merged into 1.
"2+1" : the 3-step procedure described in the paper. Faster and slightly less accurate than "1+1 steps".
"1+0" : same as "1+1 steps", but skips step 3 described in the paper. This will result in a model including a lot of reactions without GPRs. It is particularly useful for structural comparison, since the reactions removed in step 3 may be a bit random and does not really add any extra information. Faster than "1+1 steps".
"2+0" : same as "2+1 steps", but skips step 3 described in the paper. Faster and slightly less accurate than "1+0 steps", but will yield similar results.
"full" : 1-step run - similar to the old tINIT version but without simplifications. Accurate, but very slow. This is mainly used for testing purposes.
Returns
steps: cellcell array of steps, used as input to ftINIT.
groupRxnScores#
function newRxnScores = groupRxnScores(model, origRxnScores, origRxnIds, groupIds, origRxnsToZero)
This function sums up the reaction scores for all reactions that were merged
into one by the linear merge.
model The model with linearly merged rxns.
origRxnScores The rxnScores from the model before the linear merge.
origRxnIds The rxn ids of the model before the linear merge.
groupIds The groupIds vector output from linearMerge.
There is one integer for each rxn in origRxnIds. 0 means
the reaction was not merged with any other reaction. A
non-zero integer means the reaction was merged with all
other rxns sharing the same integer.
origRxnsToZero A logical vector saying which of the original rxns that should not
be part of the problem; the score for these reactions is set to 0.
To keep 0 uniquely meaning "excluded", any genuine rxnScore that is
(or sums to) exactly 0 is nudged to 0.01 instead.
mergeLinear#
function [reducedModel,origRxnIds,groupIds,reversedRxns]=mergeLinear(model, noMergeRxns)
Simplifies a model by merging rxns with linear dependencies. There are two
differences from the function in simplifyModel:
1) Here we return which reactions were merged
2) Here we allow reversible reactions to be merged as well, which will
probably reduce the size of the model more.
model a model structure
noMergeRxns Cell array with reaction IDs that are not allowed to be
merged
reducedModel an updated model structure
origRxnIds Cell array: original rxn ids, used together with the groupIds variable
groupIds Vector of ids: merged rxns have the same id, same length as origRxnIds
0 means a reaction was not merged.
reversedRxns Vector of booleans, saying for each rxn if it is reversed in the combined rxns.
Usage: [reducedModel,origRxnIds,groupIds]=mergeLinear(model,noMergeRxns)
parseHPA#
function hpaData=parseHPA(fileName, varargin)
Parse a database dump of the Human Protein Atlas (HPA).
Parameters
fileName: charcomma- or tab-separated database dump of HPA protein data. For details regarding the format, see http://www.proteinatlas.org/about/download.
Name-Value Arguments
version: doubleaccepted for backward compatibility but ignored; the format is now inferred from the column headers (default 19).
Returns
hpaData: structparsed HPA data with fields:
genes : cell array with the unique gene IDs (Ensembl in v>=18)
geneNames : cell array with the gene symbols (present in v>=18 only)
tissues : cell array with the tissue names (may not be unique; one entry per tissue-cell-type combination)
celltypes : cell array with the cell type names for each tissue
levels : cell array with the unique expression level labels
types : cell array with the unique evidence types (v<18 only)
reliabilities : cell array with the unique reliability levels
gene2Level : sparse gene × tissue-cell-type matrix; value i,j is the index in hpaData.levels for gene i in tissue-cell-type j
gene2Type : sparse gene × tissue-cell-type matrix (v<18 only)
gene2Reliability : sparse gene × tissue-cell-type matrix; value i,j is the index in hpaData.reliabilities for gene i in tissue-cell-type j
Examples
hpaData = parseHPA(fileName);
parseHPArna#
function arrayData=parseHPArna(fileName, varargin)
Parse a dump of Human Protein Atlas (HPA) RNA-Seq data.
Parameters
fileName: chartab-separated database dump of HPA RNA data. For details regarding the format, see http://www.proteinatlas.org/about/download.
Name-Value Arguments
version: doubleaccepted for backward compatibility but ignored; the format is now inferred from the column headers (default 19).
Returns
arrayData: structparsed HPA RNA data with fields:
genes : cell array with the unique Ensembl gene IDs
geneNames : cell array with the gene symbols
tissues : cell array with the unique tissue (or sample) names
levels : matrix of expression values (rows = genes, cols = tissues)
Examples
arrayData = parseHPArna(fileName);
prepINITModel#
function prepData = prepINITModel(origRefModel, taskStruct, varargin)
Precompute omics-independent data for ftINIT.
Runs time-consuming calculation steps that are not dependent on the RNA-Seq data.
Parameters
origRefModel: structthe model to use. Expected to be something such as Human-GEM, Mouse-GEM, etc.
taskStruct: structthe essential tasks. Can be loaded with for example taskStruct = parseTaskList('../data/metabolicTasks_Essential.txt').
Name-Value Arguments
spontRxnNames: cellthe spontaneous rxns (default {}).
convertGenes: logicalif true the genes are converted to gene names (from ENSEMBL). This relies on translateGrRules, which is distributed with Human-GEM rather than with RAVEN, so Human-GEM has to be on the MATLAB path (default false).
customRxnsToIgnore: cellthese reactions can be ignored in the ignore mask (specifying b7=1) (default {}).
extComp: charname of the external compartment, typically 's' or 'e'. This is used for identifying exch and import rxns (default 'e').
skipScaling: logicalif true the scaling step is not run on the minimal model. The scaling is there to remove large differences between the stoichiometric coefficients within a reaction, since such differences creates numerical issues in the ftINIT algorithm due to limitations in solver resolution. However, the current scaling step is also risky and may lead to that some reactions cannot carry flux, since it changes the stoichiometry of the reactions with large differences. If you experience problems where the solution is infeasible, it may be worth trying to turn off the scaling. Note that it is only the minModel that is scaled, the scaling will not be present in the final model (default false).
runParallel: logicaltrue to run the task-essentiality check in Step 3 (checkTasks) across parallel workers, since each task is independent of the others (see parallelWorkersRAVEN). Default false, matching the previous (serial) behaviour.
Returns
prepData: structthe resulting prepData structure which is used as input to ftINIT.
rescaleModelForINIT#
function model=rescaleModelForINIT(model, varargin)
Rescale a model to avoid large stoichiometric differences.
Rescales the MILP problem in ftINIT to avoid large differences in flux magnitudes between reactions. Such differences cause among other things difficulties regarding tolerances for integer variables. For now it just scales down all reactions with high stoichiometric coefficients.
Parameters
model: structthe model to be modified (input and output).
Name-Value Arguments
maxStoichDiff: doubleall reactions with a stoichiometric coefficient higher than this will be scaled down (default 25).
Returns
model: structthe rescaled model structure.
runINIT#
function [outModel, deletedRxns, metProduction, fValue]=runINIT(model,varargin)
Solve the MILP of the original INIT algorithm.
Generates a model using the INIT algorithm, based on proteomics and/or transcriptomics and/or metabolomics and/or metabolic tasks. This function is the actual implementation of the algorithm; see getINITModel for the higher-level reconstruction function, and PLoS Comput Biol. 2012;8(5):e1002518 for the formulation.
ftINIT is the recommended method for context-specific model extraction, and solves a different MILP in ftINITInternalAlg. This function remains supported, and issues a RAVEN:legacyMethod notice once per session, which warning('off','RAVEN:legacyMethod') silences.
Parameters
model: structa reference model structure.
Name-Value Arguments
rxnScores: doublea vector of scores for the reactions in the model. Positive scores are reactions to keep and negative scores are reactions to exclude (default all 0.0).
presentMets: cellcell array with unique metabolite names that the model should produce (default []).
essentialRxns: cellcell array of reactions that are essential and that have to be in the resulting model. This is normally used when fitting a model to task (see fitTasks) (default []).
prodWeight: doublea score that determines the value of having net-production of metabolites. This is a way of having a more functional network as it provides a reason for including bad reactions for connectivity reasons. This score is for each metabolite, and the sum of these weights and the scores for the reactions is what is optimized (default 0.5).
allowExcretion: logicaltrue if excretion of all metabolites should be allowed. This results in fewer reactions being considered dead-ends, but all reactions in the resulting model may not be able to carry flux. If this is "false" then the equality constraints are taken from model.b. If the input model lacks exchange reactions then this should probably be "true", or a large proportion of the model would be excluded for connectivity reasons (default false).
noRevLoops: logicaltrue if reversible reactions should be constrained to only carry flux in one direction. This prevents reversible reactions from being wrongly assigned as connected (the forward and backward reactions can form a loop and therefore appear connected), but it makes the problem significantly more computationally intensive to solve (two more integer constraints per reversible reaction) (default false).
params: structparameter structure for use by optimizeProb.
Returns
outModel: structthe resulting model structure.
deletedRxns: cellreactions which were deleted by the algorithm.
metProduction: doublearray that indicates which of the metabolites in presentMets that could be produced:
-2 : metabolite name not found in model.
-1 : metabolite found, but it could not be produced.
1 : metabolite could be produced.
fValue: doubleobjective value (sum of (the negative of) reaction scores for the included reactions and prodWeight*number of produced metabolites).
See Also
getINITModel, ftINITInternalAlg, ftINIT
scoreModel#
function [rxnScores, geneScores, hpaScores, arrayScores] = scoreModel(model,hpaData,arrayData,tissue,varargin)
Score reactions and genes in a model with complex gene rules.
Scores the reactions and genes in a model containing complex gene rules based on expression data from HPA and/or gene arrays.
It is highly recommended that the model grRules are "cleaned" and verified by the "cleanModelGeneRules" function prior to scoring the model with scoreModel.
Parameters
model: structa model structure.
hpaData: structHPA data structure from parseHPA (optional if arrayData is supplied, default []).
arrayData: structgene expression data structure (optional if hpaData is supplied, default []). With fields:
genes : cell array with the unique gene names.
tissues : cell array with the tissue names. The list may not be unique, as there can be multiple cell types per tissue.
celltypes : cell array with the cell type names for each tissue.
levels : GENESxTISSUES array with the expression level for each gene in each tissue/celltype. NaN should be used when no measurement was performed.
threshold : a single value or a vector of gene expression thresholds, above which genes are considered to be "expressed". (optional, by default, the mean expression levels of each gene across all tissues in arrayData will be used as the threshold values).
tissue: chartissue to score for. Should exist in either hpaData.tissues or arrayData.tissues.
Name-Value Arguments
celltype: charcell type to score for. Should exist in either hpaData.celltypes or arrayData.celltypes for this tissue (default is to use the max values among all the cell types for the tissue).
noGeneScore: doublescore for reactions without genes (default -2).
isozymeScoring: chardetermines how scores are calculated for reactions with multiple genes joined by "OR" expression(s) ("min", "max", "median", "average") (default "max").
complexScoring: chardetermines how scores are calculated for reactions with multiple genes joined by "AND" expression(s) ("min", "max", "median", "average") (default "min").
multipleCellScoring: chardetermines how scores are calculated when several cell types are used ("max" or "average") (default "max").
hpaLevelScores: structstructure with numerical scores for the expression level categories from HPA. The structure should have a "names" and a "scores" field (default, see code for default scores).
dataPrecedence: charhow hpaData takes precedence over arrayData when both are supplied (default "gene"):
"gene" : per gene. A gene with HPA data is scored from it, a gene without is scored from arrayData, and a rule can mix the two.
"reaction" : per rule. As soon as any one gene in a rule has HPA data, the whole rule is scored from HPA alone and its array-only genes count as unmeasured.
Returns
rxnScores: doublescores for each of the reactions in model.
geneScores: doublescores for each of the genes in model. Genes which are not in the dataset(s) have NaN as scores, which removeLowScoreGenes reads as "no evidence" and leaves in place, where a negative score would be pruned.
hpaScores: doublescores for each of the genes in model if only taking hpaData into account. Genes which are not in the dataset(s) have -Inf as scores.
arrayScores: doublescores for each of the genes in model if only taking arrayData into account. Genes which are not in the dataset(s) have -Inf as scores.