viola.concat

concat(ls_objs)

Concatenate multiple Bedpe/MultiBedpe objects into single MultiBedpe object.

Parameters

ls_objs (List[Bedpe or MultiBedpe]) – A list of Bedpe/MultiBedpe objects to be concatenated.

Returns

The MultiBedpe object including all patients in the input data.

Return type

MultiBedpe

Examples

>>> import viola
>>> from io import StringIO
>>> data1   =       """chrom1       start1  end1    chrom2  start2  end2    name    score   strand1 strand2 info_0  info_1
... chr1    10      11      chr1    20      21      test1   60      +       -       A       1
... chr1    150     151     chr1    300     301     test2   60      +       -       B       1
... chr3    10      11      chr4    20      21      test3   60      -       -       F       4
... """
>>> data2   =       """chrom1       start1  end1    chrom2  start2  end2    name    score   strand1 strand2 info_0  info_1
... chr1    100     101     chr1    250     251     test1   60      +       -       A       2
... chr2    180     181     chr2    3000    3001    test2   60      -       -       S       3
... chr2    10      11      chr5    20      21      test3   60      +       -       L       6
... """
>>> data3   =       """chrom1       start1  end1    chrom2  start2  end2    name    score   strand1 strand2 info_1  info_2
... chr2    10      11      chr5    20      21      test1   60      +       -       7       T
... chr3    10      11      chr4    20      21      test2   60      -       -       1       F
... """
>>> bedpe1 = viola.read_bedpe(StringIO(data1), patient_name='patient1')
>>> bedpe2 = viola.read_bedpe(StringIO(data2), patient_name='patient2')
>>> multi_bedpe1 = viola.MultiBedpe([bedpe1, bedpe2], ['patient1', 'patient2'])
>>> bedpe3 = viola.read_bedpe(StringIO(data3), patient_name='patient3')
>>> concat_bedpe = viola.concat([multi_bedpe1, bedpe3])
>>> print(concat_bedpe)
INFO=svlen,svtype,cipos,ciend,info_0,info_1,info_2
Documentation of Bedpe object ==> https://dermasugita.github.io/ViolaDocs/docs/html/reference/multi_bedpe.html
               id       be1        be2 strand  qual svtype
0  patient1_test1   chr1:11    chr1:21     +-    60    DEL
1  patient1_test2  chr1:151   chr1:301     +-    60    DEL
2  patient1_test3   chr3:11    chr4:21     --    60    BND
3  patient2_test1  chr1:101   chr1:251     +-    60    DEL
4  patient2_test2  chr2:181  chr2:3001     --    60    INV
5  patient2_test3   chr2:11    chr5:21     +-    60    BND
6  patient3_test1   chr2:11    chr5:21     +-    60    BND
7  patient3_test2   chr3:11    chr4:21     --    60    BND