コード例 #1
0
 def test_faidx(self):
     cmdline = SamtoolsFaidxCommandline(samtools_exe)
     cmdline.set_parameter("reference", self.reference)
     stdout, stderr = cmdline()
     self.assertFalse(
         stderr, f"Samtools faidx failed:\n{cmdline}\nStderr:{stderr}")
     self.assertTrue(os.path.isfile(self.referenceindexfile))
コード例 #2
0
 def test_faidx(self):
     cmdline = SamtoolsFaidxCommandline(samtools_exe)
     cmdline.set_parameter("reference", self.reference)
     stdout, stderr = cmdline()
     self.assertFalse(stderr,
                      "Samtools faidx failed:\n%s\nStderr:%s"
                      % (cmdline, stderr))
     self.assertTrue(os.path.isfile(self.referenceindexfile))
コード例 #3
0
ファイル: reports.py プロジェクト: lowandrew/geneSipprV2
 def gdcs_fai(sample, analysistype='GDCS'):
     """
     GDCS analyses need to use the .fai file supplied in the targets folder rather than the one created following
     reverse baiting
     :param sample: sample object
     :param analysistype: current analysis being performed
     """
     from Bio.Sequencing.Applications import SamtoolsFaidxCommandline
     try:
         # Find the .fai file in the target path
         sample[analysistype].faifile = glob(os.path.join(sample[analysistype].targetpath, '*.fai'))[0]
     except IndexError:
         target_file = glob(os.path.join(sample[analysistype].targetpath, '*.fasta'))[0]
         samindex = SamtoolsFaidxCommandline(reference=target_file)
         map(StringIO, samindex(cwd=sample[analysistype].targetpath))
         sample[analysistype].faifile = glob(os.path.join(sample[analysistype].targetpath, '*.fai'))[0]
     # Get the fai file into a dictionary to be used in parsing results
     try:
         with open(sample[analysistype].faifile, 'r') as faifile:
             for line in faifile:
                 data = line.split('\t')
                 try:
                     sample[analysistype].faidict[data[0]] = int(data[1])
                 except KeyError:
                     sample[analysistype].faidict = dict()
                     sample[analysistype].faidict[data[0]] = int(data[1])
     except FileNotFoundError:
         pass
コード例 #4
0
ファイル: test_method.py プロジェクト: lowandrew/geneSipprV2
def test_index_target(variables):
    targetpath = os.path.join(variables.targetpath, 'bait')
    target_index = SamtoolsFaidxCommandline(
        reference=os.path.join(targetpath, 'baitedtargets.fa'))
    target_index()
    size = os.stat(os.path.join(targetpath, 'baitedtargets.fa.fai'))
    assert size.st_size > 0
コード例 #5
0
 def create_fasta_index(self):
     """Create index for reference fasta sequence."""
     cmdline = SamtoolsFaidxCommandline(samtools_exe)
     cmdline.set_parameter("reference", self.reference)
     stdout, stderr = cmdline()
コード例 #6
0
 def create_fasta_index(self):
     """Creates index for reference fasta sequence."""
     cmdline = SamtoolsFaidxCommandline(samtools_exe)
     cmdline.set_parameter("reference", self.reference)
     stdout, stderr = cmdline()