Skip to content

Commit f6e83ca

Browse files
authored
EU-28-add-more-attachment-props (#46)
1 parent db8a842 commit f6e83ca

File tree

1 file changed

+80
-8
lines changed

1 file changed

+80
-8
lines changed

encode_utils/connection.py

Lines changed: 80 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,12 @@ def set_attachment(self, document):
655655
`dict`: The 'attachment' propery value.
656656
"""
657657
download_filename = os.path.basename(document)
658-
mime_type = mimetypes.guess_type(download_filename)[0]
658+
(mime_type, extension) = mimetypes.guess_type(download_filename)
659+
# Because the portal treats all gzipped files as application/gzip,
660+
# force the type to be application/gzip for any files with .gz
661+
# extension, even if the content is another type.
662+
if extension == 'gzip':
663+
mime_type = 'application/gzip'
659664
data = None
660665
if euu.is_jpg_or_tiff(document):
661666
orientation_stats = euu.orient_jpg(document)
@@ -775,15 +780,82 @@ def before_submit_attachment(self, payload):
775780
Returns:
776781
`dict`: The potentially modified payload.
777782
"""
778-
attachment_prop = "attachment"
783+
attachment_props = [
784+
"attachment",
785+
# atac_alignment_enrichment_quality_metric, chip_alignment_enrichment_quality_metric, complexity_xcorr_quality_metric
786+
"cross_correlation_plot",
787+
"gc_bias_plot",
788+
"jsd_plot",
789+
"tss_enrichment_plot",
790+
# atac_peak_enrichment_quality_metric
791+
"peak_width_distribution_plot",
792+
# atac_replication_quality_metric and chip_replication_quality_metric
793+
"idr_dispersion_plot",
794+
"idr_parameters",
795+
# dnase_alignment_quality_metric
796+
"insert_size_histogram",
797+
"insert_size_metric",
798+
"nuclear_preseq",
799+
"nuclear_preseq_targets",
800+
# dnase_footprinting_quality_metric
801+
"dispersion_model",
802+
# gembs_alignment_quality_metric
803+
"insert_size_plot",
804+
"mapq_plot",
805+
# idr_quality_metric
806+
"IDR_plot_true",
807+
"IDR_plot_rep1_pr",
808+
"IDR_plot_rep2_pr",
809+
"IDR_plot_pool_pr",
810+
"IDR_parameters_true",
811+
"IDR_parameters_rep1_pr",
812+
"IDR_parameters_rep2_pr",
813+
"IDR_parameters_pool_pr",
814+
# sc_atac_alignment_quality_metric
815+
"mito_stats",
816+
"samstats",
817+
# sc_atac_analysis_quality_metric
818+
"archr_doublet_summary_figure",
819+
"archr_fragment_size_distribution",
820+
"archr_tss_by_unique_frags",
821+
"archr_doublet_summary_text",
822+
"archr_pre_filter_metadata",
823+
# sc_atac_library_complexity_quality_metric
824+
"pbc_stats",
825+
"picard_markdup_stats",
826+
# sc_atac_multiplet_quality_metric
827+
"barcodes_status",
828+
"barcode_pairs_multiplets",
829+
"barcode_pairs_expanded",
830+
"multiplet_stats",
831+
"multiplet_threshold_plot",
832+
# sc_atac_read_quality_metric
833+
"adapter_trimming_stats",
834+
"barcode_matching_stats",
835+
"barcode_revcomp_stats",
836+
# scrna_seq_counts_summary_quality_metric
837+
"total_counts_vs_pct_mitochondria",
838+
"total_counts_vs_genes_by_count",
839+
"counts_violin_plot",
840+
# segway_quality_metric
841+
"feature_aggregation_tab",
842+
"length_distribution_tab",
843+
"segment_sizes_tab",
844+
"signal_distribution_tab",
845+
"trackname_assay",
846+
# star_solo_quality_metric
847+
"barcode_rank_plot",
848+
"sequencing_saturation_plot",
849+
]
779850
path = "path"
780851

781-
if attachment_prop in payload:
782-
val = payload[attachment_prop] # dict
783-
if path in val:
784-
# Then set the actual attachment object:
785-
attachment = self.set_attachment(document=val[path])
786-
payload[attachment_prop] = attachment
852+
for prop in attachment_props:
853+
if prop in payload:
854+
val = payload[prop] # dict
855+
if path in val:
856+
# Then set the actual attachment object:
857+
attachment = self.set_attachment(document=val[path])
858+
payload[prop] = attachment
787859
return payload
788860

789861
def before_post_file(self, payload):

0 commit comments

Comments
 (0)