Hello 
i have a bed file like this 

    1	3004104	3004110
    1	3005819	3005825
    1	3008315	3008321	
    1	3008893	3008899	 
    1	3009812	3009818	
    1	3012422	3012428	 
    1	3015794	3015800	 
    1	3016183	3016189	
    1	3024019	3024025	
    1	3025279	3025285	

and i would like to create another one out of this to in this format : 

    1	1	3004110
    1	3004104	3005825
    1	3005819	3008321
    1	3008315	3008899
    1	3008893	3009818
    1	3009812	3012428
    1	3012422	3015800
    1	3015794	3016189
    1	3016183	3024025
    1	3024019	3025285

Do you know an easy way to do it in R or in Python ?

Thank you in advance 

Using **R**, *lag* function from *dplyr* package:

    # example data
    mybed <- read.table(text = "
                        1   3004104 3004110
                        1   3005819 3005825
                        1   3008315 3008321 
                        1   3008893 3008899  
                        1   3009812 3009818 
                        1   3012422 3012428  
                        1   3015794 3015800  
                        1   3016183 3016189 
                        1   3024019 3024025 
                        1   3025279 3025285")
    
    
    library(dplyr)
    
    mybed %>% 
      transmute(
        chr = V1,
        start = lag(V2, default = 1),
        end = V3)