<commit_before>#!/usr/bin/env python3

"""

Initially written to plot results from Priti's pipeline, where the goal was to determine
how well an assembled transcriptome (Trinity) produced contigs which covered a set of
reference transcripts.  Steps in her pipeline:

## First create symlinks:

reference.fasta - The smaller set of reference transcripts for which you want to calculate coverage
assembly.fasta - The transcriptome assem

formatdb -i assembly.fasta -p F
blastall -p blastn -d assembly.fasta -i reference.fasta -m 9 -e 1 -o assembly.btab -a 8
grep -v "#" assembly.btab | awk '{print $1"\t"$7"\t"$8"\t"$2"\t0\t+"}' > assembly.bed
bedtools sort -i assembly.bed > assembly.sorted.bed
bedtools merge -i assembly.sorted.bed > assembly.merged.bed
~/git/biocode/fasta/fasta_size_report.pl -f reference.fasta | cut -f 1,2 > transcript.lengths
#/local/projects-t3/aplysia/priti_analysis/Scripts/comp_transcript.pl --i assembly.merged.bed --i1 transcript.lengths > assembly.all.per_cov.txt
/usr/local/projects/aplysia/priti_analysis/Scripts/comp_transcript.pl --i assembly.merged.bed --i1 transcript.lengths > assembly.all.per_cov.txt

#/local/projects-t3/aplysia/priti_analysis/Scripts/longest_transcript.pl --i assembly.btab > assembly.longest.btab
/usr/local/projects/aplysia/priti_analysis/Scripts/longest_transcript.pl --i assembly.btab > assembly.longest.btab
grep -v "#" assembly.longest.btab | awk '{print $1"\t"$7"\t"$8"\t"$2"\t0\t+"}' > assembly.longest.bed
bedtools sort -i assembly.longest.bed > assembly.longest.sorted.bed
#/local/projects-t3/aplysia/priti_analysis/Scripts/comp_transcript.pl --i assembly.longest.sorted.bed --i1 transcript.lengths > assembly.longest.per_cov.txt
/usr/local/projects/aplysia/priti_analysis/Scripts/comp_transcript.pl --i assembly.longest.sorted.bed --i1 transcript.lengths > assembly.longest.per_cov.txt
"""

import argparse
import os
import plotly.plotly as py
import plotly.graph_objs as go

def main():
    parser = argparse.ArgumentParser( description='Generates a graphic showing how well reference transcripts are covered by a transcript assembly')

    ## output file to be written
    parser.add_argument('-i', '--input_files', type=str, required=True, help='Comma-separated list of cov files to be plotted' )<commit_msg>Minor: example plot command added to documentation<commit_after>#!/usr/bin/env python3

"""

Initially written to plot results from Priti's pipeline, where the goal was to determine
how well an assembled transcriptome (Trinity) produced contigs which covered a set of
reference transcripts.  Steps in her pipeline:

## First create symlinks:

reference.fasta - The smaller set of reference transcripts for which you want to calculate coverage
assembly.fasta - The transcriptome assem

formatdb -i assembly.fasta -p F
blastall -p blastn -d assembly.fasta -i reference.fasta -m 9 -e 1 -o assembly.btab -a 8
grep -v "#" assembly.btab | awk '{print $1"\t"$7"\t"$8"\t"$2"\t0\t+"}' > assembly.bed
bedtools sort -i assembly.bed > assembly.sorted.bed
bedtools merge -i assembly.sorted.bed > assembly.merged.bed
~/git/biocode/fasta/fasta_size_report.pl -f reference.fasta | cut -f 1,2 > transcript.lengths
#/local/projects-t3/aplysia/priti_analysis/Scripts/comp_transcript.pl --i assembly.merged.bed --i1 transcript.lengths > assembly.all.per_cov.txt
/usr/local/projects/aplysia/priti_analysis/Scripts/comp_transcript.pl --i assembly.merged.bed --i1 transcript.lengths > assembly.all.per_cov.txt

#/local/projects-t3/aplysia/priti_analysis/Scripts/longest_transcript.pl --i assembly.btab > assembly.longest.btab
/usr/local/projects/aplysia/priti_analysis/Scripts/longest_transcript.pl --i assembly.btab > assembly.longest.btab
grep -v "#" assembly.longest.btab | awk '{print $1"\t"$7"\t"$8"\t"$2"\t0\t+"}' > assembly.longest.bed
bedtools sort -i assembly.longest.bed > assembly.longest.sorted.bed
#/local/projects-t3/aplysia/priti_analysis/Scripts/comp_transcript.pl --i assembly.longest.sorted.bed --i1 transcript.lengths > assembly.longest.per_cov.txt
/usr/local/projects/aplysia/priti_analysis/Scripts/comp_transcript.pl --i assembly.longest.sorted.bed --i1 transcript.lengths > assembly.longest.per_cov.txt

# then to actually plot these:
~/git/biocode/sandbox/jorvis/reference_coverage_plot.py -i assembly.all.per_cov.txt,assembly.longest.per_cov.txt -l All,Longest -t "Repeat filtered Oases + Trinity, post-TGICL"

"""

import argparse
import os
import plotly.plotly as py
import plotly.graph_objs as go

def main():
    parser = argparse.ArgumentParser( description='Generates a graphic showing how well reference transcripts are covered by a transcript assembly')

    ## output file to be written
    parser.add_argument('-i', '--input_files', type=str, required=True, help='Comma-separated list of cov files to be plotted' )
{'fraction_non_alphanumeric': 0.12034145325838018, 'fraction_numerical': 0.009577347491151364, 'mean_word_length': 4.592549476135041, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1548326', 'n_tokens_mistral': 1662, 'n_tokens_neox': 1591, 'n_words': 404}