Mercurial > repos > fubar > jbrowse2
comparison autogenJB2.py @ 98:b1260bca5fdc draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/jbrowse2 commit 44d8fc559ecf5463a8f753561976fa26686c96f6
author | bgruening |
---|---|
date | Wed, 05 Jun 2024 10:00:07 +0000 |
parents | 74074746ccd8 |
children | 878c27dfea9d |
comparison
equal
deleted
inserted
replaced
97:74074746ccd8 | 98:b1260bca5fdc |
---|---|
75 }, | 75 }, |
76 } | 76 } |
77 for i, x in enumerate(genome_paths) | 77 for i, x in enumerate(genome_paths) |
78 ], | 78 ], |
79 ) | 79 ) |
80 logging.debug("@@@autogenJB2 paths=%s, genomes=%s" % (genome_paths, genomes)) | |
81 assref_name = jc.process_genomes(genomes[0]) | 80 assref_name = jc.process_genomes(genomes[0]) |
82 if not default_session_data.get(assref_name, None): | 81 if not default_session_data.get(assref_name, None): |
83 default_session_data[assref_name] = { | 82 default_session_data[assref_name] = { |
84 "tracks": [], | 83 "tracks": [], |
85 "style": {}, | 84 "style": {}, |
88 "default_on": [], | 87 "default_on": [], |
89 "default_off": [], | 88 "default_off": [], |
90 }, | 89 }, |
91 } | 90 } |
92 listtracks = trackList | 91 listtracks = trackList |
92 # foo.paf must have a foo_paf.fasta or fasta.gz to match | |
93 tnames = [x[2] for x in listtracks] | 93 tnames = [x[2] for x in listtracks] |
94 texts = [x[1] for x in listtracks] | 94 texts = [x[1] for x in listtracks] |
95 for i, track in enumerate(listtracks): | 95 for i, track in enumerate(listtracks): |
96 track_conf = { | 96 track_conf = { |
97 "trackfiles": [], | 97 "trackfiles": [], |
102 track_conf["dataset_id"] = trackname | 102 track_conf["dataset_id"] = trackname |
103 useuri = "no" | 103 useuri = "no" |
104 if tpath.startswith("http://") or tpath.startswith("https://"): | 104 if tpath.startswith("http://") or tpath.startswith("https://"): |
105 useuri = "yes" | 105 useuri = "yes" |
106 if trext == "paf": | 106 if trext == "paf": |
107 refdat = ["%s ~ %s" % (x[0],x[2]) for x in listtracks if x[1] in ["fasta", "fasta.gz"]] | 107 refname = trackname + "_paf.fasta" |
108 if len(refdat) == 0: | 108 refdat = [x[2] for x in listtracks if x[2] == refname] |
109 if not refdat: | |
109 jc.logging.warn( | 110 jc.logging.warn( |
110 "!! No reference file for %s found. Using main reference" | 111 "No reference file %s corresponding to paf file %s found. Not building - there must be a corresponding fasta for each paf" |
111 % (refname) | 112 % (refname, trackname) |
112 ) | 113 ) |
113 refdat = ["%s ~ %s" % (genomes[0].path, assref_name),] | 114 sys.exit(3) |
114 else: | 115 else: |
115 track_conf.update( | 116 track_conf.update( |
116 { | 117 { |
117 "conf": { | 118 "conf": { |
118 "options": { | 119 "options": { |
119 "paf": { | 120 "paf": { |
120 "genome": ",".join(refdat) | 121 "genome": refdat, |
122 "genome_label": trackname, | |
121 } | 123 } |
122 } | 124 } |
123 } | 125 } |
124 } | 126 } |
125 ) | 127 ) |
138 os.path.realpath(track[0]), | 140 os.path.realpath(track[0]), |
139 ] | 141 ] |
140 sys.stdout.write("#### calling %s" % " ".join(cmd)) | 142 sys.stdout.write("#### calling %s" % " ".join(cmd)) |
141 jc.subprocess_check_call(cmd) | 143 jc.subprocess_check_call(cmd) |
142 track_conf.update( | 144 track_conf.update( |
143 {"conf": {"options": {"bam": {"bam_index": " %s ~ %s," % (tpath,ipath)}}}} | 145 {"conf": {"options": {"bam": {"bam_index": " %s ~ %s," % (tpath, ipath)}}}} |
144 ) | 146 ) |
145 elif trext == "cram": | 147 elif trext == "cram": |
146 ipath = track[3] | 148 ipath = track[3] |
147 if not os.path.exists(ipath): | 149 if not os.path.exists(ipath): |
148 ipath = os.path.realpath( | 150 ipath = os.path.realpath( |
220 jc.add_default_session(default_session_data) | 222 jc.add_default_session(default_session_data) |
221 # jc.add_defsess_to_index(default_session_data) | 223 # jc.add_defsess_to_index(default_session_data) |
222 # jc.text_index() not sure what broke here. | 224 # jc.text_index() not sure what broke here. |
223 else: | 225 else: |
224 sys.stderr.write( | 226 sys.stderr.write( |
225 "!!!! Collection has no suitable trackfiles for autogenJB2 - nothing to process" | 227 "Collection has no suitable trackfiles for autogenJB2 - nothing to process" |
226 ) | 228 ) |