Ejemplo n.º 1
0
 def test_gzipped(self):
     forward_gzip_fp = self.forward_fp + ".gz"
     subprocess.check_call(["gzip", self.forward_fp])
     reverse_gzip_fp = self.reverse_fp + ".gz"
     subprocess.check_call(["gzip", self.reverse_fp])
     index_gzip_fp = self.index_fp + ".gz"
     subprocess.check_call(["gzip", self.index_fp])
     main([
         self.barcode_fp,
         forward_gzip_fp,
         reverse_gzip_fp,
         "--i1-fastq",
         index_gzip_fp,
         "--output-dir",
         self.output_dir,
         "--revcomp",
     ])
     self.assertEqual(
         set(os.listdir(self.output_dir)),
         set((
             "SampleA_R1.fastq",
             "SampleA_R2.fastq",
             "SampleB_R1.fastq",
             "SampleB_R2.fastq",
         )))
Ejemplo n.º 2
0
    def test_regular(self):
        main([
            self.barcode_fp, self.forward_fp, self.reverse_fp,
            "--i1-fastq", self.index_fp,
            "--output-dir", self.output_dir,
            "--manifest-file", self.manifest_fp,
            "--total-reads-file", self.total_reads_fp,
            "--revcomp",
            ])
        self.assertEqual(
            set(os.listdir(self.output_dir)), set((
                "SampleA_R1.fastq", "SampleA_R2.fastq",
                "SampleB_R1.fastq", "SampleB_R2.fastq",
            )))
        with open(self.manifest_fp) as f:
            self.assertEqual(next(f), "sample-id,absolute-filepath,direction\n")
            for line in f:
                sample_id, fp, direction = line.split(",", 3)
                self.assertIn(direction, ["forward\n", "reverse\n"])
                self.assertIn(sample_id, ["SampleA", "SampleB"])

        with open(self.total_reads_fp) as f:
            self.assertEqual(next(f), "SampleID\tNumReads\n")
            self.assertEqual(next(f), "SampleA\t1\n")
            self.assertEqual(next(f), "SampleB\t1\n")
            self.assertEqual(next(f), "unassigned\t1\n")
Ejemplo n.º 3
0
 def test_regular(self):
     main([
         "--forward-reads", self.forward_fp,
         "--reverse-reads", self.reverse_fp,
         "--index-reads", self.index_fp,
         "--barcode-file", self.barcode_fp,
         "--output-dir", self.output_dir,
         "--summary-file", self.summary_fp,
         ])
     with open(self.summary_fp) as f:
         res = json.load(f)
         self.assertEqual(res["data"], {"SampleA": 1, "SampleB": 1})
Ejemplo n.º 4
0
 def test_gzipped(self):
     forward_gzip_fp = self.forward_fp + ".gz"
     subprocess.check_call(["gzip", self.forward_fp])
     reverse_gzip_fp = self.reverse_fp + ".gz"
     subprocess.check_call(["gzip", self.reverse_fp])
     index_gzip_fp = self.index_fp + ".gz"
     subprocess.check_call(["gzip", self.index_fp])
     main([
         self.barcode_fp, forward_gzip_fp, reverse_gzip_fp,
         "--i1-fastq", index_gzip_fp,
         "--output-dir", self.output_dir,
         "--revcomp",
         ])
     self.assertEqual(
         set(os.listdir(self.output_dir)), set((
             "SampleA_R1.fastq", "SampleA_R2.fastq",
             "SampleB_R1.fastq", "SampleB_R2.fastq",
         )))
Ejemplo n.º 5
0
 def test_regular(self):
     main([
         "--forward-reads",
         self.forward_fp,
         "--reverse-reads",
         self.reverse_fp,
         "--index-reads",
         self.index_fp,
         "--barcode-file",
         self.barcode_fp,
         "--output-dir",
         self.output_dir,
         "--summary-file",
         self.summary_fp,
     ])
     with open(self.summary_fp) as f:
         res = json.load(f)
         self.assertEqual(res["data"], {
             "SampleA": 1,
             "SampleB": 1,
             "unassigned": 1
         })
Ejemplo n.º 6
0
    def test_regular(self):
        main([
            self.barcode_fp,
            self.forward_fp,
            self.reverse_fp,
            "--i1-fastq",
            self.index_fp,
            "--output-dir",
            self.output_dir,
            "--manifest-file",
            self.manifest_fp,
            "--total-reads-file",
            self.total_reads_fp,
            "--revcomp",
        ])
        self.assertEqual(
            set(os.listdir(self.output_dir)),
            set((
                "SampleA_R1.fastq",
                "SampleA_R2.fastq",
                "SampleB_R1.fastq",
                "SampleB_R2.fastq",
            )))
        with open(self.manifest_fp) as f:
            self.assertEqual(next(f),
                             "sample-id,absolute-filepath,direction\n")
            for line in f:
                sample_id, fp, direction = line.split(",", 3)
                self.assertIn(direction, ["forward\n", "reverse\n"])
                self.assertIn(sample_id, ["SampleA", "SampleB"])

        with open(self.total_reads_fp) as f:
            self.assertEqual(next(f), "SampleID\tNumReads\n")
            self.assertEqual(next(f), "SampleA\t1\n")
            self.assertEqual(next(f), "SampleB\t1\n")
            self.assertEqual(next(f), "unassigned\t1\n")
Ejemplo n.º 7
0
#!/usr/bin/env python
from dnabclib.main import main
main()