示例#1
0
parser.add_argument("-m",
                    "--min_len",
                    action="store",
                    dest="min_len",
                    type=int,
                    default=1,
                    help="Minimum length of read to output")

args = parser.parse_args()
n_regexp = re.compile("N+$")

if args.input_se:

    se_directory, se_prefix, se_extension = split_filename(args.input_se)
    se_in_fd = open(args.input_se, "r")
    se_out_file = "%s%s.filtered%s" % (check_path(
        args.out_dir), se_prefix, se_extension)
    se_out_fd = open(se_out_file, "w")

    while True:
        name, sequence, separator, quality = read_entry(se_in_fd)
        if name is None:
            break
        match = n_regexp.search(sequence)
        if match is None:
            se_out_fd.write("%s\n%s\n%s\n%s\n" %
                            (name, sequence, separator, quality))
        elif match.start() >= args.min_len:
            se_out_fd.write("%s\n%s\n%s\n%s\n" %
                            (name, sequence[:match.start() + 1], separator,
                             quality[:match.start() + 1]))
        else:
示例#2
0
                return False
        if first_list[-1][1:] != second_list[-1][1:]:
            return False
        if first_list[-1][0] != "1" or second_list[-1][0] != "2":
            return False
        return True


parser = argparse.ArgumentParser()

parser.add_argument("-d",
                    "--sample_directory",
                    action="store",
                    dest="samples_dir",
                    required=True,
                    type=lambda s: check_path(os.path.abspath(s)),
                    help="Directory with samples")
parser.add_argument(
    "-s",
    "--samples",
    action="store",
    dest="samples",
    help="Comma-separated list of subdirectories(one per sample) to handle. "
    "If not set all subdirectories will be considered as containing samples."
    "In sample directory should one(in case SE reads) or two(in case PE reads) files."
    "Filenames should should contain '_1.fq' or '_1.fastq' for forward(left) reads, "
    " '_2.fq' or '_2.fastq' for reverse(right) reads and '.fq' or '.fastq' for SE reads"
)
parser.add_argument("-o",
                    "--output",
                    action="store",
示例#3
0
parser.add_argument("-b", "--count_both_strands", action="store_true", dest="count_both_strands",
                    help="Count kmers in both strands. NOTICE: only mer or its reverse-complement, whichever "
                         "comes first lexicographically, is stored and the count value is the number of "
                         "occurrences of both. So this option is not suitable for generating sets of forward "
                         "and reverse-complement kmers. For this case use -r/--add_reverse_complement option. "
                         "Not compatible with -r/--add_reverse_complement option.")
parser.add_argument("-r", "--add_reverse_complement", action="store_true", dest="add_rev_com",
                    help="Add reverse-complement sequences before counting kmers. "
                         "Works only for fasta sequences. "
                         "Not compatible with -b/--count_both_strands option")


parser = argparse.ArgumentParser()

args = parser.parse_args()
args.path_to_mavr = check_path(args.path_to_mavr)

MaSuRCA.threads = args.threads
Jellyfish.threads = args.threads
Jellyfish.path = args.jellyfish_path if args.jellyfish_path else ""

iteration_reference_file = args.initial_sequences
working_dir = os.getcwd()
abs_path_left_source_reads = os.path.abspath(args.left_source_reads)
abs_path_right_source_reads = os.path.abspath(args.right_source_reads)

"""
for filename in args.source_reads:
    ab
    if os.path.isabs(filename):
        abs_path_source_reads.append(filename)
示例#4
0
    call_hcluster(args.input, *arg_list)
"""

parser = argparse.ArgumentParser()

parser.add_argument("-i", "--hclust_input_file", action="store", dest="hclust_input", required=True,
                    help="File with input graph for hclust")
parser.add_argument("-c", "--families_file", action="store", dest="fam_file", required=True,
                    help="File with families")
parser.add_argument("-o", "--output_dir", action="store", dest="output_dir",
                    help="Directory to write output")
parser.add_argument("-t", "--threads", action="store", dest="threads", type=int, default=1,
                    help="Number of threads to use")
args = parser.parse_args()

args.output_dir = check_path(args.output_dir)


def check_edge_strict(nodes_list, id_list):
    for node in nodes_list:
        if node not in id_list:
            return False
    return True


def check_edge_soft(nodes_list, id_list):
    for node in nodes_list:
        if node in id_list:
            return True
    return False
示例#5
0
 def write_splited(self, out_dir="./", extension="t", value_separator=","):
     from RouToolPa.Routines.File import check_path
     for fl_key in self:
         with open("%s%s.%s" % (check_path(out_dir), fl_key, extension), "w") as out_fd:
             for sl_key in self[fl_key]:
                 out_fd.write("%s\t%s\n" % (sl_key, value_separator.join(self[fl_key][sl_key])))