@@ -235,17 +235,18 @@ <h1><span class="header-section-number">13</span> Applying custom methods to pai
235235## | Chromosome | Start | End | Name | Score | Strand |
236236## | (category) | (int32) | (int32) | (object) | (int64) | (category) |
237237## |--------------+-----------+-----------+------------+-----------+--------------|
238- ## | chr1 | 100079649 | 100079674 | U0 | 0 | - |
239- ## | chr1 | 144227079 | 144227104 | U0 | 0 | + |
240- ## | chr1 | 156338310 | 156338335 | U0 | 0 | - |
238+ ## | chr1 | 212609534 | 212609559 | U0 | 0 | + |
241239## | chr1 | 169887529 | 169887554 | U0 | 0 | + |
240+ ## | chr1 | 216711011 | 216711036 | U0 | 0 | + |
241+ ## | chr1 | 144227079 | 144227104 | U0 | 0 | + |
242242## | ... | ... | ... | ... | ... | ... |
243- ## | chrY | 21559181 | 21559206 | U0 | 0 | + |
244243## | chrY | 21751211 | 21751236 | U0 | 0 | - |
244+ ## | chrY | 7701983 | 7702008 | U0 | 0 | - |
245245## | chrY | 21910706 | 21910731 | U0 | 0 | - |
246246## | chrY | 22054002 | 22054027 | U0 | 0 | - |
247247## +--------------+-----------+-----------+------------+-----------+--------------+
248- ## Stranded PyRanges object has 240 rows and 6 columns from 24 chromosomes.</ code > </ pre >
248+ ## Stranded PyRanges object has 240 rows and 6 columns from 24 chromosomes.
249+ ## The PyRanges is sorted on Chromosome and Strand.</ code > </ pre >
249250< div class ="sourceCode " id ="cb160 "> < pre class ="sourceCode python "> < code class ="sourceCode python "> < a class ="sourceLine " id ="cb160-1 " data-line-number ="1 "> < span class ="kw "> def</ span > set_start_to_zero(df):</ a >
250251< a class ="sourceLine " id ="cb160-2 " data-line-number ="2 "> df.Start < span class ="op "> =</ span > < span class ="dv "> 0</ span > </ a >
251252< a class ="sourceLine " id ="cb160-3 " data-line-number ="3 "> < span class ="cf "> return</ span > df</ a >
@@ -255,17 +256,18 @@ <h1><span class="header-section-number">13</span> Applying custom methods to pai
255256## | Chromosome | Start | End | Name | Score | Strand |
256257## | (category) | (int64) | (int32) | (object) | (int64) | (category) |
257258## |--------------+-----------+-----------+------------+-----------+--------------|
258- ## | chr1 | 0 | 100079674 | U0 | 0 | - |
259- ## | chr1 | 0 | 144227104 | U0 | 0 | + |
260- ## | chr1 | 0 | 156338335 | U0 | 0 | - |
259+ ## | chr1 | 0 | 212609559 | U0 | 0 | + |
261260## | chr1 | 0 | 169887554 | U0 | 0 | + |
261+ ## | chr1 | 0 | 216711036 | U0 | 0 | + |
262+ ## | chr1 | 0 | 144227104 | U0 | 0 | + |
262263## | ... | ... | ... | ... | ... | ... |
263- ## | chrY | 0 | 11942795 | U0 | 0 | + |
264- ## | chrY | 0 | 13517917 | U0 | 0 | - |
265264## | chrY | 0 | 15224260 | U0 | 0 | - |
266- ## | chrY | 0 | 21559206 | U0 | 0 | + |
265+ ## | chrY | 0 | 13517917 | U0 | 0 | - |
266+ ## | chrY | 0 | 8010976 | U0 | 0 | - |
267+ ## | chrY | 0 | 7405401 | U0 | 0 | - |
267268## +--------------+-----------+-----------+------------+-----------+--------------+
268- ## Stranded PyRanges object has 10,000 rows and 6 columns from 24 chromosomes.</ code > </ pre >
269+ ## Stranded PyRanges object has 10,000 rows and 6 columns from 24 chromosomes.
270+ ## The PyRanges is sorted on Chromosome and Strand.</ code > </ pre >
269271< p > Keyword arguments can be sent to the function:</ p >
270272< div class ="sourceCode " id ="cb162 "> < pre class ="sourceCode python "> < code class ="sourceCode python "> < a class ="sourceLine " id ="cb162-1 " data-line-number ="1 "> < span class ="kw "> def</ span > _print(df, kwargs):</ a >
271273< a class ="sourceLine " id ="cb162-2 " data-line-number ="2 "> < span class ="bu "> print</ span > (< span class ="st "> "My keyword arguments were:"</ span > , kwargs.get(< span class ="st "> "value"</ span > ), < span class ="st "> "and"</ span > , kwargs.get(< span class ="st "> "whatever"</ span > ))</ a >
@@ -324,17 +326,18 @@ <h1><span class="header-section-number">13</span> Applying custom methods to pai
324326## | Chromosome | Start | End | Name | Score | Strand |
325327## | (category) | (int64) | (int32) | (object) | (int64) | (category) |
326328## |--------------+-----------+-----------+------------+-----------+--------------|
327- ## | chr1 | 0 | 100079674 | U0 | 0 | - |
328- ## | chr1 | 0 | 144227104 | U0 | 0 | + |
329- ## | chr1 | 0 | 156338335 | U0 | 0 | - |
329+ ## | chr1 | 0 | 212609559 | U0 | 0 | + |
330330## | chr1 | 0 | 169887554 | U0 | 0 | + |
331+ ## | chr1 | 0 | 216711036 | U0 | 0 | + |
332+ ## | chr1 | 0 | 144227104 | U0 | 0 | + |
331333## | ... | ... | ... | ... | ... | ... |
332- ## | chrY | 0 | 11942795 | U0 | 0 | + |
333- ## | chrY | 0 | 13517917 | U0 | 0 | - |
334334## | chrY | 0 | 15224260 | U0 | 0 | - |
335- ## | chrY | 0 | 21559206 | U0 | 0 | + |
335+ ## | chrY | 0 | 13517917 | U0 | 0 | - |
336+ ## | chrY | 0 | 8010976 | U0 | 0 | - |
337+ ## | chrY | 0 | 7405401 | U0 | 0 | - |
336338## +--------------+-----------+-----------+------------+-----------+--------------+
337- ## Stranded PyRanges object has 10,000 rows and 6 columns from 24 chromosomes.</ code > </ pre >
339+ ## Stranded PyRanges object has 10,000 rows and 6 columns from 24 chromosomes.
340+ ## The PyRanges is sorted on Chromosome and Strand.</ code > </ pre >
338341< p > They were printed 24 times since the function was applied once per chromosome.</ p >
339342< p > apply_chunks splits each chromosome into < code > nb_cpu</ code > chunks and runs each chunk in
340343parallel, which is useful for slow row-based operations (like fisher exact, for
0 commit comments