Пример #1
0
 def test_bowtie(self):
     nesoni.Analyse_sample(
         output_dir=output / 'test-analyse',
         reference=output / 'reference',
         pairs=[[data / 'reads_1.txt.gz', data / 'reads_2.txt.gz']],
         align=nesoni.Bowtie(),
     ).run()
Пример #2
0
    def test_check_names(self):
        with self.assertRaises(AssertionError):
            nesoni.Analyse_sample(
                output_dir=output / 'test-analyse',
                reference=output / 'reference',
                clip=None,
                pairs=[[data / 'reads_1.txt.gz', data / 'reads_2.txt.gz'],
                       [data / 'reads_1.txt.gz',
                        data / 'reads_2.txt.gz']]).run()

        with self.assertRaises(AssertionError):
            nesoni.Analyse_sample(
                output_dir=output / 'test-analyse',
                reference=output / 'reference',
                clip=None,
                reads=[data / 'reads_1.txt.gz',
                       data / 'reads_1.txt.gz']).run()

        with self.assertRaises(AssertionError):
            nesoni.Analyse_sample(output_dir=output / 'test-analyse',
                                  reference=output / 'reference',
                                  clip=None,
                                  interleaved=[data / 'reads_1.txt.gz']).run()
Пример #3
0
    def test_analyse(self):
        nesoni.Analyse_sample(
            output_dir=output / 'test-analyse',
            reference=output / 'reference',
            pairs=[[data / 'reads_1.txt.gz', data / 'reads_2.txt.gz']]).run()

        nesoni.Nway(output=output / 'test-nway.txt',
                    working_dirs=[output / 'test-analyse']).run()

        nesoni.Core(
            output_dir=output / 'test-core',
            working_dirs=[output / 'test-analyse'],
            what='core',
        ).run()

        nesoni.Core(
            output_dir=output / 'test-unique',
            working_dirs=[output / 'test-analyse'],
            what='unique',
        ).run()
Пример #4
0
    def run(self):
        work = self.get_workspace()
        with nesoni.Stage() as stage:
            for accession in self.genbanks:
                Fetch_genbank(
                    work / 'genbank',
                    accession,
                    self.email,
                ).process_make(stage)

            for accession in self.accessions:
                Fetch_sra(work / 'sra', accession).process_make(stage)

        nesoni.Make_reference(
            output_dir=work / 'TW20',
            filenames=[
                work / ('genbank', accession + '.gbk')
                for accession in self.genbanks
            ],
            genome=True,
            bowtie=True,
            ls=True,
            snpeff=True,
        ).make()

        analyser = nesoni.Analyse_samples
        analyser(work / 'analysis',
                 work / 'TW20',
                 samples=[
                     nesoni.Analyse_sample(
                         accession,
                         pairs=[[
                             work / ('sra', accession + '_1.fastq.bz2'),
                             work / ('sra', accession + '_2.fastq.bz2')
                         ]]) for accession in self.accessions
                 ]).make()
Пример #5
0
            variants)


def rand_seq(n):
    return ''.join(random.choice('ACGT') for i in xrange(n))


@config.Positional('ref', 'Reference sequence\neg AAG')
@config.Main_section(
    'variants', 'Variants, each with a number of reads, eg ACGx10 ATGx5. '
    'The first variant given is treated as the correct variant.')
@config.Configurable_section(
    'analysis',
    'Options for "nesoni analyse-sample:"',
    presets=[
        ('shrimp', lambda obj: nesoni.Analyse_sample(clip=None),
         'Do analysis using SHRiMP'),
        ('bowtie',
         lambda obj: nesoni.Analyse_sample(clip=None, align=bowtie.Bowtie()),
         'Do analysis using Bowtie'),
    ])
@config.Configurable_section('freebayes',
                             'Options for "nesoni freebayes:"',
                             presets=[
                                 ('freebayes', lambda obj: Freebayes(), ''),
                             ])
@config.Configurable_section('vcf_filter',
                             'Options for "nesoni vcf-filter:"',
                             presets=[
                                 ('vcf-filter', lambda obj: Vcf_filter(), ''),
                             ])