#!/usr/bin/env python
from sdm_curl import Curl
import socket
import re
if re.match(".*\.jgi$",socket.gethostname()):
  host = "dori"
else:
  host = "perlmutter"
# Missing values for curl
# curl = Curl('https://jamo.jgi.doe.gov',appToken='None')
## file /global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.protein_primaryTranscriptOnly.fa.gz
print (curl.post('api/metadata/file',
  file='/global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.protein_primaryTranscriptOnly.fa.gz',
  file_type='fasta',
  put_mode='Replace_If_Newer',
  destination='phytozome/EgrandisvarTAG0014HAP1/v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.protein_primaryTranscriptOnly.fa.gz',
  source=host,
  metadata={
       'type' : 'annotation/gene',
       'subtype' : 'sequence',
       'content' : 'protein',
       'publication_status' : 'unpublished',
       'source' : 'nuclear',
       'collection' : 'all',
       'format' : 'fasta',
       'ncbi_taxon_id' : 71139,
       'portal' : { 
           'identifier' :['EucgraStandDraft_FD'],
           'display_location' :{'EucgraStandDraft_FD':['Annotation']} }, 
       'analysis_task_id' : 572294,
       'analysis_project_id' : 1483335,
       'analysis_task_id' : 572295,
       'analysis_task_id' : 572296,
       'phytozome':{
         'phytozome_release_id':['14', 'current'],
         'annotation_version':'v4.2',
         'assembly_version':'v4.0',
         'proteome_name':'Eucalyptus grandis var. TAG0014 HAP1',
         'proteome_id':993,
         'phytozome_genome_id':993,
         'version':'v4.2',
         'Gspecies':'EgrandisvarTAG0014HAP1',
         'data_release_policy':'restricted',
                   }
           }))

## file /global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.cds.fa.gz
print (curl.post('api/metadata/file',
  file='/global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.cds.fa.gz',
  file_type='fasta',
  put_mode='Replace_If_Newer',
  destination='phytozome/EgrandisvarTAG0014HAP1/v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.cds.fa.gz',
  source=host,
  metadata={
       'type' : 'annotation/gene',
       'subtype' : 'sequence',
       'content' : 'CDS',
       'publication_status' : 'unpublished',
       'source' : 'nuclear',
       'collection' : 'all',
       'format' : 'fasta',
       'ncbi_taxon_id' : 71139,
       'portal' : { 
           'identifier' :['EucgraStandDraft_FD'],
           'display_location' :{'EucgraStandDraft_FD':['Annotation']} }, 
       'analysis_task_id' : 572294,
       'analysis_project_id' : 1483335,
       'analysis_task_id' : 572295,
       'analysis_task_id' : 572296,
       'phytozome':{
         'phytozome_release_id':['14', 'current'],
         'annotation_version':'v4.2',
         'assembly_version':'v4.0',
         'proteome_name':'Eucalyptus grandis var. TAG0014 HAP1',
         'proteome_id':993,
         'phytozome_genome_id':993,
         'version':'v4.2',
         'Gspecies':'EgrandisvarTAG0014HAP1',
         'data_release_policy':'restricted',
                   }
           }))

## file /global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.repeatmasked_assembly.gff3.gz
print (curl.post('api/metadata/file',
  file='/global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.repeatmasked_assembly.gff3.gz',
  file_type='gff',
  put_mode='Replace_If_Newer',
  destination='phytozome/EgrandisvarTAG0014HAP1/v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.repeatmasked_assembly.gff3.gz',
  source=host,
  metadata={
       'type' : 'annotation/repeat',
       'subtype' : 'structural',
       'content' : 'DNA,repeats',
       'publication_status' : 'unpublished',
       'source' : 'nuclear',
       'collection' : 'all',
       'format' : 'gff3',
       'ncbi_taxon_id' : 71139,
       'portal' : { 
           'identifier' :['EucgraStandDraft_FD'],
           'display_location' :{'EucgraStandDraft_FD':['Annotation']} }, 
       'analysis_task_id' : 572294,
       'analysis_project_id' : 1483335,
       'analysis_task_id' : 572295,
       'analysis_task_id' : 572296,
       'phytozome':{
         'phytozome_release_id':['14', 'current'],
         'annotation_version':'v4.2',
         'assembly_version':'v4.0',
         'proteome_name':'Eucalyptus grandis var. TAG0014 HAP1',
         'proteome_id':993,
         'phytozome_genome_id':993,
         'version':'v4.2',
         'Gspecies':'EgrandisvarTAG0014HAP1',
         'data_release_policy':'restricted',
                   }
           }))

## file /global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.transcript_primaryTranscriptOnly.fa.gz
print (curl.post('api/metadata/file',
  file='/global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.transcript_primaryTranscriptOnly.fa.gz',
  file_type='fasta',
  put_mode='Replace_If_Newer',
  destination='phytozome/EgrandisvarTAG0014HAP1/v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.transcript_primaryTranscriptOnly.fa.gz',
  source=host,
  metadata={
       'type' : 'annotation/gene',
       'subtype' : 'sequence',
       'content' : 'transcript',
       'publication_status' : 'unpublished',
       'source' : 'nuclear',
       'collection' : 'all',
       'format' : 'fasta',
       'ncbi_taxon_id' : 71139,
       'portal' : { 
           'identifier' :['EucgraStandDraft_FD'],
           'display_location' :{'EucgraStandDraft_FD':['Annotation']} }, 
       'analysis_task_id' : 572294,
       'analysis_project_id' : 1483335,
       'analysis_task_id' : 572295,
       'analysis_task_id' : 572296,
       'phytozome':{
         'phytozome_release_id':['14', 'current'],
         'annotation_version':'v4.2',
         'assembly_version':'v4.0',
         'proteome_name':'Eucalyptus grandis var. TAG0014 HAP1',
         'proteome_id':993,
         'phytozome_genome_id':993,
         'version':'v4.2',
         'Gspecies':'EgrandisvarTAG0014HAP1',
         'data_release_policy':'restricted',
                   }
           }))

## file /global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.gene.gff3.gz
print (curl.post('api/metadata/file',
  file='/global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.gene.gff3.gz',
  file_type='gff',
  put_mode='Replace_If_Newer',
  destination='phytozome/EgrandisvarTAG0014HAP1/v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.gene.gff3.gz',
  source=host,
  metadata={
       'type' : 'annotation/gene',
       'subtype' : 'structural',
       'content' : 'genes',
       'publication_status' : 'unpublished',
       'source' : 'nuclear',
       'collection' : 'all',
       'format' : 'gff3',
       'ncbi_taxon_id' : 71139,
       'portal' : { 
           'identifier' :['EucgraStandDraft_FD'],
           'display_location' :{'EucgraStandDraft_FD':['Annotation']} }, 
       'analysis_task_id' : 572294,
       'analysis_project_id' : 1483335,
       'analysis_task_id' : 572295,
       'analysis_task_id' : 572296,
       'phytozome':{
         'phytozome_release_id':['14', 'current'],
         'annotation_version':'v4.2',
         'assembly_version':'v4.0',
         'proteome_name':'Eucalyptus grandis var. TAG0014 HAP1',
         'proteome_id':993,
         'phytozome_genome_id':993,
         'version':'v4.2',
         'Gspecies':'EgrandisvarTAG0014HAP1',
         'data_release_policy':'restricted',
                   }
           }))

## file /global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.cds_primaryTranscriptOnly.fa.gz
print (curl.post('api/metadata/file',
  file='/global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.cds_primaryTranscriptOnly.fa.gz',
  file_type='fasta',
  put_mode='Replace_If_Newer',
  destination='phytozome/EgrandisvarTAG0014HAP1/v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.cds_primaryTranscriptOnly.fa.gz',
  source=host,
  metadata={
       'type' : 'annotation/gene',
       'subtype' : 'sequence',
       'content' : 'CDS',
       'publication_status' : 'unpublished',
       'source' : 'nuclear',
       'collection' : 'all',
       'format' : 'fasta',
       'ncbi_taxon_id' : 71139,
       'portal' : { 
           'identifier' :['EucgraStandDraft_FD'],
           'display_location' :{'EucgraStandDraft_FD':['Annotation']} }, 
       'analysis_task_id' : 572294,
       'analysis_project_id' : 1483335,
       'analysis_task_id' : 572295,
       'analysis_task_id' : 572296,
       'phytozome':{
         'phytozome_release_id':['14', 'current'],
         'annotation_version':'v4.2',
         'assembly_version':'v4.0',
         'proteome_name':'Eucalyptus grandis var. TAG0014 HAP1',
         'proteome_id':993,
         'phytozome_genome_id':993,
         'version':'v4.2',
         'Gspecies':'EgrandisvarTAG0014HAP1',
         'data_release_policy':'restricted',
                   }
           }))

## file /global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.gene_exon.gff3.gz
print (curl.post('api/metadata/file',
  file='/global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.gene_exon.gff3.gz',
  file_type='gff',
  put_mode='Replace_If_Newer',
  destination='phytozome/EgrandisvarTAG0014HAP1/v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.gene_exon.gff3.gz',
  source=host,
  metadata={
       'type' : 'annotation/gene',
       'subtype' : 'structural',
       'content' : 'genes',
       'publication_status' : 'unpublished',
       'source' : 'nuclear',
       'collection' : 'all',
       'format' : 'gff3',
       'ncbi_taxon_id' : 71139,
       'portal' : { 
           'identifier' :['EucgraStandDraft_FD'],
           'display_location' :{'EucgraStandDraft_FD':['Annotation']} }, 
       'analysis_task_id' : 572294,
       'analysis_project_id' : 1483335,
       'analysis_task_id' : 572295,
       'analysis_task_id' : 572296,
       'phytozome':{
         'phytozome_release_id':['14', 'current'],
         'annotation_version':'v4.2',
         'assembly_version':'v4.0',
         'proteome_name':'Eucalyptus grandis var. TAG0014 HAP1',
         'proteome_id':993,
         'phytozome_genome_id':993,
         'version':'v4.2',
         'Gspecies':'EgrandisvarTAG0014HAP1',
         'data_release_policy':'restricted',
                   }
           }))

## file /global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.transcript.fa.gz
print (curl.post('api/metadata/file',
  file='/global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.transcript.fa.gz',
  file_type='fasta',
  put_mode='Replace_If_Newer',
  destination='phytozome/EgrandisvarTAG0014HAP1/v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.transcript.fa.gz',
  source=host,
  metadata={
       'type' : 'annotation/gene',
       'subtype' : 'sequence',
       'content' : 'transcript',
       'publication_status' : 'unpublished',
       'source' : 'nuclear',
       'collection' : 'all',
       'format' : 'fasta',
       'ncbi_taxon_id' : 71139,
       'portal' : { 
           'identifier' :['EucgraStandDraft_FD'],
           'display_location' :{'EucgraStandDraft_FD':['Annotation']} }, 
       'analysis_task_id' : 572294,
       'analysis_project_id' : 1483335,
       'analysis_task_id' : 572295,
       'analysis_task_id' : 572296,
       'phytozome':{
         'phytozome_release_id':['14', 'current'],
         'annotation_version':'v4.2',
         'assembly_version':'v4.0',
         'proteome_name':'Eucalyptus grandis var. TAG0014 HAP1',
         'proteome_id':993,
         'phytozome_genome_id':993,
         'version':'v4.2',
         'Gspecies':'EgrandisvarTAG0014HAP1',
         'data_release_policy':'restricted',
                   }
           }))

## file /global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.protein.fa.gz
print (curl.post('api/metadata/file',
  file='/global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.protein.fa.gz',
  file_type='fasta',
  put_mode='Replace_If_Newer',
  destination='phytozome/EgrandisvarTAG0014HAP1/v4.2/annotation/E.grandis_var._TAG0014_HAP1_993_v4.2.protein.fa.gz',
  source=host,
  metadata={
       'type' : 'annotation/gene',
       'subtype' : 'sequence',
       'content' : 'protein',
       'publication_status' : 'unpublished',
       'source' : 'nuclear',
       'collection' : 'all',
       'format' : 'fasta',
       'ncbi_taxon_id' : 71139,
       'portal' : { 
           'identifier' :['EucgraStandDraft_FD'],
           'display_location' :{'EucgraStandDraft_FD':['Annotation']} }, 
       'analysis_task_id' : 572294,
       'analysis_project_id' : 1483335,
       'analysis_task_id' : 572295,
       'analysis_task_id' : 572296,
       'phytozome':{
         'phytozome_release_id':['14', 'current'],
         'annotation_version':'v4.2',
         'assembly_version':'v4.0',
         'proteome_name':'Eucalyptus grandis var. TAG0014 HAP1',
         'proteome_id':993,
         'phytozome_genome_id':993,
         'version':'v4.2',
         'Gspecies':'EgrandisvarTAG0014HAP1',
         'data_release_policy':'restricted',
                   }
           }))

## file /global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/assembly/E.grandis_var._TAG0014_HAP1_993_v4.2.fa.gz
print (curl.post('api/metadata/file',
  file='/global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/assembly/E.grandis_var._TAG0014_HAP1_993_v4.2.fa.gz',
  file_type='fasta',
  put_mode='Replace_If_Newer',
  destination='phytozome/EgrandisvarTAG0014HAP1/v4.2/assembly/E.grandis_var._TAG0014_HAP1_993_v4.2.fa.gz',
  source=host,
  metadata={
       'type' : 'assembly',
       'subtype' : 'sequence',
       'content' : 'unmasked',
       'publication_status' : 'unpublished',
       'source' : 'nuclear',
       'collection' : 'all',
       'format' : 'fasta',
       'ncbi_taxon_id' : 71139,
       'portal' : { 
           'identifier' :['EucgraStandDraft_FD'],
           'display_location' :{'EucgraStandDraft_FD':['Assembly']} }, 
       'analysis_task_id' : 572294,
       'analysis_project_id' : 1483335,
       'analysis_task_id' : 572295,
       'analysis_task_id' : 572296,
       'phytozome':{
         'phytozome_release_id':['14', 'current'],
         'annotation_version':'v4.2',
         'assembly_version':'v4.0',
         'proteome_name':'Eucalyptus grandis var. TAG0014 HAP1',
         'proteome_id':993,
         'phytozome_genome_id':993,
         'version':'v4.2',
         'Gspecies':'EgrandisvarTAG0014HAP1',
         'data_release_policy':'restricted',
                   }
           }))

## file /global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/assembly/E.grandis_var._TAG0014_HAP1_993_v4.2.softmasked.fa.gz
print (curl.post('api/metadata/file',
  file='/global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/assembly/E.grandis_var._TAG0014_HAP1_993_v4.2.softmasked.fa.gz',
  file_type='fasta',
  put_mode='Replace_If_Newer',
  destination='phytozome/EgrandisvarTAG0014HAP1/v4.2/assembly/E.grandis_var._TAG0014_HAP1_993_v4.2.softmasked.fa.gz',
  source=host,
  metadata={
       'type' : 'assembly',
       'subtype' : 'sequence',
       'content' : 'masked,repeats',
       'publication_status' : 'unpublished',
       'source' : 'nuclear',
       'collection' : 'all',
       'format' : 'fasta',
       'ncbi_taxon_id' : 71139,
       'portal' : { 
           'identifier' :['EucgraStandDraft_FD'],
           'display_location' :{'EucgraStandDraft_FD':['Assembly']} }, 
       'analysis_task_id' : 572294,
       'analysis_project_id' : 1483335,
       'analysis_task_id' : 572295,
       'analysis_task_id' : 572296,
       'phytozome':{
         'phytozome_release_id':['14', 'current'],
         'annotation_version':'v4.2',
         'assembly_version':'v4.0',
         'proteome_name':'Eucalyptus grandis var. TAG0014 HAP1',
         'proteome_id':993,
         'phytozome_genome_id':993,
         'version':'v4.2',
         'Gspecies':'EgrandisvarTAG0014HAP1',
         'data_release_policy':'restricted',
                   }
           }))

## file /global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/assembly/E.grandis_var._TAG0014_HAP1_993_v4.2.hardmasked.fa.gz
print (curl.post('api/metadata/file',
  file='/global/cfs/cdirs/m342/www/phytozome/downloads/./Egrandisvar_TAG0014HAP1_993_v4.2/assembly/E.grandis_var._TAG0014_HAP1_993_v4.2.hardmasked.fa.gz',
  file_type='fasta',
  put_mode='Replace_If_Newer',
  destination='phytozome/EgrandisvarTAG0014HAP1/v4.2/assembly/E.grandis_var._TAG0014_HAP1_993_v4.2.hardmasked.fa.gz',
  source=host,
  metadata={
       'type' : 'assembly',
       'subtype' : 'sequence',
       'content' : 'masked,repeats',
       'publication_status' : 'unpublished',
       'source' : 'nuclear',
       'collection' : 'all',
       'format' : 'fasta',
       'ncbi_taxon_id' : 71139,
       'portal' : { 
           'identifier' :['EucgraStandDraft_FD'],
           'display_location' :{'EucgraStandDraft_FD':['Assembly']} }, 
       'analysis_task_id' : 572294,
       'analysis_project_id' : 1483335,
       'analysis_task_id' : 572295,
       'analysis_task_id' : 572296,
       'phytozome':{
         'phytozome_release_id':['14', 'current'],
         'annotation_version':'v4.2',
         'assembly_version':'v4.0',
         'proteome_name':'Eucalyptus grandis var. TAG0014 HAP1',
         'proteome_id':993,
         'phytozome_genome_id':993,
         'version':'v4.2',
         'Gspecies':'EgrandisvarTAG0014HAP1',
         'data_release_policy':'restricted',
                   }
           }))

