1 /*===========================================================================
2 *
3 *                            PUBLIC DOMAIN NOTICE
4 *               National Center for Biotechnology Information
5 *
6 *  This software/database is a "United States Government Work" under the
7 *  terms of the United States Copyright Act.  It was written as part of
8 *  the author's official duties as a United States Government employee and
9 *  thus cannot be copyrighted.  This software/database is freely available
10 *  to the public for use. The National Library of Medicine and the U.S.
11 *  Government have not placed any restriction on its use or reproduction.
12 *
13 *  Although all reasonable efforts have been taken to ensure the accuracy
14 *  and reliability of the software and data, the NLM and the U.S.
15 *  Government do not and cannot warrant the performance or results that
16 *  may be obtained by using this software or data. The NLM and the U.S.
17 *  Government disclaim all warranties, express or implied, including
18 *  warranties of performance, merchantability or fitness for any particular
19 *  purpose.
20 *
21 *  Please cite the author in any work or product based on this material.
22 *
23 * ===========================================================================
24 *
25 */
26 
27 #include "py_ReadCollectionItf.h"
28 #include "py_ErrorMsg.hpp"
29 
30 #include <ngs/itf/ReadCollectionItf.hpp>
31 
PY_NGS_ReadCollectionGetName(void * pRef,void ** pRet,void ** ppNGSStrError)32 PY_RES_TYPE PY_NGS_ReadCollectionGetName ( void* pRef, void** pRet, void** ppNGSStrError )
33 {
34     PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
35     try
36     {
37         void* res = CheckedCast< ngs::ReadCollectionItf* >(pRef) -> getName ();
38         assert (pRet != NULL);
39         *pRet = (void*) res;
40         ret = PY_RES_OK;
41     }
42     catch ( ngs::ErrorMsg & x )
43     {
44         ret = ExceptionHandler ( x, ppNGSStrError );
45     }
46     catch ( std::exception & x )
47     {
48         ret = ExceptionHandler ( x, ppNGSStrError );
49     }
50     catch ( ... )
51     {
52         ret = ExceptionHandler ( ppNGSStrError );
53     }
54 
55     return ret;
56 }
57 
PY_NGS_ReadCollectionGetReadGroups(void * pRef,void ** pRet,void ** ppNGSStrError)58 PY_RES_TYPE PY_NGS_ReadCollectionGetReadGroups ( void* pRef, void** pRet, void** ppNGSStrError )
59 {
60     PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
61     try
62     {
63         ngs::ReadGroupItf* res = CheckedCast< ngs::ReadCollectionItf* >(pRef) -> getReadGroups ();
64         assert (pRet != NULL);
65         *pRet = (void*) res;
66         ret = PY_RES_OK;
67     }
68     catch ( ngs::ErrorMsg & x )
69     {
70         ret = ExceptionHandler ( x, ppNGSStrError );
71     }
72     catch ( std::exception & x )
73     {
74         ret = ExceptionHandler ( x, ppNGSStrError );
75     }
76     catch ( ... )
77     {
78         ret = ExceptionHandler ( ppNGSStrError );
79     }
80 
81     return ret;
82 }
83 
PY_NGS_ReadCollectionHasReadGroup(void * pRef,char const * spec,int * pRet,void ** ppNGSStrError)84 PY_RES_TYPE PY_NGS_ReadCollectionHasReadGroup ( void* pRef, char const* spec, int* pRet, void** ppNGSStrError )
85 {
86     PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
87     try
88     {
89         bool res = CheckedCast< ngs::ReadCollectionItf* >(pRef) -> hasReadGroup ( spec );
90         assert (pRet != NULL);
91         *pRet = (int) res;
92         ret = PY_RES_OK;
93     }
94     catch ( ngs::ErrorMsg & x )
95     {
96         ret = ExceptionHandler ( x, ppNGSStrError );
97     }
98     catch ( std::exception & x )
99     {
100         ret = ExceptionHandler ( x, ppNGSStrError );
101     }
102     catch ( ... )
103     {
104         ret = ExceptionHandler ( ppNGSStrError );
105     }
106 
107     return ret;
108 }
109 
PY_NGS_ReadCollectionGetReadGroup(void * pRef,char const * spec,void ** pRet,void ** ppNGSStrError)110 PY_RES_TYPE PY_NGS_ReadCollectionGetReadGroup ( void* pRef, char const* spec, void** pRet, void** ppNGSStrError )
111 {
112     PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
113     try
114     {
115         ngs::ReadGroupItf* res = CheckedCast< ngs::ReadCollectionItf* >(pRef) -> getReadGroup ( spec );
116         assert (pRet != NULL);
117         *pRet = (void*) res;
118         ret = PY_RES_OK;
119     }
120     catch ( ngs::ErrorMsg & x )
121     {
122         ret = ExceptionHandler ( x, ppNGSStrError );
123     }
124     catch ( std::exception & x )
125     {
126         ret = ExceptionHandler ( x, ppNGSStrError );
127     }
128     catch ( ... )
129     {
130         ret = ExceptionHandler ( ppNGSStrError );
131     }
132 
133     return ret;
134 }
135 
PY_NGS_ReadCollectionGetReferences(void * pRef,void ** pRet,void ** ppNGSStrError)136 PY_RES_TYPE PY_NGS_ReadCollectionGetReferences ( void* pRef, void** pRet, void** ppNGSStrError )
137 {
138     PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
139     try
140     {
141         ngs::ReferenceItf* res = CheckedCast< ngs::ReadCollectionItf* >(pRef) -> getReferences ();
142         assert (pRet != NULL);
143         *pRet = (void*) res;
144         ret = PY_RES_OK;
145     }
146     catch ( ngs::ErrorMsg & x )
147     {
148         ret = ExceptionHandler ( x, ppNGSStrError );
149     }
150     catch ( std::exception & x )
151     {
152         ret = ExceptionHandler ( x, ppNGSStrError );
153     }
154     catch ( ... )
155     {
156         ret = ExceptionHandler ( ppNGSStrError );
157     }
158 
159     return ret;
160 }
161 
PY_NGS_ReadCollectionHasReference(void * pRef,char const * spec,int * pRet,void ** ppNGSStrError)162 PY_RES_TYPE PY_NGS_ReadCollectionHasReference ( void* pRef, char const* spec, int* pRet, void** ppNGSStrError )
163 {
164     PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
165     try
166     {
167         bool res = CheckedCast< ngs::ReadCollectionItf* >(pRef) -> hasReference ( spec );
168         assert (pRet != NULL);
169         *pRet = (int) res;
170         ret = PY_RES_OK;
171     }
172     catch ( ngs::ErrorMsg & x )
173     {
174         ret = ExceptionHandler ( x, ppNGSStrError );
175     }
176     catch ( std::exception & x )
177     {
178         ret = ExceptionHandler ( x, ppNGSStrError );
179     }
180     catch ( ... )
181     {
182         ret = ExceptionHandler ( ppNGSStrError );
183     }
184 
185     return ret;
186 }
187 
PY_NGS_ReadCollectionGetReference(void * pRef,char const * spec,void ** pRet,void ** ppNGSStrError)188 PY_RES_TYPE PY_NGS_ReadCollectionGetReference ( void* pRef, char const* spec, void** pRet, void** ppNGSStrError )
189 {
190     PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
191     try
192     {
193         ngs::ReferenceItf* res = CheckedCast< ngs::ReadCollectionItf* >(pRef) -> getReference ( spec );
194         assert (pRet != NULL);
195         *pRet = (void*) res;
196         ret = PY_RES_OK;
197     }
198     catch ( ngs::ErrorMsg & x )
199     {
200         ret = ExceptionHandler ( x, ppNGSStrError );
201     }
202     catch ( std::exception & x )
203     {
204         ret = ExceptionHandler ( x, ppNGSStrError );
205     }
206     catch ( ... )
207     {
208         ret = ExceptionHandler ( ppNGSStrError );
209     }
210 
211     return ret;
212 }
213 
PY_NGS_ReadCollectionGetAlignment(void * pRef,char const * alignmentId,void ** pRet,void ** ppNGSStrError)214 PY_RES_TYPE PY_NGS_ReadCollectionGetAlignment ( void* pRef, char const* alignmentId, void** pRet, void** ppNGSStrError )
215 {
216     PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
217     try
218     {
219         ngs::AlignmentItf* res = CheckedCast< ngs::ReadCollectionItf* >(pRef) -> getAlignment ( alignmentId );
220         assert (pRet != NULL);
221         *pRet = (void*) res;
222         ret = PY_RES_OK;
223     }
224     catch ( ngs::ErrorMsg & x )
225     {
226         ret = ExceptionHandler ( x, ppNGSStrError );
227     }
228     catch ( std::exception & x )
229     {
230         ret = ExceptionHandler ( x, ppNGSStrError );
231     }
232     catch ( ... )
233     {
234         ret = ExceptionHandler ( ppNGSStrError );
235     }
236 
237     return ret;
238 }
239 
PY_NGS_ReadCollectionGetAlignments(void * pRef,uint32_t categories,void ** pRet,void ** ppNGSStrError)240 PY_RES_TYPE PY_NGS_ReadCollectionGetAlignments ( void* pRef, uint32_t categories, void** pRet, void** ppNGSStrError )
241 {
242     PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
243     try
244     {
245         ngs::AlignmentItf* res = CheckedCast< ngs::ReadCollectionItf* >(pRef) -> getAlignments ( categories );
246         assert (pRet != NULL);
247         *pRet = (void*) res;
248         ret = PY_RES_OK;
249     }
250     catch ( ngs::ErrorMsg & x )
251     {
252         ret = ExceptionHandler ( x, ppNGSStrError );
253     }
254     catch ( std::exception & x )
255     {
256         ret = ExceptionHandler ( x, ppNGSStrError );
257     }
258     catch ( ... )
259     {
260         ret = ExceptionHandler ( ppNGSStrError );
261     }
262 
263     return ret;
264 }
265 
PY_NGS_ReadCollectionGetAlignmentCount(void * pRef,uint32_t categories,uint64_t * pRet,void ** ppNGSStrError)266 PY_RES_TYPE PY_NGS_ReadCollectionGetAlignmentCount ( void* pRef, uint32_t categories, uint64_t* pRet, void** ppNGSStrError )
267 {
268     PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
269     try
270     {
271         uint64_t res = CheckedCast< ngs::ReadCollectionItf* >(pRef) -> getAlignmentCount ( categories );
272         assert (pRet != NULL);
273         *pRet = (uint64_t) res;
274         ret = PY_RES_OK;
275     }
276     catch ( ngs::ErrorMsg & x )
277     {
278         ret = ExceptionHandler ( x, ppNGSStrError );
279     }
280     catch ( std::exception & x )
281     {
282         ret = ExceptionHandler ( x, ppNGSStrError );
283     }
284     catch ( ... )
285     {
286         ret = ExceptionHandler ( ppNGSStrError );
287     }
288 
289     return ret;
290 }
291 
PY_NGS_ReadCollectionGetAlignmentRange(void * pRef,uint64_t first,uint64_t count,uint32_t categories,void ** pRet,void ** ppNGSStrError)292 PY_RES_TYPE PY_NGS_ReadCollectionGetAlignmentRange ( void* pRef, uint64_t first, uint64_t count, uint32_t categories, void** pRet, void** ppNGSStrError )
293 {
294     PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
295     try
296     {
297         ngs::AlignmentItf* res = CheckedCast< ngs::ReadCollectionItf* >(pRef) -> getAlignmentRange ( first, count, categories );
298         assert (pRet != NULL);
299         *pRet = (void*) res;
300         ret = PY_RES_OK;
301     }
302     catch ( ngs::ErrorMsg & x )
303     {
304         ret = ExceptionHandler ( x, ppNGSStrError );
305     }
306     catch ( std::exception & x )
307     {
308         ret = ExceptionHandler ( x, ppNGSStrError );
309     }
310     catch ( ... )
311     {
312         ret = ExceptionHandler ( ppNGSStrError );
313     }
314 
315     return ret;
316 }
317 
PY_NGS_ReadCollectionGetRead(void * pRef,char const * readId,void ** pRet,void ** ppNGSStrError)318 PY_RES_TYPE PY_NGS_ReadCollectionGetRead ( void* pRef, char const* readId, void** pRet, void** ppNGSStrError )
319 {
320     PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
321     try
322     {
323         ngs::ReadItf* res = CheckedCast< ngs::ReadCollectionItf* >(pRef) -> getRead ( readId );
324         assert (pRet != NULL);
325         *pRet = (void*) res;
326         ret = PY_RES_OK;
327     }
328     catch ( ngs::ErrorMsg & x )
329     {
330         ret = ExceptionHandler ( x, ppNGSStrError );
331     }
332     catch ( std::exception & x )
333     {
334         ret = ExceptionHandler ( x, ppNGSStrError );
335     }
336     catch ( ... )
337     {
338         ret = ExceptionHandler ( ppNGSStrError );
339     }
340 
341     return ret;
342 }
343 
PY_NGS_ReadCollectionGetReads(void * pRef,uint32_t categories,void ** pRet,void ** ppNGSStrError)344 PY_RES_TYPE PY_NGS_ReadCollectionGetReads ( void* pRef, uint32_t categories, void** pRet, void** ppNGSStrError )
345 {
346     PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
347     try
348     {
349         ngs::ReadItf* res = CheckedCast< ngs::ReadCollectionItf* >(pRef) -> getReads ( categories );
350         assert (pRet != NULL);
351         *pRet = (void*) res;
352         ret = PY_RES_OK;
353     }
354     catch ( ngs::ErrorMsg & x )
355     {
356         ret = ExceptionHandler ( x, ppNGSStrError );
357     }
358     catch ( std::exception & x )
359     {
360         ret = ExceptionHandler ( x, ppNGSStrError );
361     }
362     catch ( ... )
363     {
364         ret = ExceptionHandler ( ppNGSStrError );
365     }
366 
367     return ret;
368 }
369 
PY_NGS_ReadCollectionGetReadCount(void * pRef,uint32_t categories,uint64_t * pRet,void ** ppNGSStrError)370 PY_RES_TYPE PY_NGS_ReadCollectionGetReadCount ( void* pRef, uint32_t categories, uint64_t* pRet, void** ppNGSStrError )
371 {
372     PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
373     try
374     {
375         uint64_t res = CheckedCast< ngs::ReadCollectionItf* >(pRef) -> getReadCount ( categories );
376         assert (pRet != NULL);
377         *pRet = (uint64_t) res;
378         ret = PY_RES_OK;
379     }
380     catch ( ngs::ErrorMsg & x )
381     {
382         ret = ExceptionHandler ( x, ppNGSStrError );
383     }
384     catch ( std::exception & x )
385     {
386         ret = ExceptionHandler ( x, ppNGSStrError );
387     }
388     catch ( ... )
389     {
390         ret = ExceptionHandler ( ppNGSStrError );
391     }
392 
393     return ret;
394 }
395 
PY_NGS_ReadCollectionGetReadRange(void * pRef,uint64_t first,uint64_t count,uint32_t categories,void ** pRet,void ** ppNGSStrError)396 PY_RES_TYPE PY_NGS_ReadCollectionGetReadRange ( void* pRef, uint64_t first, uint64_t count, uint32_t categories, void** pRet, void** ppNGSStrError )
397 {
398     PY_RES_TYPE ret = PY_RES_ERROR; // TODO: use xt_* codes
399     try
400     {
401         ngs::ReadItf* res = CheckedCast< ngs::ReadCollectionItf* >(pRef) -> getReadRange ( first, count, categories );
402         assert (pRet != NULL);
403         *pRet = (void*) res;
404         ret = PY_RES_OK;
405     }
406     catch ( ngs::ErrorMsg & x )
407     {
408         ret = ExceptionHandler ( x, ppNGSStrError );
409     }
410     catch ( std::exception & x )
411     {
412         ret = ExceptionHandler ( x, ppNGSStrError );
413     }
414     catch ( ... )
415     {
416         ret = ExceptionHandler ( ppNGSStrError );
417     }
418 
419     return ret;
420 }
421 
422