Skip to content

Commit

Permalink
smooth 2bit conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
glennhickey committed Mar 16, 2023
1 parent c731b26 commit fdda68c
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/cactus/maf/cactus_hal2chains.py
Expand Up @@ -46,7 +46,6 @@ def main():
help="comma-separated (no spaces) list of target "
"genomes (others are excluded) (vist all non-ancestral if empty)",
default=None)

parser.add_argument("--useHalSynteny",
help="use halSynteny instead of halLiftover. halLiftover is default because that's what CAT uses",
action="store_true")
Expand Down Expand Up @@ -151,11 +150,9 @@ def hal2chains_ref_info(job, config, options, hal_id):
['awk', '{{print $1 "\t0\t" $2}}']],
outfile=bed_path)

fa_path = os.path.join(work_dir, options.refGenome + '.fa')
cactus_call(parameters=['hal2fasta', hal_path, options.refGenome], outfile=fa_path)

tbit_path = os.path.join(work_dir, options.refGenome + '.2bit')
cactus_call(parameters=['faToTwoBit', fa_path, tbit_path])
tbit_path = os.path.join(work_dir, options.refGenome + '.2bit')
cactus_call(parameters=[['hal2fasta', hal_path, options.refGenome],
['faToTwoBit', 'stdin', tbit_path]])

genomes=cactus_call(parameters=['halStats', '--genomes', hal_path], check_output=True).split()

Expand Down Expand Up @@ -206,12 +203,9 @@ def hal2chains_genome(job, config, options, hal_id, ref_info, tgt_genome):
job.fileStore.readGlobalFile(ref_info['2bit'], ref_2bit_path)

# we need the target sequence for axtChain
tgt_fa_path = os.path.join(work_dir, tgt_genome + '.fa')
cactus_call(parameters=['hal2fasta', hal_path, tgt_genome], outfile=tgt_fa_path)

tgt_2bit_path = os.path.join(work_dir, tgt_genome + '.2bit')
cactus_call(parameters=['faToTwoBit', tgt_fa_path, tgt_2bit_path])
os.remove(tgt_fa_path)
tgt_2bit_path = os.path.join(work_dir, tgt_genome + '.2bit')
cactus_call(parameters=[['hal2fasta', hal_path, tgt_genome],
['faToTwoBit', 'stdin', tgt_2bit_path]])

# the output
tgt_chain_path = os.path.join(work_dir, tgt_genome + '.chain.gz')
Expand Down

0 comments on commit fdda68c

Please sign in to comment.