## Using spectral-counts

After you have run a search and assigned confidence to your identified PSMs, you can now calculate relative quantification values for the proteins by running the command:

`$ crux spectral-counts --threshold 0.1 --protein-database small-yeast.fasta ./crux-output/percolator.target.psms.txt`

While the command is running, you will see output like this

    INFO: CPU: guanine.gs.washington.edu
    INFO: Crux version: 4.0-ad795d65-2021-08-23
    INFO: Tue Sep 14 21:35:02 PDT 2021
    INFO: Beginning spectral-counts.
    INFO: Total proteins found: 56
    INFO: Assigning index 0 to ./crux-output/percolator.target.psms.txt.
    INFO: Number of matches:9134
    INFO: Number of matches passed the threshold 1515
    INFO: Number of peptides 758
    INFO: Number of proteins 54
    INFO: Elapsed time: 0.263 s
    INFO: Finished crux spectral-counts.
    INFO: Return Code:0

The crux-output directory will now contain three new files:

1. spectral-counts.target.txt – tab-delimited file containing the `spectral-counts` results
2. spectral-counts.params.txt – parameter file
3. spectral-counts.log.txt – log file.

The spectral-counts.target.txt file will look something like:

    protein id	NSAF
    YGR192C	0.14454275
    YCR012W	0.07278429
    YBR118W	0.070475481
    YLL024C	0.045148738
    YOR063W	0.045023989
    YDR064W	0.039725326
    YLR043C	0.027732428
    YLR249W	0.027634142

In this output, the first field is the identifier and the second field is the spectral-counting measure (NSAF, dNSAF, SIN, or EMPAI) result for each protein. To select which measure is computed, see the crux spectral-counts documentation.

### Using peptideprophet probability from pepXML

`crux spectral-counts` also supports using Peptide Prophet probabilities provided in a pepXML file. Use the command:

`$ crux spectral-counts --protein-database small-yeast.fasta --threshold-type custom --custom-threshold-name peptideprophet --threshold 0.9 --custom-threshold-min F target.pep.xml`
This command will filter out matches whose Peptide Prophet probability is < 0.9 and calculate NSAF for the proteins of the remaining PSMs.

### Using mzIdentML files with spectral-counts

`crux spectral-counts` also supports mzIdentML as input. For example,

$ crux spectral-counts --measure RAW file.mzid

If the protein sequences are not provided within the given mzIdentML file, then you will have to provide a database using the protein-database parameter for the NSAF, dNSAF, EMPAI, and SIN metrics.