Skip to content

Instantly share code, notes, and snippets.

View jkobject's full-sized avatar
💫
researcher, entrepreneur, engineer

Jérémie Kalfon jkobject

💫
researcher, entrepreneur, engineer
View GitHub Profile
@jkobject
jkobject / test_zinb.ipynb
Created September 10, 2024 13:28
showing issue with the nb and zinb loss of scvi
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jkobject
jkobject / mypackage.txt
Created September 6, 2023 15:47
awesome packages
openjdk
ca-certificates
rbenv
git-lfs
samtools
sqlite
htop
htslib
kubernetes
shai
@jkobject
jkobject / my_mtmr.json
Created February 19, 2023 15:18
my mtmr
[
{
"type": "escape",
"width": 64,
"align": "left"
},
{ "type": "brightnessDown", "width": 62, "bordered": false, "align": "left" },
{ "type": "brightnessUp", "width": 62, "bordered": false, "align": "left" },
{
"type": "play",
@jkobject
jkobject / vcf_to_df.py
Last active July 14, 2020 13:16
Generated by macGist (https://github.com/Bunn/macGist) at 14 Jul 2020 at 09:15:56
def vcf_to_df(path):
def read_comments(f):
fields = {}
description = {}
for l in f:
l = l.decode("utf-8")
if l.startswith('##'):
if 'FORMAT' in l[:20]:
res = l.split('ID=')[1].split(',')[0]
desc = l.split('Description=')[1][:-2]
@jkobject
jkobject / macGist.js
Last active April 21, 2020 10:07
Generated by macGist (https://github.com/Bunn/macGist) at 21 Apr 2020 at 05:56:13
bubble{
render{
<View id=top
onLayout={(event) => this.props.getHeight(event.nativeEvent.layout.height+this.state.posY)
}}
weave{
// One line in one branch (example of 1 message)
updateDisplayList(newcurrent){
@jkobject
jkobject / sequencingID_extractor.py
Last active February 28, 2020 20:00
Generated by macGist (https://github.com/Bunn/macGist) at 28 Feb 2020 at 14:58:44
SMs= {}
for i, bam in enumerate(versions):
print(i,end='\r')
data = os.popen('export GCS_OAUTH_TOKEN=`gcloud auth application-default print-access-token` && samtools view -H '+bam +' | grep "^@RG"')
if data == signal.SIGINT:
print('Awakened')
break
else:
res = data.read()
SMs[bam] = re.findall("(?<=\tSM:).+?\t", res)[0]
for k, rowinfo in samples.iterrows():
# check for broken bam files; if broken, then remove from consideration
# need to check for broken filepaths before checking if the sample is in Terra so that we don't add a broken file path for a new participant
pdb.set_trace()
filepath = rowinfo[extract['bam']]
sample_to_check = os.popen('gsutil -m ls -al ' + filepath).read().split('\n')
if sample_to_check == ['']:
# this bam file doesn't exist at this filepath
print("The bam file path we have in data workspace is broken, so we will remove it from consideration:\n " + str(filepath))
broken_bams += [filepath]
def accessAndChange(func, wmfrom, wmto=None, name index_func=None):
data = {}
try:
a = wmfrom.get_participants()
data.update({'participants': a})
except:
print('no participants')
try:
a = wmfrom.get_samples()
data.update({'samples': a})
command <<<
# Function call depends on whether sample has match normal or not
if [ ${normal_id} != NA ]; then
echo "Filtering variants with match normal"
match_normal_variants="--match_normal_filtered_variants ${match_normal_variants}"
else
echo "Filtering variants with no match normal"
fi
python /TSCA/filter_variants.py \
--sample_type Tumor \
@jkobject
jkobject / fromFTPtoGCP.sh
Created July 16, 2019 18:33
Copy a bunch of files from an ftp server to GCP in parallel. #bioinformatics
cat urls.txt | parallel -j 10 'curl -L -s {} | gsutil cp - "gs://BUCKETNAME/GCPFOLDER"$(echo {} | cut -d \/ -f -1)'
#need to have parallel installed (brew, apt)