Skip to content

Commit

Permalink
SVG/PNG export (#3)
Browse files Browse the repository at this point in the history
* Click options for helper scripts

* Patched output from SVG/PNG export; added default options
  • Loading branch information
alexpreynolds authored Oct 5, 2020
1 parent 9b39166 commit 38af4d3
Show file tree
Hide file tree
Showing 6 changed files with 300 additions and 221 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ The following options are available:
"options": {
"fontSize": 9, // font size for labels and amino acids (if available)
"fontFamily": "Helvetica",
"labelFontColor": "#222222",
"labelBackgroundColor": "#e9e9e9",
"labelFontColor": "#333333",
"labelBackgroundPlusStrandColor": "#ffffff",
"labelBackgroundMinusStrandColor": "#ffffff",
"labelStrokePlusStrandColor": "#999999",
"labelStrokeMinusStrandColor": "#999999",
"plusStrandColor": "#bdbfff", // color of coding parts of the exon on the plus strand
"minusStrandColor": "#fabec2", // color of coding parts of the exon on the negative strand
"utrColor": "#C0EAAF", // color of untranslated regions of the exons
"backgroundColor": "#ffffff", // color of track background
"transcriptHeight": 12, // height of the transcripts
"transcriptSpacing": 2, // space in between the transcripts
"name": "Gene transcripts",
Expand Down Expand Up @@ -103,7 +107,7 @@ Whenever there is a statement such as the following, assuming `higlass-transcrip
import { TranscriptsTrack } from 'higlass-transcripts';
```

Then TranscriptsTrack would automatically be imported from the `./es` directory (set via package.json's `"module"` value).
Then `TranscriptsTrack` would automatically be imported from the `./es` directory (set via package.json's `"module"` value).

## Support

Expand Down
62 changes: 35 additions & 27 deletions scripts/aggregate_transcripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,7 @@
import math
import collections as col
import json

filepath = "extracted_transcripts_20200814.txt"
#filepath = "gene_table_v2_transcripts_names_new.txt"
output_file = "transcripts_20200814.beddb"
#output_file = "transcripts_20200723_3.beddb"
importance_column = 5
has_header = False
chromosome = None
max_transcripts_per_tile = 5
tile_size = 1024
delimiter = '\t'
chromsizes_filename = 'hg38_full.txt'
offset = 0

import click

def load_chromsizes(chromsizes_filename, assembly=None):
"""
Expand Down Expand Up @@ -473,17 +460,38 @@ def line_to_np_array(line):
conn.commit()
return True

@click.command(context_settings=dict(
allow_extra_args=False,
))
@click.help_option('--help', '-h')
@click.option('-i', '--input-filename', required=True, type=str)
@click.option('-c', '--chromsizes-filename', required=True, type=str)
@click.option('-o', '--output-filename', required=True, type=str)
def main(**kwargs):
filepath = kwargs["input_filename"]
#filepath = "gene_table_v2_transcripts_names_new.txt"
output_file = kwargs["output_filename"]
#output_file = "transcripts_20200723_3.beddb"
importance_column = 5
has_header = False
chromosome = None
max_transcripts_per_tile = 5
tile_size = 1024
delimiter = '\t'
chromsizes_filename = kwargs["chromsizes_filename"]
offset = 0
aggregate_bedfile(
filepath,
output_file,
importance_column,
has_header,
chromosome,
max_transcripts_per_tile,
tile_size,
delimiter,
chromsizes_filename,
offset,
)


aggregate_bedfile(
filepath,
output_file,
importance_column,
has_header,
chromosome,
max_transcripts_per_tile,
tile_size,
delimiter,
chromsizes_filename,
offset,
)
if __name__ == '__main__':
main()
12 changes: 8 additions & 4 deletions scripts/commands.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Extract transcripts data from GTF file

python extract_transcript_data.py
python extract_transcript_data.py --input-filename annotations.gtf --chromsizes-filename chromSizes.txt --output-filename transcripts.txt

# Aggregate with clods
# Aggregate with aggregate_transcripts.py

clodius aggregate bedfile --max-per-tile 20 --importance-column 5 --chromsizes-filename chromInfo_hg38.txt --output-file transcripts_20200722.db --delimiter $'\t' gene_table_v2_transcripts_names_new.txt
python aggregate_transcripts.py --input-filename transcripts.txt --chromsizes-filename chromSizes.txt --output-filename transcripts.beddb

# Aggregate with clodius

clodius aggregate bedfile --max-per-tile 20 --importance-column 5 --chromsizes-filename chromSizes.txt --output-file transcripts.beddb --delimiter $'\t' transcripts.txt

# Ingest to server

python manage.py ingest_tileset --filename data/transcripts_20200722.db --filetype beddb --datatype gene-annotation --uid transcripts_20200722
python manage.py ingest_tileset --filename transcripts.beddb --filetype beddb --datatype gene-annotation --uid transcripts_abcd1234
Loading

0 comments on commit 38af4d3

Please sign in to comment.