File: __init__.py

package info (click to toggle)
python-pbcore 1.6.5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 19,168 kB
  • sloc: python: 25,497; xml: 2,846; makefile: 251; sh: 24
file content (154 lines) | stat: -rw-r--r-- 4,535 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
from __future__ import absolute_import

from pkg_resources import Requirement, resource_filename

DATA_FILES = {'aligned_reads_1.cmp.h5':
                  ['m110818_075520_42141_c100129202555500000315043109121112_s1_p0.bas.h5',
                   'm110818_075520_42141_c100129202555500000315043109121112_s2_p0.bas.h5']}

MOVIE_NAME_14 = "m110818_075520_42141_c100129202555500000315043109121112_s1_p0"
MOVIE_NAME_20 = "m130522_092457_42208_c100497142550000001823078008081323_s1_p0"
MOVIE_NAME_21 = "m130731_192718_42129_c100564662550000001823085912221321_s1_p0"
MOVIE_NAME_23 = "m140912_020930_00114_c100702482550000001823141103261590_s1_p0"
MOVIE_NAME_CCS = "m130727_114215_42211_c100569412550000001823090301191423_s1_p0"
MOVIE_NAME_BC = "m140307_221913_42203_c100626172550000001823119008061414_s1_p0"

def _getAbsPath(fname):
    return resource_filename(Requirement.parse('pbcore'),'pbcore/data/%s' % fname)

def getBasH5_v20():
    return _getAbsPath(MOVIE_NAME_20 + '.bas.h5')

def getBaxH5_v20():
    return [_getAbsPath('.'.join((MOVIE_NAME_20, str(k), 'bax.h5')))
            for k in range(1,4)]

def getBasH5_v21():
    return _getAbsPath(MOVIE_NAME_21 + '.bas.h5')

def getBaxH5_v21():
    return [_getAbsPath('.'.join((MOVIE_NAME_21, str(k), 'bax.h5')))
            for k in range(1,4)]

def getBasH5_v23():
    return _getAbsPath(MOVIE_NAME_23 + '.bas.h5')

def getBaxH5_v23():
    return [_getAbsPath('.'.join((MOVIE_NAME_23, str(k), 'bax.h5')))
            for k in range(1,4)]

def getCCSH5():
    return _getAbsPath(MOVIE_NAME_CCS + '.1.ccs.h5')

def getCCSBAM():
    return _getAbsPath(MOVIE_NAME_CCS + '.ccs.bam')

def getBcH5s():
    return [_getAbsPath('.'.join((MOVIE_NAME_BC, str(k), 'bc.h5')))
            for k in range(1,4)]

def getCmpH5s():
    '''
    Returns a list of dictionaries containing 2 keys: cmph5 and
    bash5s. The latter are the bash5s that were used to generate the
    cmp.h5 file.
    '''
    return [{'cmph5' : _getAbsPath(cmph5),
             'bash5s': map(_getAbsPath, bash5s)}
            for cmph5, bash5s in DATA_FILES.items()]

def getCmpH5AndBas():
    '''
    The returned value is a dictionary containing 2 keys: cmph5
    and bash5s. The latter are the bash5s that were used to generate
    the cmp.h5 file.
    '''
    return getCmpH5s()[0]

def getCmpH5():
    return getCmpH5AndBas()["cmph5"]

def getBasH5s():
    return getCmpH5AndBas()["bash5s"]

def getGff3():
    '''
    Returns the filename of an example GFFv3 file
    '''
    return _getAbsPath("variants.gff")

def getFasta():
    '''
    Returns the filename of an example FASTA file.
    '''
    return _getAbsPath('Fluidigm_human_amplicons.fasta')


def getTinyFasta():
    """
    Returns the filename of an example FASTA file.
    """
    return _getAbsPath('Fluidigm_human_amplicons_tiny.fasta')

def getLambdaFasta():
    """
    Returns the filename of the FASTA of the lambda phage reference.
    """
    return _getAbsPath('lambdaNEB.fa')

def getDosFormattedFasta():
    """
    Returns the filename of an example FASTA file with DOS line endings
    """
    return _getAbsPath('barcodes-ed65-450.fasta')

def getBlasrM4():
    return _getAbsPath('blasr-output.m4')

def getBlasrM5():
    return _getAbsPath('blasr-output.m5')

def getFofns():
    """
    Returns a list of FOFN files
    """
    return map(_getAbsPath,
               ["1.4_bas_files.fofn",
                "2.0_bax_files.fofn",
                "2.1_bax_files.fofn",
                "2.1_ccs_files.fofn"])

def getBcFofn():
    return _getAbsPath("bc_files.fofn")


def getBamAndCmpH5():
    """
    Get a "matched" (aligned) BAM and cmp.h5 file
    """
    return (_getAbsPath("m140905_042212_sidney_c100564852550000001823085912221377_s1_X0.aligned_subreads.bam"),
            _getAbsPath("m140905_042212_sidney_c100564852550000001823085912221377_s1_X0.aligned_subreads.cmp.h5"))

def getBaxForBam():
    """
    Get the bax file that was mapped to produce the bam
    """
    return _getAbsPath("m140905_042212_sidney_c100564852550000001823085912221377_s1_X0.1.bax.h5")

def getUnalignedBam():
    """
    Get the unaligned BAM file, corresponding to the same bax above
    """
    return _getAbsPath("m140905_042212_sidney_c100564852550000001823085912221377_s1_X0.subreads.bam")

def getEmptyBam():
    return _getAbsPath("empty.ccs.bam")

def getEmptyAlignedBam():
    return _getAbsPath("empty.aligned_subreads.bam")

def getMappingXml():
    return _getAbsPath("chemistry.xml")

def getWeird():
    return _getAbsPath("weird.fa")