Esempio n. 1
0
 def test_capillary_to_pairs(self):
     '''Check that capillary reads file converted to paired and unpaired'''
     tmp_prefix = 'tmp.cap_to_pairs'
     tasks.capillary_to_pairs(
         os.path.join(data_dir, 'sequences_test_cap_to_read_pairs.fa'),
         tmp_prefix)
     # sequences have been hashed, so could be in any order in
     # output files. So need to check contents of files are OK
     d_correct_paired = {}
     d_correct_unpaired = {}
     tasks.file_to_dict(
         os.path.join(data_dir,
                      'sequences_test_cap_to_read_pairs.fa.paired.gz'),
         d_correct_paired)
     tasks.file_to_dict(
         os.path.join(data_dir,
                      'sequences_test_cap_to_read_pairs.fa.unpaired.gz'),
         d_correct_unpaired)
     d_test_paired = {}
     d_test_unpaired = {}
     tasks.file_to_dict(tmp_prefix + '.paired.gz', d_test_paired)
     tasks.file_to_dict(tmp_prefix + '.unpaired.gz', d_test_unpaired)
     self.assertDictEqual(d_test_paired, d_correct_paired)
     self.assertDictEqual(d_test_unpaired, d_correct_unpaired)
     os.unlink(tmp_prefix + '.paired.gz')
     os.unlink(tmp_prefix + '.unpaired.gz')
Esempio n. 2
0
def run(description):
    parser = argparse.ArgumentParser(
        description="Given a file of capillary reads, makes an interleaved file of read pairs (where more than read from same ligation, takes the longest read) and a file of unpaired reads. Replaces the .p1k/.q1k part of read names to denote fwd/rev reads with /1 and /2",
        usage="fastaq capillary_to_pairs <infile> <outfiles prefix>",
    )
    parser.add_argument("infile", help="Name of input fasta/q file")
    parser.add_argument("outprefix", help="Prefix of output files", metavar="outfiles prefix")
    options = parser.parse_args()
    tasks.capillary_to_pairs(options.infile, options.outprefix)
Esempio n. 3
0
def run(description):
    parser = argparse.ArgumentParser(
        description=
        'Given a file of capillary reads, makes an interleaved file of read pairs (where more than read from same ligation, takes the longest read) and a file of unpaired reads. Replaces the .p1k/.q1k part of read names to denote fwd/rev reads with /1 and /2',
        usage='fastaq capillary_to_pairs <infile> <outfiles prefix>')
    parser.add_argument('infile', help='Name of input fasta/q file')
    parser.add_argument('outprefix',
                        help='Prefix of output files',
                        metavar='outfiles prefix')
    options = parser.parse_args()
    tasks.capillary_to_pairs(options.infile, options.outprefix)
Esempio n. 4
0
 def test_capillary_to_pairs(self):
     '''Check that capillary reads file converted to paired and unpaired'''
     tmp_prefix = 'tmp.cap_to_pairs'
     tasks.capillary_to_pairs(os.path.join(data_dir, 'sequences_test_cap_to_read_pairs.fa'), tmp_prefix)
     # sequences have been hashed, so could be in any order in
     # output files. So need to check contents of files are OK
     d_correct_paired = {}
     d_correct_unpaired = {}
     tasks.file_to_dict(os.path.join(data_dir, 'sequences_test_cap_to_read_pairs.fa.paired.gz'), d_correct_paired)
     tasks.file_to_dict(os.path.join(data_dir, 'sequences_test_cap_to_read_pairs.fa.unpaired.gz'), d_correct_unpaired)
     d_test_paired = {}
     d_test_unpaired = {}
     tasks.file_to_dict(tmp_prefix + '.paired.gz', d_test_paired)
     tasks.file_to_dict(tmp_prefix + '.unpaired.gz', d_test_unpaired)
     self.assertDictEqual(d_test_paired, d_correct_paired)
     self.assertDictEqual(d_test_unpaired, d_correct_unpaired)
     os.unlink(tmp_prefix + '.paired.gz')
     os.unlink(tmp_prefix + '.unpaired.gz')