项目作者: dn070017

项目描述 :
QuantEval is an analysis pipeline which evaluate the reliability of quantification tools.
高级语言: Python
项目地址: git://github.com/dn070017/QuantEval.git
创建时间: 2017-09-26T07:09:32Z
项目社区:https://github.com/dn070017/QuantEval

开源协议:

下载


QuantEval

About

QuantEval was released for two purposes: 1. a user can use the scripts in QuantEval to reproduce all the analyses in the following study (Hsieh et al.); 2. a user can follow the example in QuantEval to conduct the same analyses on his own study. For the first purpose, there are three modes in the QuantEval main program. (1) Reference Mode, (2) Contig Mode and (3) Match Mode. The first two modes read the quantification results and build a ambiguity cluster based on connected components for the reference transcripts and contig sequences. The match mode builds relations between contigs and reference transcripts. For the second purpose, the users are encouraged to follow the provided example to conduct new analyses on his own data.

Reference

Ping-Han Hsieh, Yen-Jen Oyang and Chien-Yu Chen. Effect of de novo transcriptome assembly on transcript quantification. Scientific Reports volume 9, Article number: 8304 (2019).

Requirement

  • QuantEval main program:
    • Python3 (3.5.2)
    • Python packages: pandas (0.20.3), numpy (1.12.1)
  • Generate figures and table:
    • R (3.3.0)
    • R pacakges: gridExtra, grid, stats, tidyverse, plyr, ggplot2, reshape2
  • Utilities:
    • Bowtie2 (2.3.0), BLASTn (2.5.0), Flux Simulator (1.2.1), RSEM (1.2.31), Kallisto (0.43.0), rnaSPAdes (3.11.1), Salmon (0.8.2), Trans-ABySS (1.5.5), TransRate (1.0.3), Trinity (2.4.0)

Manual

  • Run QuantEval individually:
    1. python3 ./scripts/QuantEval.py --reference --contig --match --input input.json
    The first three parameters (—reference, —contig, —match) indicate which mode to run and the input.json file specifies the input parameters for the QuantEval main program. The three modes can be run independantly, but one has to run both reference mode and contig mode before running the match mode. It is recommended to run three modes in sequential. Because the main program of QuantEval does not include a wrapper for quantification/sequence alignment/contig evaluation, which are essesntial steps for QuantEval main program, one might need to run quantification algorithms (i.e. RSEM/Kallisto/Salmon), sequence alignment (BLASTn) and contig evaluation (Transrate) by themselves in order to get similar analysis results in the reference research.

Below, we use an example dataset to explain how to use QuantEval. This example contains the following files:

  • ref.fasta: the reference transcripts (In real applications, you will not have this file for the speices without reference transcripts)
  • contig.fasta: the contigs assembled by short reads, e.g. read_1.fastq and read_2.fastq
  • read_1.fastq read_2.fastq

    Before running QuantEval,

  • Run pairwise BLASTn for reference/contig mode:

    1. # reference mode
    2. blastn -db ref.fasta -query ref.fasta -outfmt 6 -evalue 1e-5 -perc_identity 95 -out ./blastn/ref.self.tsv
    3. # contig mode
    4. blastn -db contig.fasta -query contig.fasta -outfmt 6 -evalue 1e-5 -perc_identity 95 -out ./blastn/contig.self.tsv
  • Run BLASTn for the mapping of reference and contig sequence (match mode)
    1. blastn -db ref.fasta -query contig.fasta -outfmt 6 -out ./blastn/contig_to_ref.tsv
  • Run quantification for reference/contig mode with default parameters:

    1. # RSEM
    2. rsem-prepare-reference --bowtie2 ref.fasta ./rsem/rsem.index
    3. rsem-calculate-expression --paired-end --strandedness none --bowtie2 --time ref_read/read_1.fastq ref_read/read_2.fastq ./rsem/rsem.index ./rsem/rsem
    4. # Kallisto
    5. kallisto index -i ./kallisto/kallisto.index -k 31 ref.fasta
    6. kallisto quant -i ./kallisto/kallisto.index -o ./kallisto ref_read/read_1.fastq ref_read/read_2.fastq
    7. # Salmon
    8. salmon index -i ./salmon/salmon.index -t ref.fasta --type quasi -k 31
    9. salmon quant -i ./salmon/salmon.index -l A -1 ref_read/read_1.fastq -2 ref_read/read_2.fastq -o ./salmon
  • Run TransRate for reference/contig mode:

    1. # reference mode
    2. transrate --assembly ref.fasta --output ./transrate/ref --left ref_read/read_1.fastq --right ref_read/read_2.fastq
    3. # contig mode
    4. transrate --assembly contig.fasta --output ./transrate/ref --left contig_read/read_1.fastq --right contig_read/read_2.fastq
  • Example of input.json:
    1. {
    2. "ref_fasta": "ref.fasta",
    3. "ref_blastn": "./blastn/ref.self.tsv",
    4. "ref_gtf": "ref.gtf",
    5. "ref_xprs_file": ["./answer/answer_xprs.tsv",
    6. "./kallisto/ref/abundance.tsv",
    7. "./rsem/ref/rsem.isoforms.results",
    8. "./salmon/ref/quant.sf"],
    9. "ref_xprs_label": ["answer", "kallisto", "rsem", "salmon"],
    10. "ref_xprs_header": [true, true, true, true],
    11. "ref_xprs_name_col": [1, 1, 1, 1],
    12. "ref_xprs_tpm_col": [2, 5, 6, 4],
    13. "ref_xprs_count_col": [3, 4, 5, 5],
    14. "ref_transrate": "./transrate/ref/contigs.csv",
    15. "contig_fasta": "contig.fasta",
    16. "contig_blastn": "./blastn/contig.self.tsv",
    17. "contig_xprs_file": ["./kallisto/contig/abundance.tsv",
    18. "./rsem/contig/rsem.isoforms.results",
    19. "./salmon/contig/quant.sf"],
    20. "contig_xprs_label": ["kallisto", "rsem", "salmon"],
    21. "contig_xprs_header": [true, true, true],
    22. "contig_xprs_name_col": [1, 1, 1],
    23. "contig_xprs_tpm_col": [5, 6, 4],
    24. "contig_xprs_count_col": [4, 5, 5],
    25. "contig_transrate": "./transrate/contig/contigs.csv",
    26. "match_blastn": "./blastn/contig_to_ref.tsv",
    27. "output_dir": "./QuantEval/"
    28. }

  • Run example:
    1. cd example
    2. python3 ../scripts/QuantEval.py --reference --contig --match --input ./example.json

One can also import the functions in utilities.py to built their own analysis pipeline.

  • Construct connected component for reference only:
    ```python
    from utilities import construct_sequence, filter_blastn, intersect_match, construct_grap
    import copy

input_file = dict()
input_file[“contig_ref_file”] = [“./answer/answer_xprs.tsv”,
“./kallisto/abundance.tsv”,
“./rsem/rsem.isoforms.results”,
“./salmon/quant.sf”]
input_file[“ref_xprs_label”]: [“answer”, “kallisto”, “rsem”, “salmon”],
input_file[“ref_xprs_header”]: [true, true, true, true],
input_file[“ref_xprs_name_col”]: [1, 1, 1, 1],
input_file[“ref_xprs_tpm_col”]: [2, 5, 6, 4],
input_file[“ref_xprs_count_col”]: [3, 4, 5, 5],
ref_seq_dict = construct_sequence(‘ref.fasta’)
ref_self_blastn = filter_blastn(‘./blastn/ref.self.tsv’)
read_expression(input_file, ref_seq_dict, ‘ref’)
ref_self_match_dict = intersect_match(ref_self_blastn, ref_seq_dict, copy.deepcopy(ref_seq_dict))
ref_uf, ref_component_dict = construct_graph(ref_seq_dict, ref_self_match_dict)

print(ref_uf.component_label)
print(ref_uf.parent)

  1. ___
  2. - Run all the analysis in the study (<b>time consuming</b>):
  3. ```shell
  4. ./pipelines/run_analysis.sh

  • Output format
column description
match_name alignment (ref.contig.strand)
contig_name target contig name
ref_name target ref name
accuracy accuracy of the alignment
recovery recovery of the alignment
contig/ref_length length of contig/ref
contig/ref_tr_transrate_score transrate score of contig/ref
contig/ref_xprs_tpm/count_quantifier quantification result of contig/ref
contig/ref_component label of connected component of contig/ref
contig/ref_component_size number of sequences in the connected component of contig/ref
contig/ref_componentcontribute_xprstpm/count_quantifier proportion of TPM/read count (RPEA) in the connected component of contig/ref
contig/ref_componentrelative_xprstpm/count_quantifier TPM/count of contig/ref / highest TPM/count in the same connected component
contig/ref_componentmax_xprstpm/count_quantifier highest TPM/count of contig/ref in the same connected component
contig/ref_componentavg_xprstpm/count_quantifier average TPM/count of contig/ref in the same connected component
contig/ref_componenttot_xprstpm/count_quantifier total TPM/count of contig/ref in the same connected component
refgene_contribute_xprstpm/count_quantifier proportion of TPM/read count in the gene of ref
refgene_relative_xprstpm/count_quantifier TPM/count of ref / highest TPM/count in the same gene
refgene_max_xprstpm/count_quantifier highest TPM/count of ref in the same gene
refgene_avg_xprstpm/count_quantifier average TPM/count of ref in the same gene
refgene_tot_xprstpm/count_quantifier total TPM/count of ref in the same gene
length_difference the difference of length between contig and reference
xprstpm/count_errorquantifier quantificaion error for the estimated abundance of contig

Note that this is the superset of the output fields (the match mode). The content of output will be different depends on reference/contig/match mode (e.g. one can only find the columns start with contig from contig mode), but one can find all the description on the table above.