Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
jlanga committed Jan 28, 2019
2 parents c005970 + 698055a commit 580bd9c
Show file tree
Hide file tree
Showing 76 changed files with 3,300 additions and 4,232 deletions.
15 changes: 11 additions & 4 deletions bin/build_baited_bloom_filter
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

import argparse
import logging
from exfi import __version__
from exfi.build_baited_bloom_filter import build_baited_bloom_filter
import sys
from os.path import isfile, exists, dirname, abspath
from os import \
makedirs, \
remove
from shutil import which

from exfi import __version__
from exfi.build_baited_bloom_filter import build_baited_bloom_filter

parser = argparse.ArgumentParser(
usage='build_baited_bloom_filter '
Expand Down Expand Up @@ -122,21 +124,25 @@ if __name__ == '__main__':

# Set up logger
logger = logging.getLogger()
logging.basicConfig(format='%(asctime)s\t%(module)s\t%(message)s', level=logging.ERROR)
logging.basicConfig(
format='%(asctime)s\t%(module)s\t%(message)s',
level=logging.ERROR
)
if args["verbose"]:
logger.setLevel(logging.INFO)
if args["debug"]:
logger.setLevel(logging.DEBUG)


# Check inputs
logging.info('Checking input parameters')
assert args["kmer"] >= 1, 'ERROR: incorrect kmer size'
# assert bloom_size
assert args["levels"] >= 1, 'ERROR: incorrect number of levels'
assert args["threads"] >= 1, 'ERROR: incorrect number of threads'

# Check if programs are in path
from shutil import which
logging.info('Checking if biobloom* and abyss-bloom are in $PATH')
assert which('biobloommaker') is not None, 'ERROR: biobloommaker not in PATH'
assert which('biobloomcategorizer') is not None, 'ERROR: biobloomcategorizer not in PATH'
assert which('abyss-bloom') is not None, 'ERROR: abyss-bloom not in PATH'
Expand All @@ -147,6 +153,7 @@ if __name__ == '__main__':
makedirs(output_dir)

# Run the program
logging.info('Running build_baited_bloom_filter')
build_baited_bloom_filter(args)

logging.info("Done!")
59 changes: 17 additions & 42 deletions bin/build_splice_graph
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,18 @@ from os.path import \
from Bio import SeqIO

from exfi import __version__

from exfi.find_exons import \
_get_fasta, \
_find_exons_pipeline

from exfi.build_splice_graph_dict import \
build_splice_graph_dict

from exfi.correct import \
correct_splice_graph_dict

from exfi.polish import \
polish_splice_graph_dict

from exfi.io.fasta_to_dict import \
fasta_to_dict

from exfi.io.splice_graph_dict_to_gfa1 import \
splice_graph_dict_to_gfa1

from exfi.collapse import \
collapse_splice_graph_dict
from exfi.find_exons import find_exons
from exfi.io.bed import bed3_to_bed4
from exfi.io.fasta_to_dict import fasta_to_dict
from exfi.polish import polish_bed4
from exfi.correct import correct_bed4
from exfi.io.bed4_to_gfa1 import bed4_to_gfa1



parser = argparse.ArgumentParser(
usage='build_splicegraph -i transcriptome.fa -b bloom_filter.bf -k 30 -o exome.gfa',
usage='build_splicegraph -i transcriptome.fa -b bloom_filter.bf -k 30 '
'-o exome.gfa',
description='Store the predicted exome in GFA format',
epilog='Jorge Langa. Send issues and pull requests to github.com/jlanga/'
'exfi',
Expand Down Expand Up @@ -137,7 +122,8 @@ parser.add_argument(
parser.add_argument(
'--correct',
'-C',
help='Correct splice graph by using sealer between exons that seem nearby [False]',
help='Correct splice graph by using sealer between exons that seem nearby '
'[False]',
dest='correct',
action="store_true"
)
Expand Down Expand Up @@ -190,33 +176,22 @@ if __name__ == "__main__":
logger.setLevel(logging.DEBUG)

# Get predicted exons in bed format
positive_exons_bed = _find_exons_pipeline(args)

# Build splice graph
splice_graph_dict = build_splice_graph_dict(positive_exons_bed, args)
bed4 = bed3_to_bed4(find_exons(args))

# Transcriptome_dict
transcriptome_dict = fasta_to_dict(args["fasta"])

if args["polish"]:
splice_graph_dict = polish_splice_graph_dict(splice_graph_dict, transcriptome_dict, args)
bed4 = polish_bed4(bed4=bed4, transcriptome_dict=transcriptome_dict)

if args["correct"]:
splice_graph_dict = correct_splice_graph_dict(splice_graph_dict, args)

if args["collapse"]:
splice_graph_dict = {
"collapsed": collapse_splice_graph_dict(
splice_graph_dict=splice_graph_dict,
transcriptome_dict=transcriptome_dict
)
}
bed4 = correct_bed4(
bed4=bed4, transcriptome_dict=transcriptome_dict, args=args
)

# Write to GFA1
splice_graph_dict_to_gfa1(
splice_graph_dict=splice_graph_dict,
transcriptome_dict=transcriptome_dict,
filename=args["gfa1"]
bed4_to_gfa1(
gfa1_fn=args["gfa1"], bed4=bed4, transcriptome_dict=transcriptome_dict
)

logging.info("Done!")
9 changes: 5 additions & 4 deletions bin/gfa1_to_exons
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ from os.path import \

from exfi import __version__

from exfi.io.gfa1_to_exons import \
from exfi.io.gfa1_to_fasta import \
gfa1_to_exons

parser = argparse.ArgumentParser(
Expand All @@ -34,7 +34,8 @@ parser.add_argument(
'-i',
type=str,
required=True,
help='Input splice graph in GFA1 format (the results from build_splicegraph)',
help='Input splice graph in GFA1 format (the results from '
'build_splicegraph)',
dest='gfa1',
metavar='FILE'
)
Expand Down Expand Up @@ -107,8 +108,8 @@ if __name__ == "__main__":
masking = "hard"

gfa1_to_exons(
gfa_in_fn=args["gfa1"],
fasta_out_fn=args["fasta"],
fasta_out=args["fasta"],
gfa1_in=args["gfa1"],
masking=masking
)

Expand Down
6 changes: 3 additions & 3 deletions bin/gfa1_to_gapped_transcripts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ from os.path import \
abspath

from exfi import __version__
from exfi.io.gfa1_to_gapped_transcripts import \
from exfi.io.gfa1_to_fasta import \
gfa1_to_gapped_transcripts


Expand Down Expand Up @@ -121,9 +121,9 @@ if __name__ == "__main__":
masking = "hard"

gfa1_to_gapped_transcripts(
gfa_in=args["gfa1"],
fasta_out=args["fasta"],
number_of_ns=args["number_of_ns"],
gfa1_in=args["gfa1"],
gap_size=args["number_of_ns"],
masking=masking
)

Expand Down
2 changes: 1 addition & 1 deletion exfi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
filters.
"""

__version__ = '1.4.12'
__version__ = '1.4.13'
Loading

0 comments on commit 580bd9c

Please sign in to comment.